POV-Ray : Newsgroups : povray.newusers : multiple renderings with #while ? Server Time
24 Nov 2024 17:28:44 EST (-0500)
  multiple renderings with #while ? (Message 1 to 9 of 9)  
From: flatline
Subject: multiple renderings with #while ?
Date: 10 Oct 2007 09:45:00
Message: <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!


Post a reply to this message

From: Chris B
Subject: Re: multiple renderings with #while ?
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

From: Alain
Subject: Re: multiple renderings with #while ?
Date: 10 Oct 2007 10:55:23
Message: <470ce7db$1@news.povray.org>
flatline nous apporta ses lumieres en ce 2007/10/10 09:41:
> 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?
No! While loops are usefull for placing many objects and many other things, but 
are of no use for that purpose.
> 
> Thanks a lot!
> 
> 
> 
> 
> 
What you can do is to use the animation feature to do just that.
Add +kffn to the command line. (replace the "n" by the number of frames you want)
Place the camera for the first image.
If you want the camera to make a circle around the scene add rotate 360*y*clock, 
to make an horzontal circle, at the end of the camera deffinition.
To make 3 rotations:
camera{location -10*z
	#if(clock< 1/3)rotate 360*3*clock*y // circle on x-z plane
	#else #if(clock< 2/3)rotate 360*3*clock*x // circle on y-z plane
	#else rotate 90*x rotate 360*3*clock*z // circle on x-y plane
	#end //second #if
	#end //first #if
}
This allow you to get any arbitrary number of views.

You can also use frame_number and switch(frame_number) and case to place the 
camera to specific points:
camera{location -10*z look_at 0
#switch(frame_number)
	#case(1)#break //no movement
	#case(2) rotate 90*y #break //look from left
	#case(3) rotate -90*y #break //look from right
	#case(4) rotate 180*y #break //look from beheind
	#case(5) rotate 90*x #break //look from top
	#case(6) rotate -90*x //look from bottom
//last element so #break is not needed
#end
}
And set +kff6
This solution is only viable for a limited number of view points.

-- 
Alain
-------------------------------------------------
I feel like I'm diagonally parked in a parallel universe.


Post a reply to this message

From: Stephen
Subject: Re: multiple renderings with #while ?
Date: 10 Oct 2007 11:05:00
Message: <web.470ce99842ec0562726bd13c0@news.povray.org>
"flatline" <bru### [at] itcit> wrote:
> 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!

Megapov can use multiple camera views in one image. Or you could use the
animation features and move your camera each frame.

Stephen


Post a reply to this message

From: flatline
Subject: Re: multiple renderings with #while ?
Date: 10 Oct 2007 11:15:00
Message: <web.470ceb7042ec0562948923d30@news.povray.org>
"Stephen" <mcavoys_AT_aolDOT.com> wrote:
> "flatline" <bru### [at] itcit> wrote:
> > 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!
>
> Megapov can use multiple camera views in one image. Or you could use the

How can I specify 'multiple camera views' in Megapov?

> animation features and move your camera each frame.
>
> Stephen

Thanks,


Post a reply to this message

From: Simon
Subject: Re: multiple renderings with #while ?
Date: 10 Oct 2007 13:53:52
Message: <470d11b0$1@news.povray.org>
just my easy method for doing a rovolving camera:


//this will do 1 "circuit" for the length of the animation:

#declare DIST = 10; //Radius of loop for camera in POV units
camera {
    location <DIST*sin(clock*2*pi), 5, DIST*cos(clock*2*pi)>
    look_at 0
}

hope that helps a little

obviously, to get 2 revolutions, you would add another *2 inside the sin and 
cos calls.

-Simon

"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!
>
>
>
>
>


Post a reply to this message

From: Stephen
Subject: Re: multiple renderings with #while ?
Date: 11 Oct 2007 03:20:01
Message: <web.470dce7d42ec0562726bd13c0@news.povray.org>
"flatline" <bru### [at] itcit> wrote:
> "Stephen" <mcavoys_AT_aolDOT.com> wrote:

> > Megapov can use multiple camera views in one image. Or you could use the
>
> How can I specify 'multiple camera views' in Megapov?
>


time.
If I wanted to do what you want. I would use the animation features and tie
the camera position to the clock or frame variable.
The megapov rendering using different cameras in the same image does look
good. There is a nice rollercoaster animation made by ABX and posted in
p.b.a a few years ago.


Stephen


Post a reply to this message

From: Alain
Subject: Re: multiple renderings with #while ?
Date: 11 Oct 2007 12:17:32
Message: <470e4c9c$1@news.povray.org>
Simon nous apporta ses lumieres en ce 2007/10/10 13:52:
> just my easy method for doing a rovolving camera:
> 
> 
> //this will do 1 "circuit" for the length of the animation:
> 
> #declare DIST = 10; //Radius of loop for camera in POV units
> camera {
>     location <DIST*sin(clock*2*pi), 5, DIST*cos(clock*2*pi)>
>     look_at 0
> }
> 
> hope that helps a little
> 
> obviously, to get 2 revolutions, you would add another *2 inside the sin and 
> cos calls.
> 
> -Simon
> 
have you tought of using rotate?
your camera will become:
cemera{location<0,5,-10> look_at 0 rotate 360*clock*y}

-- 
Alain
-------------------------------------------------
   I knew a girl so ugly, they use her in prisons to cure sex Offenders.
   	Rodney Dangerfield


Post a reply to this message

From: Simon
Subject: Re: multiple renderings with #while ?
Date: 11 Oct 2007 17:54:49
Message: <470e9ba9$1@news.povray.org>
I've always been happier with sin&cos as it allows me to make oval camera 
movement very easily, as well as allowing "smooth" motion of objects ie:

#declare Fade= 1-cos(clock*2*pi)/2

object {whatever
    translate z*Dist*5
}

will (obviously) slide smoothly from origin to 5*z. I just find it easier to 
write it all in the same style.

Why do you find rotate to be more convenient? Simply habit or are there 
advantages I'm missing?

Regards,
Simon

"Alain" <ele### [at] netscapenet> wrote in message 
news:470e4c9c$1@news.povray.org...
> Simon nous apporta ses lumieres en ce 2007/10/10 13:52:
>> just my easy method for doing a rovolving camera:
>>
>>
>> //this will do 1 "circuit" for the length of the animation:
>>
>> #declare DIST = 10; //Radius of loop for camera in POV units
>> camera {
>>     location <DIST*sin(clock*2*pi), 5, DIST*cos(clock*2*pi)>
>>     look_at 0
>> }
>>
>> hope that helps a little
>>
>> obviously, to get 2 revolutions, you would add another *2 inside the sin 
>> and cos calls.
>>
>> -Simon
>>
> have you tought of using rotate?
> your camera will become:
> cemera{location<0,5,-10> look_at 0 rotate 360*clock*y}
>
> -- 
> Alain
> -------------------------------------------------
>   I knew a girl so ugly, they use her in prisons to cure sex Offenders.
>   Rodney Dangerfield


Post a reply to this message

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