POV-Ray : Newsgroups : povray.advanced-users : (anims) how to evaluate position of camera at a point in time? Server Time
30 Jul 2024 02:13:45 EDT (-0400)
  (anims) how to evaluate position of camera at a point in time? (Message 1 to 4 of 4)  
From: CreeD
Subject: (anims) how to evaluate position of camera at a point in time?
Date: 12 Jul 2000 19:05:30
Message: <01bfec56$70b4c160$a213a1d0@mk>
1. I know how to get a circular camera path in an animation, and a partial
circle.  What's the math to make the camera move in a smooth arc from one
point to another? Is there a way to declare it so that I can define the
flatness of the arc and its length and direction by changing a few figures?

2. Is there a way in a multistage animation for me to figure out where the
camera is exactly at some point during the clock's rundown and then have
POV fill that in to
a second statement?  Let me be clearer.
I want something like this: 
The ini has the clock running from 0 to 2

#if (clock >=1)
camera 
location blah 
direction <0,0,1>
translate blah*clock

#else //pov figures out stage 2 has begun
camera (POV evaluates  camera's exact position after the clock hits 1.0)
location (POV fills that position in here)

Obviously I could do the math by hand, but I'm not going to do an animation
with just one or two stages, and I was wondering if POV could determine the
camera's location on a circular path at some odd point like clock = 1.35
(which is math I'm too lazy to do by hand).


Post a reply to this message

From: Chris Colefax
Subject: Re: (anims) how to evaluate position of camera at a point in time?
Date: 12 Jul 2000 20:11:35
Message: <396d0937@news.povray.org>
CreeD <mes### [at] nqinet> wrote:
> 1. I know how to get a circular camera path in an animation, and a partial
> circle.  What's the math to make the camera move in a smooth arc from one
> point to another? Is there a way to declare it so that I can define the
> flatness of the arc and its length and direction by changing a few
figures?
>
> 2. Is there a way in a multistage animation for me to figure out where the
> camera is exactly at some point during the clock's rundown and then have
> POV fill that in to
> a second statement?  Let me be clearer.
> I want something like this:
> The ini has the clock running from 0 to 2
>
> #if (clock >=1)
> camera
> location blah
> direction <0,0,1>
> translate blah*clock
>
> #else file://pov figures out stage 2 has begun
> camera (POV evaluates  camera's exact position after the clock hits 1.0)
> location (POV fills that position in here)
>
> Obviously I could do the math by hand, but I'm not going to do an
animation
> with just one or two stages, and I was wondering if POV could determine
the
> camera's location on a circular path at some odd point like clock = 1.35
> (which is math I'm too lazy to do by hand).

There are infinite circular arcs that pass through any two points in space,
so you do need some way of deciding exactly which path to take (e.g. a third
point, a direction, a radius, etc).  With a little algebra you could write a
macro that takes a list of points and calculates the necessary translations
and rotations to move through the points in a series of smooth circular
arcs.  A more flexible option might be to use splines - and here's one I
prepared earlier!:

   http://www.geocities.com/ccolefax/spline

The animation features of the macro file allow you to animate the camera or
any other POV-Ray construct automatically, but gives you plenty of options
to fine-tune the result.

For mutli-stage animations you can either write out to a file the current
calculated position each frame (and read it in for the next frame), use
persistent variables in MegaPOV, or simply use the calculations you've
listed in an accumulative manner, e.g.:

   #switch (clock)
   #range (0, 1)
      camera {location [start] + clock*[movement1]
          look_at [start] + clock*[movement1]}
      #break
   #range (1, 2)
      camera {location [start]+[movement] + (clock-1)*[movement2]
         look_at [start]+[movement] + (clock-1)*[movement2]}
   #end

and so on - but as you can see, this is likely to get more and more
complicated.  You may wish to look at my Automatic Clock Modifier macros
which take all the maths out of these sorts of functions, e.g.:

   #include "autoclck.mcr"
   camera {
      location From (0, [start]) To (1, [position1]) To (2, [position2])
      look_at From (0, [start]) To_Using (2, [position2], "Accelerating")
      }

You can download the file from my main page:

   http://www.geocities.com/ccolefax


Post a reply to this message

From: ryan constantine
Subject: Re: (anims) how to evaluate position of camera at a point in time?
Date: 12 Jul 2000 20:13:13
Message: <396D08BC.43C7ACD1@yahoo.com>
CreeD wrote:
> 
> 1. I know how to get a circular camera path in an animation, and a partial
> circle.  What's the math to make the camera move in a smooth arc from one
> point to another? Is there a way to declare it so that I can define the
> flatness of the arc and its length and direction by changing a few figures?



there is spline animation to get objects and cameras alike to move in
smooth curves.  there is a macro by chris colefax made just for this
purpose.

 
> 2. Is there a way in a multistage animation for me to figure out where the
> camera is exactly at some point during the clock's rundown and then have
> POV fill that in to
> a second statement?  Let me be clearer.
> I want something like this:
> The ini has the clock running from 0 to 2
> 
> #if (clock >=1)
> camera
> location blah
> direction <0,0,1>
> translate blah*clock
> 
> #else //pov figures out stage 2 has begun
> camera (POV evaluates  camera's exact position after the clock hits 1.0)
> location (POV fills that position in here)
> 
> Obviously I could do the math by hand, but I'm not going to do an animation
> with just one or two stages, and I was wondering if POV could determine the
> camera's location on a circular path at some odd point like clock = 1.35
> (which is math I'm too lazy to do by hand).

 i think you meant <= 1 in that first part.  what i would do is just use
two cameras.  but you could also define a variable, CamPosition, and
then update that with clock (instead of changing the camera itself) and
put this variable in the camera's location.  then, you'd already have
the info you need for the second part in that same variable.


Post a reply to this message

From: CreeD
Subject: Re: (anims) how to evaluate position of camera at a point in time?
Date: 13 Jul 2000 11:25:10
Message: <01bfecdf$46643e20$1a1ba1d0@mk>
Thanks to both who replied. I'mma try that macro out.


Post a reply to this message

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