POV-Ray : Newsgroups : povray.animations : Object animated with camera following the movements Server Time: 19 Oct 2019 10:14:42 GMT
  Object animated with camera following the movements (Message 1 to 5 of 5)  
From: Giuela
Subject: Object animated with camera following the movements
Date: 25 Nov 2009 10:00:01
Message: <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.

To do an example, if I want do move the camera from:

x = 0
y = 0
z = 0

to

x = 10
y = 5
z = 12

pointing always the same point with a parabolic trajectory, which parameters
have I to give to my camera statement? How can I rotate the camera in the space?


Post a reply to this message

From: Stephen
Subject: Re: Object animated with camera following the movements
Date: 25 Nov 2009 12:45:16
Message: <4b0d26dc@news.povray.org>
Giuela wrote:
> 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.

You were on the right track with the sky statement.

Sky <(sin (radians(A)), (cos(radians(A)), 0>

Where A is the angle in degrees.


-- 

Best Regards,
	Stephen


Post a reply to this message

From: Warp
Subject: Re: Object animated with camera following the movements
Date: 25 Nov 2009 13:29:55
Message: <4b0d3153@news.povray.org>
Giuela <mau### [at] elsagdatamatcom> wrote:
> when I change the "location" and "look_at vectors", the perspective
> changes suddenly

  Changing the location and look_at vectors doesn't change the perspective
of the camera. You should be more precise about what is it that you want to
do and what is the undesired effect you are getting.

-- 
                                                          - Warp


Post a reply to this message

From: Captain Jack
Subject: Re: Object animated with camera following the movements
Date: 25 Nov 2009 14: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

From: Alain
Subject: Re: Object animated with camera following the movements
Date: 25 Nov 2009 16:24:05
Message: <4b0d5a25$1@news.povray.org>
Giuela a écrit :
> 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.

How many frames do you use? If there is not enough frames, it will look 
as if the camera changes sudently.
Do you want the camera to move behind or in parallel to the object? Or 
do you want a fixed camera that points at the moving object?

> 
> To do an example, if I want do move the camera from:
> 
> x = 0
> y = 0
> z = 0
> 
> to
> 
> x = 10
> y = 5
> z = 12

For that, you can use (sample using a straight path):
camera{location<10,5,12>/clock look_at Somewhere}
//Moves the camera leaving it always looking at the sme point.

camera{location Somewhere look_at <10,5,12>/clock}
//Static camera that follows a moving point.

camera{location<10,5,12>/clock look_at<10,5,12>/clock+<10,5,12>}
//This is a camera looking forward as it moves.

> 
> pointing always the same point with a parabolic trajectory, which parameters
> have I to give to my camera statement? How can I rotate the camera in the space?
> 
> 
Changing the sky vector tend to tilt the camera. I don't think that's 
what you want.

The best way, is to use the clock to change the location or the look_at 
point the same way as you move your object. You can add some offset 
value to place the camera some distance away from your moving object.
You change both if you want the camera to follow a path parallel to that 
of the target object.

Another way, is to never change the location and look_at, but to rotate 
and translate the camera. Make the translate the last statement of the 
camera definition.

Sample:
#declare Position = [here, you calculate the translate applied to your 
object]
// The value of "Position" is used to place the moving object.

camera{location Loc look_at Position}
// "Position" is also the look_at location.
// The object is defined at the origin.

You can take a look at the "splinefollow.pov" in the "animations" folder 
that comes with the distribution. It demonstrate a complexe case where 
you follows a spline where several objects are moving. It includes 
banking of the camera in the curves.




Alain


Post a reply to this message

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