Tuesday, January 15, 2008

Getting Started With POV-Ray

All the animations that I've developed have been created with the 3-D ray tracing program POV-Ray.

One of the best ways to learn about using POV-Ray is the documentation that comes along with the program. That documentation is also available online and in particular there is an excellent section on getting started.

Friedrich A. Lohmueller has a wonderful selection of descriptions, samples and examples for POV-Ray. In particular, his animation tutorial will certainly help the beginner get started.

Mike Williams has a number of galleries and tutorials. I continually refer to his Isosurface Tutorial when working with isosurfaces or using functions as texture maps.

Christoph Hormann has useful examples, tutorials, tools and include files relating to ray tracing in general, POV-Ray in particular as well as POV-Ray's unofficial enhancement, MegaPOV.

Finally, a sample POV-Ray file for a very simple animation to illustrate the essentials for creating a simple animation. Below is the source for the file simple.pov:
#include "colors.inc"    //this lets us use common color names
#include "finish.inc" //use some generic finishes

background{Gray} // set the color of the background

camera {
location <0,> //location in POV-Ray vector notation
look_at <0,0,0> //where the camera is pointed
}

light_source {
<-20, 40, -20> // light's position
color rgb <1,1,1> // light's color specified as a rgb "vector"
}

//hang a pendulum from the origin
union{ // it is a combo object, CSG fun

cylinder{<0,0,0>,<0,-4,0>,.1 // sphere start,end, radius
pigment{Blue}
finish{Shiny}
}

sphere{<0,-4,0>,.5 // sphere center, radius
pigment{Red}
finish{Dull}
}

rotate z*30 // the vertical tilt of the pendulum
rotate y*clock*360 // swing it around in a horizontal circle
// DYNAMIC with clock variable
translate y*2 // lift it back into center of view

}
which is run with the following ini file simple.ini
; POV-Ray animation ini file    ala Lohmueller 
Antialias=on

Antialias_Threshold=0.2

Antialias_Depth=3

Input_File_Name=simple.pov

Initial_Frame=1

Final_Frame=30
Initial_Clock=0

Final_Clock=1
Cyclic_Animation=on

Pause_when_Done=off

and then sewn together using virtualdub to produce this animation:


A simple version of the conical pendulum.

3 comments:

Abhay Karnataki said...

Wow, sounds very interesting and straighforward to animate. I will see if I can also do it.
How about animating a Foucault Pendulum!

Girona Airport said...

i can see a lot of hard work,effort and resources going into it.do you think these much of efforts on animation worth it.

Anonymous said...

The animations are simply awesome. Can you please make some more? I am a college sophomore with a dual major in Physics and Mathematics @ University of California, Santa Barbara. By the way, i came across these excellent physics flash cards. Its also a great initiative by the FunnelBrain team. Amazing!!