POV-Ray : Newsgroups : povray.newusers : camera orbit with simultaneous image plane rotation Server Time
3 Jul 2024 02:58:42 EDT (-0400)
  camera orbit with simultaneous image plane rotation (Message 11 to 14 of 14)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Stephen
Subject: Re: camera orbit with simultaneous image plane rotation
Date: 19 Jan 2011 04:48:03
Message: <4d36b353$1@news.povray.org>
On 19/01/2011 3:44 AM, Alain wrote:
>
> It depends on what you want to acheive.
>

True
>
> Your suggestion is only needed if, for some reason, you want to
> substitute frame_number for places suited for the clock variable.

True

-- 
Regards
     Stephen


Post a reply to this message

From: Alain
Subject: Re: camera orbit with simultaneous image plane rotation
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

From: bobsta
Subject: Re: camera orbit with simultaneous image plane rotation
Date: 25 Jan 2011 08:05:00
Message: <web.4d3eca4e863e0b1cc6ac940d0@news.povray.org>
>
> 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.
>

okay

> 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.
>

I have one further problem: Suppose I have an array of 4 values for the camera
roll, which I wish to use sequentially for 15 frames e.g.

cameraRoll = array[3]{1,3,5,7}

i.e. 1 degree is used for 1st,5th,9th,13th frame
     3 degrees is used for 2nd,6th,10th and 14th frame
     5 degrees is used for 3rd,7th,11th and 15th frame
     7 degrees is used for 4th,8th,12th frame

I need to use the float mod function
http://www.povray.org/documentation/view/3.6.1/228/ but am unsure of the correct
syntax in the .pov file i.e. something like the following



 rotation<0,cameraRoll[mod(float[frame_number],float[array_size])],-(178+(clock*-356))>


Thanks

Mark


>
>
> Alain


Post a reply to this message

From: Alain
Subject: Re: camera orbit with simultaneous image plane rotation
Date: 25 Jan 2011 12:57:56
Message: <4d3f0f24@news.povray.org>


>
>  
rotation<0,cameraRoll[mod(float[frame_number],float[array_size])],-(178+(clock*-356))>
>
>

This should be writen as:

rotate<0, cameraRoll[mod(frame_number-1, array_size), -(178+ clock*-356)>
Without the "-1", the first frame would use cameraRoll[1] not cameraRoll[0].

This returns the following values for an array_size value of 4:
0, 1, 2 and 3.

So, as long that you place the desired values into those array elements, 
you get the expected results.




Alain


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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