POV-Ray : Newsgroups : povray.newusers : Smooth swinging camera work : Re: Smooth swinging camera work Server Time
20 Apr 2024 06:55:56 EDT (-0400)
  Re: Smooth swinging camera work  
From: Le Forgeron
Date: 7 Apr 2016 15:30:23
Message: <5706b54f@news.povray.org>
Le 07/04/2016 20:34, SecondCup a écrit :
> Hi All,
> 
> My first posting so if I am short on etiquette please let me know! A little
> context: learning to code for maybe one year. I've been learning POV-RAY for
> about a month.
> 
> I'm trying to create a video animation where the camera zooms in and pans around
> an object at the center of the screen. I can create the two commands easily but
> individually. I can zoom in and I can pan around the object. The problem is the
> the smooth transition between both actions. Id like to create a small, smooth
> arc to connect both. Right now I zoom in...stop abruptly...and then pan. Its a
> little jolty (if thats even a word).
> 
> Can anyone point me to a good link to help me out? Or is there a sure-fire way
> to connect the two camera shots?
> 

Greetings and welcome,

My first question would be how do you pan ? (is the object a fixed point ?)

And how do you zoom ?

Let's assume that you pan by moving the camera (changing the location value of the
camera,
while keeping the look_at at the object, and a constant angle for the camera),
and that you zoom by keeping the camera at the same location while adjusting the
angle.

The key to your request is overlapping a bit each part.

There is many ways to do it.

If your scene/camera setting was (or could be) something along:

#if (clock < ZoomTime )
 panning code
#else
 zooming code
#end

You could transform it into:

#if (clock < FirstTime )
 panning code
#else
#if (clock < SecondTime )
 end panning and start zooming code
#else
 end zooming code
#end
#end

With FirstTime < ZoomTime < SecondTime

The difficulties are in all in the "end panning and start zooming code", to be aligned
with both other parts.
And for the smoother effect, the first derivative of each movement (panning and
zooming) should be contiguous. That's the hard part.
(actually, the second derivative might also have to be continuous)

*OR* you can just dive into spline for the location and angle.

> http://wiki.povray.org/content/Reference:Spline

First, you declare the spline, then you will use it indexed with the clock.
A natural_spline is probably the simpler to use for you.

#declare CameraSpline=spline{ natural_spline
 0, <start_xposition, start_yposition, start_zposition, start_angle>,
 // add intermediate points as needed for your panning, especially if you are rotating
around a point
 //
 // transitition:
 FirstTime, < intermediate_xposition, intermediate_yposition, intermediate_zposition,
start_angle>,
 SecondTime, < end_xposition, end_yposition, end_zposition, intermediate_angle >,
 EndOfTime, < end_xposition, end_yposition, end_zposition, end_angle >,
}

camera
{ location < CameraSpline(clock).x, CameraSpline(clock).y, CameraSpline(clock).z >
//... and whatever you want too, such as right, up, direction, look_at...
//
// and angle to control zoom
angle CameraSpline(clock).f
}

// then scene as usual




> I have a feeling I may have to go over some trigonometry notes but so be it :)
> 
> 
>


Post a reply to this message

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