POV-Ray : Newsgroups : povray.binaries.utilities : About Juha's solution for camera positionning(long I'm afraid) Server Time
1 Nov 2024 01:21:47 EDT (-0400)
  About Juha's solution for camera positionning(long I'm afraid) (Message 1 to 6 of 6)  
From: Jean Montambeault
Subject: About Juha's solution for camera positionning(long I'm afraid)
Date: 25 Aug 1999 10:07:53
Message: <37c3f8b9@news.povray.org>
Juha's said in povray.general :


<  What's wrong with this solution:

    At first sight it seems that I went overboard with my
trigonometry, doesn't it ? :( I was so glad to finally find a use for
the stuff after so many years since highschool.) :} In the process of
making my little macro I've had to re-learn sin(), cos(), radians and
the #macro function : so I was impressed with myself when it worked
(at last). And all this would be to avoid one simple, obvious solution
(or two) ? Dooohhhhhhh!

    Well, not exactly...

    First the "translate ObjectCenter" need to be relative, like this
:

       translate Position_relative_to_object_center + Object_Center

    But I'm sure that's what you meant anyway (I read your posts and
you're not stupid).
    I made a new camera positionning macro inspired by your solutions.
I changed the variable name from "Object_Center" to
"Point_of_Interest" to reflect what I was aiming for more accurately.
If you run side by side my kitchen table .pov example with this one
named after a famous Finnish's aka, you'll see that the first problem
comes when you translate the camera to the Point_of_Interest. I am
nearsighted but not that much ! :) Translating the camera to
Object_Center (or Point_of_Interest as I like to say) last is not
doing it.


    Now the real important stuff.


>>  camera
>>  { location -z*Distance
>>  look_at 0
>>  rotate CameraRotation
>>  translate ObjectCenter
>>  }

    That rotation with Camera_Rotation that you're suggesting... Okay,
let's try it : first you carefully set a Distance : fine until now.
Second you rotate along the azimuth, something like "rotate y*Azimuth"
(note that you won't be able to use one single vector as the rotation
would happen about the X axis first, then the Y axis... and you want
more control than that) : hey ! everything is fine, the distance about
the origin is the same and we're on the side of the object that we
want. Yeah ! But now, how do you go about getting some altitude
(positive or negative) ?
        1- Do you rotate about the X axis or the Z ? Both ? Can be
done but complicated.
        2- If your azimuth is small, say 2 degrees, you won't get very
high or low anyway.
        3- What if your azimuth angle is 200 degrees ? Then your
rotations about X or Z will have the inverse effect : where "rotate
z*PositiveAltitudeAngle" brought you up when Azimuth was between 0 and
180, it will lower your camera when 180 < Azimuth < 360.
        4- Finally, in any case, the distance that you set so
carefully will change in hard to anticipate ways.



>>  or:

>>  camera
>>  { location Position_relative_to_object_center
>>    look_at 0
>>    translate ObjectCenter
>>  }

    Defining Position_relative_to_object_center is not as
straighforward as I'd wish. One might try something like this
<X_position, Y_position, Z_position> + Object_Center but as I said
first, I find it counter-intuitive. I wanted to introduce the concepts
of azimuth, altitude and (absolute, fixed) distance. A vector doesn't
give any precise indication about the distance... well, I'm not that
much a genius at mental calculation anyway.

    Now look, you made me wear out my French-English dictionnary ; I
hope that I didn't make a fool of myself by not seing the obvious
again. POV requires the use of some knowledge long forgotten of me or
never acquired : be gentle.

    I liked the way you named your variables in your examples to make
them self explanatory : I'll adopt it.

        Sincerly yours,

            Jean Montambeault
            Montreal, Canada
            http://pages.infinit.net/copeau


Post a reply to this message


Attachments:
Download 'Juha_sKITCHEN_TABLE.pov.txt' (4 KB) Download 'JuhaCameraMacro.inc.txt' (2 KB)

From: Nieminen Juha
Subject: Re: About Juha's solution for camera positionning(long I'm afraid)
Date: 27 Aug 1999 07:44:27
Message: <37c67a1b@news.povray.org>
Jean Montambeault <jrm### [at] videotronca> wrote:
:>>  camera
:>>  { location -z*Distance
:>>  look_at 0
:>>  rotate CameraRotation
:>>  translate ObjectCenter
:>>  }

:     That rotation with Camera_Rotation that you're suggesting... Okay,
: let's try it : first you carefully set a Distance : fine until now.
: Second you rotate along the azimuth, something like "rotate y*Azimuth"
: (note that you won't be able to use one single vector as the rotation
: would happen about the X axis first, then the Y axis... and you want
: more control than that) : hey ! everything is fine, the distance about
: the origin is the same and we're on the side of the object that we
: want. Yeah ! But now, how do you go about getting some altitude
: (positive or negative) ?

  Easyly. You first rotate around the X axis to the the altitude and then
around the Y axis to get the direction where we are looking from. Like this:
  camera
  { location -z*Distance
    look_at 0
    rotate x*Latitude rotate y*Longitude
    translate ObjectCenter
  }


-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Jean Montambeault
Subject: Re: About Juha's solution for camera positionning(long I'm afraid)
Date: 27 Aug 1999 11:45:26
Message: <37c6b296@news.povray.org>

>Jean Montambeault <jrm### [at] videotronca> wrote:
>:>>  camera
>:>>  { location -z*Distance
>:>>  look_at 0
>:>>  rotate CameraRotation
>:>>  translate ObjectCenter
>:>>  }
>
>:     That rotation with Camera_Rotation that you're suggesting...
Okay,
>: let's try it : first you carefully set a Distance : fine until now.
>: Second you rotate along the azimuth, something like "rotate
y*Azimuth"
>: (note that you won't be able to use one single vector as the
rotation
>: would happen about the X axis first, then the Y axis... and you
want
>: more control than that) : hey ! everything is fine, the distance
about
>: the origin is the same and we're on the side of the object that we
>: want. Yeah ! But now, how do you go about getting some altitude
>: (positive or negative) ?
>
>  Easyly. You first rotate around the X axis to the the altitude and
then
>around the Y axis to get the direction where we are looking from.
Like this:
>  camera
>  { location -z*Distance
>    look_at 0
>    rotate x*Latitude rotate y*Longitude

        You're right for that. I should have seen it.

>    translate ObjectCenter

     Here, if you translate that way again, your camera will land in
the middle of your object, won't it ? If I use your method for
positionning the camera how do I extract the information about the
vector where it is sitting then ? I need to add it to ObjectCenter to
keep the same relative point of vue relative to the object. Is there a
function in POV that will return such a vector ? Of course, it can be
found by trigonometric calculation but then why bother rotating and
not position the camera by that mean right from the beginning ?

    If not...well, I've learned lately that one can make a union of
any object in a scene, even if they don't share any space. So I guess
that one could make a union of all there is in the scene, find the
coordinates of the point of interest, translate while reversing the
signs on the x, y and z values in it so it finds itself at the origin
point rotate the camera at will using your method and once finished
put it back in place... I find no major reason for not doing it that
way if it remains transparent always. Would it ?

    Thanks anyway for answering. I understand that for experienced
POVists this subject is not as sexy as NURBS, infinite loopings and 4D
sponging but it is to me. I like my solution because it is elegant ( 5
lines of script )and powerful like when making lighting or clipping
camera dependent. I guess that flybys would be easier if moving the
camera rather than a whole world but I'm not quite to that level yet.
It models reality which is always more user friendly.

        If you feel like getting an idea of what I'm aiming at you can
download those .AVI's at

    http://pages.infinit.net/copeau/clips01mini.AVI

    http://pages.infinit.net/copeau/Calyps01.AVI

        They are 300 kB and 400 kB or so.

        Thanks again.

            Jean




>
>
>--
>main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[
i]
>):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*-
Warp -*/


Post a reply to this message

From: Nieminen Juha
Subject: Re: About Juha's solution for camera positionning(long I'm afraid)
Date: 30 Aug 1999 10:36:20
Message: <37ca96e4@news.povray.org>
Jean Montambeault <jrm### [at] videotronca> wrote:
:>    translate ObjectCenter

:      Here, if you translate that way again, your camera will land in
: the middle of your object, won't it ?

  Nope. The camera will end at the camera location + ObjectCenter. The
look_at, which was at the origin, will end at the object center.

: If I use your method for
: positionning the camera how do I extract the information about the
: vector where it is sitting then ? I need to add it to ObjectCenter to
: keep the same relative point of vue relative to the object. Is there a
: function in POV that will return such a vector ?

  This will do exactly that.
  'translate <vector>' means 'add <vector> to the current location of the
object'. It doesn't mean 'put the object center at <vector>'. Povray
doesn't know what is the center of the object, anyways.

:     If not...well, I've learned lately that one can make a union of
: any object in a scene, even if they don't share any space. So I guess
: that one could make a union of all there is in the scene, find the
: coordinates of the point of interest, translate while reversing the
: signs on the x, y and z values in it so it finds itself at the origin
: point rotate the camera at will using your method and once finished
: put it back in place... I find no major reason for not doing it that
: way if it remains transparent always. Would it ?

  Well, if you _really_ want to do it the hard way... I think that it's
much easier to just translate the camera instead of the whole scene.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Jean Montambeault
Subject: Re: About Juha's solution for camera positionning(long I'm afraid)
Date: 30 Aug 1999 18:30:17
Message: <37cb05f9@news.povray.org>
>
>  Nope. The camera will end at the camera location + ObjectCenter.
The
>look_at, which was at the origin, will end at the object center.
>

    You're right. Strangely, I never had to translate the camera
without having to modify the look-at at the same time yet, except for
rotating it around an object and then the look_at stays the same,
opposite to translations as I discover. (BTW is there any simple way
to spin the camera on itself to look around ?)

>: If I use your method for
>: positionning the camera how do I extract the information about the
>: vector where it is sitting then ?

    The question remains interesting. Using rotations for setting up
the altitude and azimuth leaves me with no clue as how to get the
vector of the camera's location once that set up is done. Is there a
function in POV that achieves that ? I haven't explored thing like
vector functions yet. They still feel a little oesoteric. As I said, I
only know to calculate it through trigonometry : that's how my macro
works. Is there a simpler, more "POV" way to do it? That is an
important piece of information since it allows many tricks, like
attaching the lighting to the camera position or using that position
to set the normal of a clipping plane relative to the point of vue
(did you watch the little clips on my site ?). It's also possible to
move all sorts of objects relative to the point of vue, like other
fishes in a school or an ennemy vessel in a combat.

:     If not...well, I've learned lately that one can make a union of
>: any object in a scene, even if they don't share any space. So I
guess
>: that one could make a union of all there is in the scene, find the
>: coordinates of the point of interest, translate while reversing the
>: signs on the x, y and z values in it so it finds itself at the
origin
>: point rotate the camera at will using your method and once finished
>: put it back in place... I find no major reason for not doing it
that
>: way if it remains transparent always. Would it ?
>
>  Well, if you _really_ want to do it the hard way... I think that
it's
>much easier to just translate the camera instead of the whole scene.


    Mmm... as you know from my technique, I too favor moving the
camera... I was just wondering if... given that all motion is
relative, it made an absolute difference ; one thing is sure, there
would be many more lines of code to write to move the whole world
perfectly. I paid attention to it because that's the way many people
answered that they were doing it, although more on a piece by piece
basis, when they needed to work on a given object for example.

    Thanks Mika (how do you pronounce Juha anyway ? I only know Temu,
Mika, Yari, Yaku... hockey players... )

        Jean


Post a reply to this message

From: Nieminen Juha
Subject: Re: About Juha's solution for camera positionning(long I'm afraid)
Date: 3 Sep 1999 03:59:20
Message: <37cf7fd8@news.povray.org>
Sorry for the delay in my answers. I seldom read this newsgroup...

Jean Montambeault <jrm### [at] videotronca> wrote:
: (BTW is there any simple way to spin the camera on itself to look around ?)

  It depends on what else you want to do to it. The easiest way would be:

camera
{ location 0 look_at z
  rotate SpinAroundAngles
  translate CameraLocation
}

:>: If I use your method for
:>: positionning the camera how do I extract the information about the
:>: vector where it is sitting then ?

:     The question remains interesting. Using rotations for setting up
: the altitude and azimuth leaves me with no clue as how to get the
: vector of the camera's location once that set up is done. Is there a
: function in POV that achieves that ?

  You can use vrotate() to achieve this. For example:

#declare CameraLocation = -z*DistanceFromOrigin;
#declare CameraLocation = vrotate(CameraLocation, CameraRotation);
camera
{ location CameraLocation
  look_at 0
  translate CameraTranslation // or ObjectCenter or whatever
}
#declare CameraFinalLocation = CameraLocation+CameraTranslation;

  Now the vector CameraFinalLocation indicates the location of the camera in
space.

: I haven't explored thing like
: vector functions yet.

  You should. They are very handy.

:     Thanks Mika (how do you pronounce Juha anyway ? I only know Temu,
: Mika, Yari, Yaku... hockey players... )

  You mean Teemu, Jari and Saku?

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

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