POV-Ray : Newsgroups : povray.newusers : camera orbit with simultaneous image plane rotation : Re: camera orbit with simultaneous image plane rotation Server Time
5 Jul 2024 03:18:09 EDT (-0400)
  Re: camera orbit with simultaneous image plane rotation  
From: Alain
Date: 19 Jan 2011 17:31:10
Message: <4d37662e$1@news.povray.org>

> Ok. I naively thought (hoped!) the following would work, but apparently not:
>
>
> #include "/home/twostepgen/PTV0.inc"
>
> // here is the array of camera roll angles - angles are exaggerated for effect
>
> #declare cameraRoll= array[15]
> {10,20,30,40,50,60,70,80,90,100,110,120,130,140,150}
> camera {
>     perspective
>     location<0 100 0>
>     up<0,0,-1>
>     right<-1.33,0,0>
>     angle 11.9882
>     look_at<0 0 0>
>
> // attempt to insert the cameraRoll angle into the rotation orbit
> rotate<0,cameraRoll[clock],-(178+(clock*-356))>
> }
>   light_source {<0,10,0>  color rgb 1 }
>
> object{PTV0 translate<0.775167,-18.0811,7.82013e-05>}
>
> However this naive approach does not work. All rotation angles appear to be at
> 10 degrees i.e. cameraRoll[1]. It seems that I cannot use the rotate in this
> way.
>>
>> Some samples:
>> #declare Value = Array[Some_Integer];
>>
>> camera{location Array[Some_Integer1]
>>    look_at Another_Array[Some_Integer2]
>>    rotate Array_Of_3D_Vectors[Some_integer3]
>>    angle A_Fourth_Array[Some_Integer4]
>> } // extreeme example where most of the camera's parameters are
>>    // defined using arrays.
>>
>> For the windows version documentation:
>>
>> 3.2.1.8 Array Identifiers
>>
>> General online documentation:
>>
>> http://www.povray.org/documentation/view/3.6.1/233/
>>
>>
>>
>> Alain
>
>
>
>

You always use cameraRoll[0] except for the very last frame that will 
use cameraRoll[1].

The clock variable, by default, goes from zero to 1.
When accessing the array, only the integer part is used, always 
returning zero and using only the first array element unless clock is 1 
or more.

If you substitute frame_number as follow:

rotate <0,cameraRoll[frame_number*(frame_number<16)],-(178+(clock*-356))>

You now sellect a different array element for each frame. The 
"*(frame_number<16) is there to ensure you never try to access array 
elements that don't exist.


Another way to do about the same thing:
rotate <0,cameraRoll[int(clock*15)],-(178+(clock*-356))>

Here, you multiply the clock variable by the number of elements in the 
array to get the correct indices. The int(...) is not realy needed but 
is added for clarity.

Advantage: you can use different number of frames. If you only render 5 
frames, you'll use every third element. If you render as a 120 frames 
animation, each elements will get used 8 times while you continously 
rotate around the z axis.



Alain


Post a reply to this message

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