POV-Ray : Newsgroups : povray.newusers : multiple renderings with #while ? : Re: multiple renderings with #while ? Server Time
28 Jul 2024 20:32:10 EDT (-0400)
  Re: multiple renderings with #while ?  
From: Chris B
Date: 10 Oct 2007 10:35:19
Message: <470ce327$1@news.povray.org>
"flatline" <bru### [at] itcit> wrote in message 
news:web.470cd6856532fcba948923d30@news.povray.org...
>I would like to generate  renderings of the same scene from multiple
> viewpoints (specifically moving the camera on a sphere while looking at 
> its
> center):
>
> is it possible to generate the renderings from within a #while loop
> and put them into different files?
>
> Thanks a lot!
>

Hi,

Not 'exactly' answering your question, but the easiest way to get a sequence 
of images is to use the animation feature, working out the camera position 
based on either the value of the 'clock' variable or the value of the 
'frame_number' variable. If you render with command-line options +kfi0 +kff9 
then frame_number should go from 0 to 9 and an image will automatically be 
produced for each frame.

The camera positions don't have to necessarily follow a smooth path, so you 
could define an array of camera rotations and use the frame_number variable 
to index them. Here's a quick example:

#declare CameraSphereRadius = 4;
#declare CameraSphereCentre = <42,42,42>;

#declare CameraRotation = array[10];
#declare CameraRotation [0] = <90,90,0>;
#declare CameraRotation [1] = <5,4,3>;
//... etc ...
#declare CameraRotation [9] = <42,42,42>;

#declare CameraPosition = 
vrotate(y*CameraSphereRadius,CameraRotation[frame_number] )+CameraSphereCentre;
camera {location CameraPosition  look_at CameraSphereCentre}

box {CameraSphereCentre,CameraSphereCentre+1 pigment {color rgb <1,0.5,0>}}
light_source {<0, 100,0> color rgb 1}

The CameraPosition value is found by rotating a point that starts off being 
'CameraSphereRadius' units straight up along the 'y' axis, using the 
rotations defined in the appropriate element of the array. The vector 
CameraSphereCentre is then added to the point to displace it so that it sits 
on the surface of the sphere centred at that point.

Hope that helps.

Regards,
Chris B.


Post a reply to this message

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