|
![](/i/fill.gif) |
"Mark Weyer" <nomail@nomail> wrote:
> > what's the best way to get a stereographic projection in megaPov?
> > I mean, projecting the scene to a sphere from its center, then
> > projecting the sphere to a plane stereographically. I don't feel like
> > defining a camera type but I can do if needed.
>
> The general idea is, that you want to emit camera rays from the pole of
> the sphere and double their angle to the camera direction when they hit
> the sphere.
>
OK, I had a look at stereographic projection and get it now (it has nothing to
do with stereoscopic). Since you said you were using megaPOV, it is a very
simple user-defined camera setup:
This camera looks down on the sphere from the positive y-axis. Assuming the
sphere is centered at the origin. If the desired sphere center is translated,
it is simply a matter of adding the translation to the X,Y,Z components of the
location vector. The camera can easily be converted to other axis planes of
projections by swapping the appropriate X/Y/Z components in both the location
and direction vectors. For arbritrary planes of projection, a lot more trig
will be needed to get the proper location and direction vectors, best to stick
with x,y or z.
//START
#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}
}
}
//END
-tgq
Post a reply to this message
|
![](/i/fill.gif) |