POV-Ray : Newsgroups : povray.newusers : Really weird image mapping results : Re: Really weird image mapping results Server Time
3 May 2024 07:21:45 EDT (-0400)
  Re: Really weird image mapping results  
From: Bald Eagle
Date: 12 Oct 2014 16:00:01
Message: <web.543adc746bae7a595e7df57c0@news.povray.org>
Alain <kua### [at] videotronca> wrote:

> The image is mapped from <0,0> to <1,1> (the X-Y plane) and extend along
> the Z axis to infinity.

Yes, I understood that.

> This should be:
> #declare Circle = function (x,y) { 1- sqrt(pow (x,2) + pow (y,2)) }

True.  I was messing around with all sorts of stuff, and abandoned that for the
time being while I tried to understand the mapping of a bona-fide hemisphere.

 //##############################################################################
> > #declare Hemisphere =
> > union {
> > difference {
> >   sphere {0, 1 }
> >   box {0, 1 translate <-.5, -.5, 0> scale 2}
> >   texture {Medallion translate -0.5}
> >   scale <18, 18, 1.5>
> > }
>
> This half sphere extend toward -Y and it's flat part is on the X-Z plane
> The image is mapped relative to the X-Y plane.
> You need to rotate the image_map +90*x, translate it by -0.5 along the X
> axis and scale it by 2.

Nope.
First off, my sphere is centered at the origin with radius of 1.
Next, I make a box extending from the origin to <1,1,1>
Then it gets translated halfway to the left, and halfway down, so it's still
sticking back in the +z direction.
Then it gets scaled by 2, and since its front face is at z=0, it gets scaled
relative to the origin to give a box that extends from <-1, -1, 0> to <1, 1, 2>
This chops off the back side of the sphere to give the flat part in the X-Y
plane, and the front part of the sphere extends in the -z direction.

The image map is therefore shifted by -0.5 in each direction to center it on the
origin, since the z-translation is irrelevant.

You can actually see that this is the case in the image - the view is looking at
the origin from -z, the image is mapped onto the convex face of the hemisphere,
and the rotated green hemisphere shows that it started off with the flat in X-Y.

If it makes you feel any better, I somehow had x and z all twisted around in my
head the other day when rotating an image map texture.

I looked it over and fixed the scaling, and it looks a lot better.  I got
confused between the image map itself, and the thing it was getting mapped on,
so I was expecting the "once" to map the image ONCE onto the _object_, but that
was my misinterpretation, and it did indeed need to be scaled.

> Coincident with the previous hemisphere.

I can't believe I got snookered by the coincident surface problem!
AAAAAAAAAAAAAaaaaaaaaaaaaaaaaaaaaaaaaaaaaarrrrrrrrrrrrrrrggggghhh!
:(


Thanks for helping me look this over - I took a walk, ate lunch, looked at it
with fresh eyes after you pointed those things out and it's looking like I
wanted and actually better than I expected.

Merci!


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.