POV-Ray : Newsgroups : povray.advanced-users : Camera positioning : Re: Camera positioning Server Time
28 Jul 2024 14:33:25 EDT (-0400)
  Re: Camera positioning  
From: kjm424
Date: 29 Dec 2004 09:05:01
Message: <web.41d2b921e563b829bce1a9020@news.povray.org>
Derek Chen-Becker <pov### [at] chen-beckerorg> wrote:
> There may be a simpler way to do this, but basically here's what you
> have to do:
>
> 1. Recalculate your scene bounds in camera space. Camera space is
> defined by the matrix
>
> | < right vector>     |   |                           |
> | < up vector>        | * | camera translation matrix |
> | < direction vector> |   |                           |
>
> To convert from scene space to camera space, take the inverse of that
> matrix and multiply each corner of your original bounds by that. Note
> that the result of these calculations will make the camera move along
> its "direction" vector, so you want to choose a translation matrix that
> makes the direction vector intersect the center point of your scene
> (unless you desire an offset. Then you can recalculate your bounds by
> taking the new max and min of these points in the "camera" x, y and z
> directions.
>
> 2. Now that you have the new bounds it's simple trig to determine how
> far away the scene box needs to be from the camera to fit inside the
> view frustum. From this you can calculate a vector from the camera
> location (<0,0,0> in camera space) to center of the original scene box.
>
> 3. Perform the inverse of the camera space transformation on the vector
> and add this vector to the center of your viewspace. This gives you the
> correct camera location.
>
> This may be easier to digest in a diagram. I'm sure there's something on
> the Internet, or I could put something together if you want. Also, POV
> may have some built in functions that handle the transformations/bounds
> for you.
>
> Derek

Thanks Derek.

I think a diagram would be useful as I am not very familiar with matrices.
I'm finding it quite difficult to get my head round different coordinate
systems.

I don't really understand how to get the 'camera translation matrix' when
the distance from the scene to the camera position is an unknown.

Thanks for your help,
Kevin.


Post a reply to this message

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