BACK                                                                                         HOME

Intro to POV- Ray

The following is a quick introduction to POV-Ray and and a demo of some of its features.

POV-Ray works by placing elements with in a 3d environment along with a light source (or sources) and a "camera". The camera defines the viewpoint from which the scene will be rendered.

POV-ray uses a text interface to generate its scenes and using it is not unlike using a programming language.

The first step in creating a scene is to place your light source and camera. The syntax for this is as follows:


light_source
{
  <0,0,0>
  color red 1.0  green 1.0  blue 1.0
  translate <-20, 40, -20>
}

camera
{
  location  <0.0 , 3.0 ,-7.0>
  look_at   <0.0 , 0.0 , 0.0>
}



The first part tells POV-ray to place a light source at the coordinates x=0, y=0, z=0 and then move it to x=-20, y=40, z=-20
You could have just told the renderer to place the light at -20x, 40y, -20z directly, but there is a reason for dooing it this way. This has to do with the way POV-Ray handles certain operations such as translate, rotate and scale.

The second part places a camera at 0x,3y,-7z. This camera  looks at the origin of  the 3D space.
 

Now lets add some elements:


box
{
  <-1, -1, -1>  // one corner position
  < 1,  1,  1>  // other corner position
translate x*-3
pigment{color rgb<1,0,0>}}
 

sphere
{
  <0, 0, 0> // center of sphere
  1       // radius of sphere

pigment {color rgb<0,1,0>}}

cone
{
  1*y,  0.0, // one end of cone and its radius
  -1*y, 1.0 // the other end of the cone and its radius

 translate x*3 pigment {color rgb<0,0,1>}}



A couple of notes here, anything following // is a remark and ignored by the renderer
The The x*-3 is the same as <1,0,0>*3 or <3,0,0>, it is same for 1*y and -1*y. These are shorthand for these coordinates
Pigment allows us to add color to our elements. In this case the numbers in the <> represent relative red, green and blue shades.

The scene so far would look like this:

Notice that the renderer has already taken care of the shading.

Now lets add a white plane for our shapes to sit on



plane
{
  y, // unit surface normal, vector points "away from surface"
  -1.0 // distance from the origin in the direction of the surface normal

 pigment {color rgb<1,1,1>}}

The renderer also takes care of shadows.

Our object look a little lifeless so lets pep then up a little by adding the following

finish {phong .5}

to the sphere and cone.

Brings them right to life!

Now let's add some reflection to the sphere with 


sphere
{
  <0, 0, 0> // center of sphere
  1       // radius of sphere

pigment {color rgb<0,1,0>}
finish {phong .5 reflection .7}}




So far, we've left the cube alone, so let's do something fun with it. We are not limited to solid colors, as POV-ray offers a number of patterns we can choose from so let's modify the cube to something like this:



box
{
  <-1, -1, -1>  // one corner position
  < 1,  1,  1>  // other corner position
translate x*-3
pigment{ granite }
}

Also, the shadows are a little dark, so let's alter the ambient light with:


global_settings { ambient_light 4 }
A plain white surface isn't very interesting either so let's change it too.


plane
{
  y, // unit surface normal, vector points "away from surface"
  -1.0 // distance from the origin in the direction of the surface normal

 pigment {

wood
turbulence .05
rotate 2 rotate y*37
scale .1}

finish{phong .3 phong_size 30 reflection .4}}

Now, one aspect (of many) that we haven't touched on is surface normal or 'bumpiness" of our objects so let's adjust this on the cone with


 normal {wrinkles scale .1 bump_size .5}

Now let's try one more thing. Objects aren't always opaque, so let's alter the sphere's finish and pigment thus:


pigment {color rgbf<0,1,0,.8>}
finish {phong .5 reflection .7  ior 1.5 caustics .2}}

The extra value in the pigment is the filter, and sets how much light filters through the object
ior set the index of refraction for the object, and caustics adds some more realism.

And now our sphere is a green glass marble.
 

This is just a small sample of what can be done using POV-ray with a little practice. In this demo I've barely touched on the features and capabilities of this software.

 BACK                   HOME

1