POV-Ray : Newsgroups : povray.newusers : distance of the viewing plane to the camera : Re: distance of the viewing plane to the camera Server Time
29 Jul 2024 12:26:03 EDT (-0400)
  Re: distance of the viewing plane to the camera  
From: Chris B
Date: 24 Dec 2005 16:30:04
Message: <43adbddc$1@news.povray.org>
"hermans" <sas### [at] telenetbe> wrote in message 
news:43ad6f61@news.povray.org...
> For illustrating some properties of perspective I want to place the 
> viewing plane at a given distance from the camera. I think this has to do 
> with the direction vector, but also with the right vector.
> If I put a perspective camera at a point <a,b,c> viewing in the direction 
> <0,0,1> how can I determine the combination of the right and the direction 
> vector to obtain the viewing plane, parallel to the (X,Z)-plane at a 
> distance d from the camera in the direction determined by <0,0,1>?

Hi,

With the camera at <A,B,C> and a 'direction' vector of <0,0,1>  then, if you 
imagine a viewing plane 1 unit from the camera in the +z direction, the 
image will fill a rectangle on the viewing plane that has a width as defined 
by the 'x' component of the 'right' vector and a height as defined by the 
'y' component of the 'up' vector (so long as the other components of the 
'right' and 'up' vectors are 0).

The 'right' vector and the 'up' vector normally match the proportions of the 
image, so for an 800 x 600 image you would use x*4/3 for the 'right' vector 
and y for the 'up' vector (the default values). If these are not in 
proportion the image gets distorted (as in the following example).

The following SDL illustrates that, so long as the RightVector is a multiple 
of <1,0,0> and the UpVector is a multiple of <0,1,0>, then it should keep 
the spheres in the corners of the image (despite potentially distorting the 
image).

Regards, and Merry Xmas
Chris B.



#local A = 5;
#local B = 2;
#local C = 3;
#local RightVector = x*4/3;
#local UpVector = 2*y;

light_source { < -15, 10  ,-80> color rgb 1}
camera {location <A,B,C> direction <0,0,1>
  right RightVector
  up UpVector
}

sphere {<A-RightVector.x/2,B-UpVector.y/2,C+1>,0.05 pigment {color rgb 
<50,0,0>}}
sphere {<A-RightVector.x/2,B+UpVector.y/2,C+1>,0.05 pigment {color rgb 
<50,0,0>}}
sphere {<A+RightVector.x/2,B-UpVector.y/2,C+1>,0.05 pigment {color rgb 
<50,0,0>}}
sphere {<A+RightVector.x/2,B+UpVector.y/2,C+1>,0.05 pigment {color rgb 
<50,0,0>}}

box {-0.5,0.5 rotate <45,45,0> translate <A,B,C+2> pigment {color rgb 
<1,0,1>}}


Post a reply to this message

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