POV-Ray : Newsgroups : povray.advanced-users : (anims) how to evaluate position of camera at a point in time? : Re: (anims) how to evaluate position of camera at a point in time? Server Time
30 Jul 2024 00:26:21 EDT (-0400)
  Re: (anims) how to evaluate position of camera at a point in time?  
From: Chris Colefax
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

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