POV-Ray : Newsgroups : povray.newusers : camera orbit with simultaneous image plane rotation Server Time
2 Jul 2024 21:31:25 EDT (-0400)
  camera orbit with simultaneous image plane rotation (Message 5 to 14 of 14)  
<<< Previous 4 Messages Goto Initial 10 Messages
From: bobsta
Subject: Re: camera orbit with simultaneous image plane rotation
Date: 18 Jan 2011 08:50:01
Message: <web.4d359962863e0b1cc6ac940d0@news.povray.org>
>
> In that case, you can use an array that will contain your various rotations.
>
> #declare Roll = array[16] {0,0,1,3,5,7,5,3,1,0,1,3,5,7,5,3}
>
> This create the array and initialize it in one operation.
> The element zero (first) can be used for single frame renderings, while
> the others will be used during an animation.

This sounds very promising. Since I am generating scripts to execute the
raytracing with povray I would then only need to determine whether the roll
angle is fixed or variable, based on user input.


> You ther access the elements like this:
>
> Roll[frame_numnber]

Could you please give me more detailed syntax, or a reference to the relevant
manual /wiki page, on how to implement this. Thanks.
>
> Outside an animation, this internal variable evaluate to 0 (zero), and
> to non-zero during an animation.
>
> This can be used as a rotation or the actual locations for your camera.
> It can also define the up, right, direction or sky vectors.
>
> Note that the array can contain vectors that can be used normaly:
> #declare Roll =  = array[15]
> {0,<0,20,-2>,<1,12,12>,3,<-5,5,5>,7,5,3,1,0,1,3,5,7,5,3}
> The singles floats will be promoted to full vector status: 7 becomes
> <7,7,7>.
>
>
> More advanced: You can use the spline feature. Please read the
> documentation about the implementation and use of the splines.
> This can be somewhat overkill for what you want to acomplish.
>
>
>
> Alain


Post a reply to this message

From: Stephen
Subject: Re: camera orbit with simultaneous image plane rotation
Date: 18 Jan 2011 09:11:45
Message: <4d359fa1$1@news.povray.org>
On 18/01/2011 1:45 PM, bobsta wrote:
> Could you please give me more detailed syntax, or a reference to the relevant
> manual /wiki page, on how to implement this. Thanks.

 From the help

3.3.1.1.2 The Sky Vector

frame_numnber:

3.2.1.3.6 Built-in Variables

Using frame_numnber requires you to do a bit of arithmetic to get a 
meaningful number,
For instance: 1 - (final_frame - frame_numnber)/final_frame


-- 
Regards
     Stephen


Post a reply to this message

From: Stephen
Subject: Re: camera orbit with simultaneous image plane rotation
Date: 18 Jan 2011 09:38:10
Message: <4d35a5d2$1@news.povray.org>
P.S.
debug -- 3.2.2.7.1 Text Message Streams
concat(S1,S2,...), str(A,L,P) -- 3.2.1.7 Strings
Are useful for checking that you have got your maths right.


-- 
Regards
     Stephen


Post a reply to this message

From: Alain
Subject: Re: camera orbit with simultaneous image plane rotation
Date: 18 Jan 2011 22:37:20
Message: <4d365c70$1@news.povray.org>

>
>>
>> In that case, you can use an array that will contain your various rotations.
>>
>> #declare Roll = array[16] {0,0,1,3,5,7,5,3,1,0,1,3,5,7,5,3}
>>
>> This create the array and initialize it in one operation.
>> The element zero (first) can be used for single frame renderings, while
>> the others will be used during an animation.
>
> This sounds very promising. Since I am generating scripts to execute the
> raytracing with povray I would then only need to determine whether the roll
> angle is fixed or variable, based on user input.
>
>
>> You ther access the elements like this:
>>
>> Roll[frame_numnber]
>
> Could you please give me more detailed syntax, or a reference to the relevant
> manual /wiki page, on how to implement this. Thanks.

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


Post a reply to this message

From: Alain
Subject: Re: camera orbit with simultaneous image plane rotation
Date: 18 Jan 2011 22:44:33
Message: <4d365e21$1@news.povray.org>

> On 18/01/2011 1:45 PM, bobsta wrote:
>> Could you please give me more detailed syntax, or a reference to the
>> relevant
>> manual /wiki page, on how to implement this. Thanks.
>
>  From the help
>
> 3.3.1.1.2 The Sky Vector
Changing that vector is one way to tilt the camera in some way. It's a 
3D vector that defaults to <0,1,0>.

>
> frame_numnber:
>
> 3.2.1.3.6 Built-in Variables
>
> Using frame_numnber requires you to do a bit of arithmetic to get a
> meaningful number,
> For instance: 1 - (final_frame - frame_numnber)/final_frame
>
>

It depends on what you want to acheive.

If you need an integer value that depends ONLY on the actual 
frame_number and is independent on the clock value, there is NO 
arithmetics to perform. It also assume that your animation is made to 
use only a fixed number of frames.

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




Alain


Post a reply to this message

From: bobsta
Subject: Re: camera orbit with simultaneous image plane rotation
Date: 19 Jan 2011 04:10:00
Message: <web.4d36aa5b863e0b1cc6ac940d0@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


Post a reply to this message

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 4 Messages Goto Initial 10 Messages

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