POV-Ray : Newsgroups : povray.animations : Object animated with camera following the movements : Re: Object animated with camera following the movements Server Time
25 Apr 2024 16:07:35 EDT (-0400)
  Re: Object animated with camera following the movements  
From: Captain Jack
Date: 25 Nov 2009 09:54:32
Message: <4b0d4528@news.povray.org>
"Giuela" <mau### [at] elsagdatamatcom> wrote in message 
news:web.4b0cff4fa6e1ad0d27eef15b0@news.povray.org...
>I want to do an animation of an object which moves in the space with non 
>linear
> trajectory and I want the camera to follow the movements, but I can't do 
> this,
> because when I change the "location" and "look_at vectors", the 
> perspective
> changes suddenly; i've tried to use the "sky" statement, but I don't 
> exactly
> know how it works and if it helps me.

I don't know if this wil help, but I had some luck doing a "fly-through" 
kind of animation by first defining a spline for the camera path, then 
setting the location property of the camera equal to Spline(0.95*clock) and 
the look_at property equal to Spline(0.95*clock+0.05) or some such (the math 
keeps the location and look_at points from coinciding during the animation). 
That way, the camera was always looking at a point along it's path a few 
frames into the future. It doesn't let you do banks or barrel rolls, but it 
might be useful. In my case, the path was roughly parallel to the ground, 
with only gentle changes along the Y axis, so I didn't need to adjust the 
"up" property at all for the look I wanted. The camera did turn a little bit 
at the corners, which gave a pretty good effect. Overall it was a little 
like mounting a camera on the front of a roller coaster and looking ahead of 
the turns.

I think you could compare the angle between a vector pointing back in time 
[say, Spline(0.90*clock)] from the current clock position to a vector 
pointing ahead in time (at the look_at position), and bank the camera in 
that direction to give a more "airplane" type of feel to the turns. I'd have 
to experiment to see what has the right look, but I think if you just 
rotated the camera along the axis of the vector pointing backward by the 
amount by which the angle of the two vectors varies from 180 degrees, it'd 
look pretty good.

Here's an example (using pretty much random spline points):

--------------------------------------------------
// -w720 -h405 +a0.01 +am1 -j +fn -ua +kff96
// 24 fps animation
#declare FlyThrough =
    spline {
        cubic_spline
        -0.250, < 1.000, 1.000, 2.000>,
         0.000, < 2.000, 1.125, 3.000>,
         0.250, <-1.000, 1.000, 2.000>,
         0.500, <-2.000, 0.900, 1.000>,
         0.750, < 0.000, 1.000, 1.500>,
         1.000, < 0.500, 1.100, 1.750>,
         1.250, < 1.000, 1.000, 2.000>
         }

camera {
    location    FlyThrough(0.95*clock)
    look_at     FlyThrough(0.95*clock+0.05)
    right       image_width/image_height*x
    }

light_source { 360*<1,1,-1> rgb 2 }

sky_sphere { pigment { gradient x color_map { [ 0 rgb 0 ] [ 1 rgb 1 ] } } }

plane { y, 0 pigment { checker color red 1 color blue 1 } }

--------------------------------------------------

--
Jack


Post a reply to this message

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