POV-Ray : Newsgroups : povray.newusers : camera orbit with simultaneous image plane rotation Server Time
22 Dec 2024 21:32:12 EST (-0500)
  camera orbit with simultaneous image plane rotation (Message 1 to 10 of 14)  
Goto Latest 10 Messages Next 4 Messages >>>
From: bobsta
Subject: camera orbit with simultaneous image plane rotation
Date: 14 Jan 2011 02:45:00
Message: <web.4d2ffe3cb3460c10c6ac940d0@news.povray.org>
Hi,

I am using povray to generate projections of anatomical structures derived from
a DICOM RT Structure Set. In essence I need to simulate a camera orbit about
each structure - in fact I rotate the structure using the clock parameter and
keep the camera fixed. These projections are the precursor to defining radiation
fields in radiotherapy and the camera represents a linear accelerator used for
the treatment.

I now need to make my simulation more general by allowing for camera roll, i.e.
rotation of the image plane (anti)clockwise about look at vector see
http://wiki.povray.org/content/Documentation:Reference_Section_3#Placing_the_Camera


povray -D mlc[Synergy]+Q0 +KFF90 +I/home/twostepgen/PTV0_0.pov i.e. 90
projections in orbit mlc[Synergy] defines image plane dimensions

PTV0_0.pov
#include "/home/twostepgen/PTV0.inc" - a mesh2 object
camera {
   perspective
   location <0 100 0>
   up <0,0,-1>
   right <-1.33,0,0>
   angle 11.9882
   look_at <0 0 0>
rotate -z*(178+(clock*-356))
}
 light_source { <0,10,0> color rgb 1 }

object{PTV0 translate <0.775167,-18.0811,7.82013e-05>}

translate is used to ensure that the "looked at" point is located at coordinates
0 0 0

In particular there are some instances where I need a constant roll angle for
all projections along the entire orbit. In other instances I need to adjust the
roll angle from one clock "tick" to the next. What is the most
efficient/simplest way of doing this?

Many thanks

Mark


Post a reply to this message

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

> Hi,
>
> I am using povray to generate projections of anatomical structures derived from
> a DICOM RT Structure Set. In essence I need to simulate a camera orbit about
> each structure - in fact I rotate the structure using the clock parameter and
> keep the camera fixed. These projections are the precursor to defining radiation
> fields in radiotherapy and the camera represents a linear accelerator used for
> the treatment.
>
> I now need to make my simulation more general by allowing for camera roll, i.e.
> rotation of the image plane (anti)clockwise about look at vector see
> http://wiki.povray.org/content/Documentation:Reference_Section_3#Placing_the_Camera
>
>
> povray -D mlc[Synergy]+Q0 +KFF90 +I/home/twostepgen/PTV0_0.pov i.e. 90
> projections in orbit mlc[Synergy] defines image plane dimensions
>
> PTV0_0.pov
> #include "/home/twostepgen/PTV0.inc" - a mesh2 object
> camera {
>     perspective
>     location<0 100 0>
>     up<0,0,-1>
>     right<-1.33,0,0>
>     angle 11.9882
>     look_at<0 0 0>
> rotate -z*(178+(clock*-356))
> }
>   light_source {<0,10,0>  color rgb 1 }
>
> object{PTV0 translate<0.775167,-18.0811,7.82013e-05>}
>
> translate is used to ensure that the "looked at" point is located at coordinates
> 0 0 0
>
> In particular there are some instances where I need a constant roll angle for
> all projections along the entire orbit. In other instances I need to adjust the
> roll angle from one clock "tick" to the next. What is the most
> efficient/simplest way of doing this?
>
> Many thanks
>
> Mark
>
>

You can change your rotation as:

rotate <0, 90*clock, -178+(clock*360)>
and use +kc to set the clock to cyclical animation.

This will first rotate the camera around the Y axis, then rotate it 
around the Z axis.
The result is a camera that smoothly rotate around the 2 axis during the 
animation.

You can use something like:

int(30*clock)*12

To rotate in 12 degrees increments, doing a complete rotation in 30 steps.






Alain


Post a reply to this message

From: bobsta
Subject: Re: camera orbit with simultaneous image plane rotation
Date: 17 Jan 2011 05:40:00
Message: <web.4d341344863e0b1cc6ac940d0@news.povray.org>
> You can change your rotation as:
>
> rotate <0, 90*clock, -178+(clock*360)>
> and use +kc to set the clock to cyclical animation.

Ok, it seems that I did not clearly define my problem. I have to simulate two
general situations; firstly where the camera is at a fixed roll angle, say 15
degrees for all positions along the orbit: rotate <0,15,(-178+clock*360)> ??


Secondly the more general case I need to adjust the roll angle between clock
ticks by a variable amount, e.g. a typical sequence of roll angles for 15 clock
ticks would be 0,1,3,5,7,5,3,1,0,1,3,5,7,5,3. Thus I would probably need to
provide a file or parameter list containing the roll angles that are (somehow?)
substituted into the .inc file at runtime. Alternatively I would need to avoid
the full orbit (rotate keyword) and write 15 discrete projections which simulate
the desired roll angles

Mark

>
> This will first rotate the camera around the Y axis, then rotate it
> around the Z axis.
> The result is a camera that smoothly rotate around the 2 axis during the
> animation.
>
> You can use something like:
>
> int(30*clock)*12
>
> To rotate in 12 degrees increments, doing a complete rotation in 30 steps.
>
>
>
>
>
>
> Alain


Post a reply to this message

From: Alain
Subject: Re: camera orbit with simultaneous image plane rotation
Date: 17 Jan 2011 13:59:08
Message: <4d34917c$1@news.povray.org>

>> You can change your rotation as:
>>
>> rotate<0, 90*clock, -178+(clock*360)>
>> and use +kc to set the clock to cyclical animation.
>
> Ok, it seems that I did not clearly define my problem. I have to simulate two
> general situations; firstly where the camera is at a fixed roll angle, say 15
> degrees for all positions along the orbit: rotate<0,15,(-178+clock*360)>  ??
>
>
> Secondly the more general case I need to adjust the roll angle between clock
> ticks by a variable amount, e.g. a typical sequence of roll angles for 15 clock
> ticks would be 0,1,3,5,7,5,3,1,0,1,3,5,7,5,3. Thus I would probably need to
> provide a file or parameter list containing the roll angles that are (somehow?)
> substituted into the .inc file at runtime. Alternatively I would need to avoid
> the full orbit (rotate keyword) and write 15 discrete projections which simulate
> the desired roll angles
>
> Mark
>

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.

You ther access the elements like this:

Roll[frame_numnber]

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

Goto Latest 10 Messages Next 4 Messages >>>

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