POV-Ray : Newsgroups : povray.advanced-users : stereographic projection : Re: stereographic projection Server Time
5 Jul 2024 15:38:56 EDT (-0400)
  Re: stereographic projection  
From: Mark Weyer
Date: 8 Feb 2008 03:15:00
Message: <web.47ac0e578ae02ef3fddaa4670@news.povray.org>
> > > #declare R=1;//Radius of projected sphere
> > > #declare d=2;//distance from center of sphere
> > > camera {
> > >   user_defined
> > >   location{
> > >     function{(u-1/2)*2*(R+d)}
> > >     function{d}
> > >     function{(v-1/2)*2*(R+d)}
> > >   }
> > >   direction{
> > >     function{-(u-1/2)*2}
> > >     function{-1}
> > >     function{-(v-1/2)*2}
> > >   }
> > > }

Consider the following:

  camera {
    location -R*y
    direction y
    right -2*x
    up -2*z
  }

If I understand syntax correctly, this should be equivalent to

  camera
    user_defined
    location {function {0} function {-R*y} function {0}}
    direction {
      function {(u-1/2)*-2}
      function {-1}
      function {(v-1/2)*-2}
    }
  }

Now, assuming I made no mistake, the second camera is a shorthand for the
third one. The directions in the first and third are equal. The locations
are not equal, but, by your argument cited below, they differ only by a
factor (R+d) of the respective direction.

Now assume, that nothing is between the two version of location, in
particular no media and no fog. Then the first and third camera give the
same result. As the second is a shorthand for this, we may conclude that
your camera is equivalent to a standard perspective camera. (Up to nothing
beeing in between the different locations.) This is not intended for
stereographic projection.

> What I have should work (and seems to, I tested it with a checkered mapped
> hemisphere.  Rather than looking from the pole to the sphere, I have placed the
> viewing plane at the user-defined distance d from the center.  To view the
> entire hemisphere, the size of the viewplane is a 2*(R+d) square.  The camera
> looks back from this viewplane to the opposite pole of the sphere.  The camera
> viewplane is defined in u,v cordinates from 0-1, these are converted to a
> centered coordinate system by subtracting -1/2 so they run from -1/2 to 1/2
> with the length still being 1.  Hence, each viewpoint is defined by the
> modified u,v coordinate multplied by the size of the viewplane (for X & Z): x=
> (u-1/2) * 2*(R+d), z= (v-1/2) * 2*(R+d).  The y coordinate will always be the
> distance from the center: y=d.  Given these as the location coordinates, the
> look at coordinate is the south pole or <0,-R,0>, the direction is the look at
> minus the location: x=-(u-1/2)*2*(R+d), y=-R-d=-(R+d), z=-(v-1/2)*2*(R+d).
> This vector can be further simplified by dividing out the common (R+d):
> x=-(u-1/2)*2, y=-1, z=-(v-1/2)*2.


> One advantage here, is that the camera can be positioned some distance from the
> look_at point to ensure that it is not inside an object.

This is indeed true.

  Mark Weyer


Post a reply to this message

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