POV-Ray : Newsgroups : povray.general : Custom reference point for perspective camera? : Re: Custom reference point for perspective camera? Server Time
2 Aug 2024 12:20:53 EDT (-0400)
  Re: Custom reference point for perspective camera?  
From: Slime
Date: 20 Oct 2004 20:11:54
Message: <4176feca$1@news.povray.org>
> We all know that perspective projection is for projecting on a flat
> surface, and that the perspective reference point is at the center.

I'm not sure what you mean by the "perspective reference point," unless
you're referring to the point specified by the look_at keyword. Assuming
that's the case...

> The math instantly shows that the perspective reference point
> isn't at the center, not even inside the image. So how are you going to
> do that in POV-Ray?

A matrix transformation can be used to shear the camera. This can offset the
look_at point from the center of the image. Shear the camera on the left so
that it's looking to the right (without changing the normal of the
perspective plane) and the camera on the right so that it's looking to the
left, and I think that's the effect you're looking for. A little knowledge
about matrix transformations and it shouldn't even be too difficult to
construct the right one:

camera {
// start by looking in the z-direction
location 0
look_at z

// shear sideways
matrix <
1,0,0,
0,1,0,
shear_amount,0,1,
0,0,0
>
translate eye_pos*x
}

Where shear_amount is the tangent of the angle between foward (z) and the
direction you want the center of the image to be in; and eye_pos is the
horizontal offset of the camera from the center of the "eyes" of the
"viewer" (one camera would be to the right, the other to the left). You can
then rotate and translate the cameras to whatever position you want them in.

Unfortunately, as this creates non-perpendicular camera vectors, you have to
turn off vista buffers in the command line (-UV). The fact that this camera
is just an offset from a normal perspective camera leads me to believe that
vista buffers *could* work with it (as long as the right and up vectors are
perpendicular), but apparently POV-Ray is not programmed to handle this
case.

Finally, one last point:

> But
> what if you want to make 'perfect' cross-eyed stereo renderings, like
> me?

There is an impossibility in creating "perfect" stereo renderings. In real
life, when you look at objects at different distances, your eyes rotate to
look at them (going slightly cross-eyed for closer objects). Your image,
however, can't rotate like a viewer's eye just because they're focusing on a
different part of the image. Therefore, you can only plan your image out
with a certain reference point in mind: the point in 3D space which is on
the same 2D position in both images. Everywhere else the viewer looks will
cause their peripheral vision to be (very slightly) different than what they
would see in real life, because the camera doesn't rotate the way their eyes
rotate.

This difference is about the same as the difference that you're trying to
avoid by using fancy camera shapes, so I'm not sure it's really worth the
effort. I'm also not convinced that the sheared cameras will actually be an
improvement over having both cameras look_at a central point.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

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