POV-Ray : Documentation : 1.4.1.3 How do I move the camera in a circular path?
  POV-Ray 3.6 Documentation Online View  
1.4.1.2 How do I make bright objects?   1.4.1.4 How do I use an image to texture my object?

1.4.1.3 How do I move the camera in a circular path?

"How do I move the camera in a circular path while looking at the origin?"

There are two ways to make this: The easy (and limited) way, and the more mathematical way.

The easy way:

camera
{ location <0,0,-10>
  look_at 0
  rotate <0,clock*360,0>
}

This puts the camera at 10 units in the negative Z-axis and then rotates it around the Y-axis while looking at the origin (it makes a circle of radius 10).

The mathematical way:

camera
{ location <10*sin(2*pi*clock),0,-10*cos(2*pi*clock)>
  look_at 0
}

This makes exactly the same thing as the first code, but this way you can control more precisely the path of the camera. For example you can make the path elliptical instead of circular by changing the factors of the sine and the cosine (for example instead of 10 and 10 you can use 10 and 5 which makes an ellipse with the major radius 10 and minor radius 5).

An easier way to do the above is to use the vrotate() function, which handles the sin() and cos() stuff for you, as well as allowing you to use more complex rotations.

camera
{ location vrotate(x*10, y*360*clock)
  look_at 0
}

To get an ellipse with this method, you can just multiply the result from vrotate by a vector, scaling the resulting circle. With the last two methods you can also control the look_at vector (if you do not want it looking just at the origin).

You could also do more complex transformations combining translate, scale, rotate, and matrix transforms by replacing the vrotate() call with a call of the vtransform() function found in functions.inc (new in POV-Ray 3.5).

1.4.1.2 How do I make bright objects?   1.4.1.4 How do I use an image to texture my object?


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