POV-Ray : Newsgroups : povray.advanced-users : Different camera parameters Server Time
25 Nov 2024 07:22:30 EST (-0500)
  Different camera parameters (Message 1 to 10 of 16)  
Goto Latest 10 Messages Next 6 Messages >>>
From: Warp
Subject: Different camera parameters
Date: 23 Apr 2003 05:07:43
Message: <3ea657df@news.povray.org>
Even after using POV-Ray for over 5 years and considering myself an
experienced user, the exact meaning of different camera parameters still
elude me.
  Could someone who knows exactly how they work explain in detail?

  For example, I fail to deduce the reason why "up -y" flips the image
horizontally.
  What is the difference between the 'sky' and the 'up' vectors?

  How exactly does 'direction' work?
  Do 'angle' and 'direction' work together, or are they mutually exclusive
alternatives to do the same thing (by different way of measuring things)?
That is, if I specify 'direction', does it simply override a previous 'angle'
definition, or does it add something to it instead?
  What is the relation (if any) between 'direction' and 'look_at'?
  Perhaps 'direction' is a way of defining both 'angle' and 'look_at' with
one single vector?

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Slime
Subject: Re: Different camera parameters
Date: 23 Apr 2003 10:32:55
Message: <3ea6a417$1@news.povray.org>
The first thing you must understand is the difference between camera
parameters and camera modifiers.

The following are camera parameters:

    location <Location> | right <Right> | up <Up> |
    direction <Direction> | sky <Sky>

They set up the camera as shown in section 6.4.1 of the documentation
(please ignore the angle and look_at vectors in that diagram). If you use
only these parameters, the camera will turn out exactly as that picture
shows. Note that the length of these vectors is important (a longer
direction will cause the camera to zoom in more, for instance). Also note
that, at this point, the sky vector is meaningless and has absolutely no
effect.

After these vectors have been specified (or, if they're not specified, after
they take their default value), the following camera *modifiers* *change*
them:

    angle HORIZONTAL [VERTICAL] | look_at <Look_At> |
    blur_samples Num_of_Samples | aperture Size |
    focal_point <Point> | confidence Blur_Confidence |
    variance Blur_Variance | NORMAL | TRANSFORMATION

in the following ways:
- The angle keyword will change the length of the direction vector, based on
the formula direction_length = 0.5 * right_length / tan(angle / 2).
 - the look_at vector is applied in the following manner: the direction is
changed to face towards the look_at vector, the right vector is changed to
be perpendicular to [the plane created by the vectors (look_at-location) and
(sky-location)], and the up vector is made to remain along that plane. This
is the most intuitive behavior, which lets you specify where the camera is
looking at. The sky vector is used at this point to determine how much the
camera is "rolled" (so that it knows which direction is "up").
- the rest of the settings apply to focal blur and other camera features.

At this point, once all of the modifiers have been applied, transformations
(rotation, translation, etc) will be applied to the camera.

So now, to answer your specific questions:

>   For example, I fail to deduce the reason why "up -y" flips the image
> horizontally.

It probably has something to do with the order in which you specified
keywords or something. Remember that the keywords are applied in the order
described above, regardless of what order they're placed in. Chances are,
because of the use of the look_at vector, after inverting the camera
vertically, it flipped right back up because of the sky vector when look_at
was applied. If you want "up" to be -y, use "sky -y".

>   What is the difference between the 'sky' and the 'up' vectors?

The up vector is a more precise part of the camera's definition, while the
sky vector is only used to determine the general direction of the up vector
when look_at is applied.

>   Do 'angle' and 'direction' work together, or are they mutually exclusive
> alternatives to do the same thing (by different way of measuring things)?
> That is, if I specify 'direction', does it simply override a previous
'angle'
> definition, or does it add something to it instead?


'angle' changes the length of 'direction' after the camera has been set up.
'direction' will always be applied first (and multiple settings of it
override previous settings, I believe), so it is impossible to override
'angle' with 'direction' - the opposite always happens.

>   What is the relation (if any) between 'direction' and 'look_at'?

The look_at keyword modifies the direction of the 'direction', 'up', and
'right' vectors after their initial values have been set. In the end, the
direction vector, based at the location vector, will point towards the
look_at vector, but will maintain its length.

>   Perhaps 'direction' is a way of defining both 'angle' and 'look_at' with
> one single vector?

direction is the original setting, angle and look_at modify it.

I hope this helps you. It took me a *lot* of time and experience to figure
this out, so I don't blame you for not knowing. Perhaps an entry in the VFAQ
would be a good idea?

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


Post a reply to this message

From: Philippe Debar
Subject: Re: Different camera parameters
Date: 23 Apr 2003 11:04:12
Message: <3ea6ab6c@news.povray.org>
Ok, I wrote this from memory, with no pov nor doc to check it. I write 
only about the perspective camera. Some things apply to other camera 
types, other do not. (Very helpful, isn't it ?)

Perspective camera uses perspective projection. To understand it, the 
easiest is to go back to a real-world explanation : to paint as the eye 
see, paint what you see through a pane  of glass on the pane itself. 
That is, from the eye, trace a ray to any point you wish to trace and 
then colour the glass at the intersection of the ray and the pane.

location is the eye, the point from which all rays pass. up, right and 
direction define the virtual glass pane through and onto which pov 
traces, and which is then mapped onto the +w,+h window.

up and right define a parallelogram, most usually a rectangle (other 
shapes distort the picture). It's centre is placed at direction. up is 
mapped to +h and right to +w.

Usually, up, right and direction are orthogonal. If up and right aren't, 
it skews the image. If direction isn't orthogonal with up and right, 
while up and right are orthogonal, the effect is as if you traced a 
rectangular part of a larger trace. (There is a standard include files 
that does just this, I suppose it must be in a Camera directory.)

Now, look_at rotates the camera (the up, right, direction trihedron) 
around the origin to align direction with look_at. The camera is first 
rotated around the sky axis then around an axis normal to both sky and 
the new direction.

angle is the angle from both end of right (when it is centred around 
direction) to location. Changing angle is akin to modifying direction's 
length.

location, right, up and direction define the camera. sky, look_at and 
angle are tools to manipulate these fundamental constituents.


Does this help?


Povingly,

Philippe


Post a reply to this message

From: Warp
Subject: Re: Different camera parameters
Date: 23 Apr 2003 15:34:30
Message: <3ea6eac6@news.povray.org>
Slime <slm### [at] slimelandcom> wrote:
> Chances are,
> because of the use of the look_at vector, after inverting the camera
> vertically, it flipped right back up because of the sky vector when look_at
> was applied.

  So using "up -y right -x*4/3 look_at whatever" is exactly identical to
"up y right x*4/3 look_at whatever"?

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Slime
Subject: Re: Different camera parameters
Date: 23 Apr 2003 15:37:23
Message: <3ea6eb73$1@news.povray.org>
>   So using "up -y right -x*4/3 look_at whatever" is exactly identical to
> "up y right x*4/3 look_at whatever"?

If my understanding is correct, then yes, those two settings will result in
an identical camera (although they will do so in different ways internally).
If you leave out the look_at statement, they will result in different
cameras.

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


Post a reply to this message

From: Philippe Debar
Subject: Re: Different camera parameters
Date: 25 Apr 2003 04:30:15
Message: <3ea8f217@news.povray.org>
Slime wrote:

>  - the look_at vector is applied in the following manner: the direction is
> changed to face towards the look_at vector, the right vector is changed to
> be perpendicular to [the plane created by the vectors (look_at-location) and
> (sky-location)], and the up vector is made to remain along that plane. This
> is the most intuitive behavior, which lets you specify where the camera is
> looking at. The sky vector is used at this point to determine how much the
> camera is "rolled" (so that it knows which direction is "up").

Gee, I had totally forgotten that look_at straigthens the up and right 
vectors.

Thanks!


Now I remember also to wonder : why ? I believe it is the only case 
where Pov tries to 'smartly' correct what the user specifies... and 
destroy my careful camera shearing. (BTW and IIRC, one need to disable 
vista buffers to use camera shearing.)


Povingly,


Philippe


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Different camera parameters
Date: 26 Apr 2003 03:50:49
Message: <3eaa3a59@news.povray.org>
In article <3ea8f217@news.povray.org> , Philippe Debar <phd### [at] wanadoobe>
wrote:

> Now I remember also to wonder : why ? I believe it is the only case
> where Pov tries to 'smartly' correct what the user specifies... and
> destroy my careful camera shearing. (BTW and IIRC, one need to disable
> vista buffers to use camera shearing.)

It is a necessity because "look_at" is just a simplified way to modify those
vectors.  And it is well documented in 3.5 as well...

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Philippe Debar
Subject: Re: Different camera parameters
Date: 26 Apr 2003 10:01:58
Message: <3eaa9156@news.povray.org>
Thorsten Froehlich wrote:
> It is a necessity because "look_at" is just a simplified way to modify those
> vectors.

Yes, but why ? To my non-programmer's ears, it does not sound more 
complicated to rotate the vectors instead of defining new ones. But I 
suppose that even a tad more complicated would imply a noticeable 
slowdown if the function is called for each ray. Right ?


> And it is well documented in 3.5 as well...

As I wrote earlier, I was posting from memory without access to pov nor 
the doc. Now I checked some, but I did not find any reference of look_at 
redefining perpendicular up and right. However, I found some references 
that could be corrected because they talk about a rotation of the 
camera, which is not what is happening - although I agree it is the 
easiest explanation, as few user would specify non-normal 
direction/right/up on purpose.

---
3.1.3
Also look_at <0,1,2> rotates the camera to point at the coordinates 
<0,1,2>.


6.4.1.1
The look_at vector tells POV-Ray to pan and tilt the camera until it is 
looking at the specified x, y, z coordinates.


6.4.1.2
Normally POV-Ray pans left or right by rotating about the y-axis until 
it lines up with the look_at point and then tilts straight up or down 
until the point is met exactly.
[...] Then it uses the sky vector as the axis of rotation left or right 
and then to tilt up or down in line with the sky until pointing at the 
look_at point.
[...]
The sky vector does nothing on its own. It only modifies the way the 
look_at vector turns the camera. The default value is sky<0,1,0>.


6.4.1.5
The primary purpose of the up and right vectors is to tell POV-Ray the 
relative height and width of the view screen.
[...]
In the default perspective camera, these two vectors also define the 
initial plane of the view screen before moving it with the look_at or 
rotate vectors.

----

BTW, is anybody up to patching pov for using vista buffers with 
non-perpendicular direction/right/up ? I guess it should not be too 
hard, but what do I know ?


Povingly,

Philippe


Post a reply to this message

From: Slime
Subject: Re: Different camera parameters
Date: 26 Apr 2003 15:56:25
Message: <3eaae469@news.povray.org>
> Gee, I had totally forgotten that look_at straigthens the up and right
> vectors.


Oh, wait. I hadn't thought about the case where the up and right vectors
weren't already perpendicular. *Does* it straighten them out in this case,
or does it align the right vector as I described, or does it align the up
vector as I described?

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


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Different camera parameters
Date: 26 Apr 2003 17:21:32
Message: <3eaaf85c@news.povray.org>
In article <3eaa9156@news.povray.org> , Philippe Debar <phd### [at] wanadoobe>
wrote:

> Yes, but why ? To my non-programmer's ears, it does not sound more
> complicated to rotate the vectors instead of defining new ones.

It is rather complicated, but without it there would be cases for which
there is more than one solution which way the camera could be pointing.
Further, the look_at vector is of no use when actually creating camera rays
because it does not contain enough information on its own together with the
location.  That is why up, right and sky have defaults.

The key about understanding, or even trying to understand how the various
camera parameters interact (and have to interact to work together at all in
certain cases), is to understand that many are redundant ways to specify the
same information:

All you need is the up, right and direction vectors to create every possible
perspective camera specification that uses a combination of up, right,
direction, look_at, angle, sky and location.  To make it even more
complicated, other camera types need to make use only of certain aspects of
these parameters (i.e. the vector length), or they need additional
parameters (like the spherical camera).

So don't worry - without seeing the source code in action step by step, I
would never have understood what exactly is happening and why.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Goto Latest 10 Messages Next 6 Messages >>>

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