Saturday, August 13, 2016

POV-Ray basics

POV-Ray is a ray-tracing program. My simplistic view of what this means is that POV-Ray can turn a description of a scene into an image.

Here's an example.


1) Install POV-Ray (downloads here)

2) Start POV-Ray, and create a new file

3) Copy and paste the following text into the new file.


#include "colors.inc"

background {color White}
camera {location <-25,25,25>
sky <0,0,1>
look_at <10,0,0>}
light_source { <-25,25,25> color White }
                     
cylinder{<0,0,0>,<10,0,0>,1 texture {pigment {color Red}}}                    
cylinder{<0,0,0>,<0,10,0>,1 texture {pigment {color Green}}}
cylinder{<0,0,0>,<0,0,10>,1 texture {pigment {color Blue}}}

sphere {<10,10,10>,3 texture {pigment {color OrangeRed}}}


4) Run

5) You should see the following image



6) Here's what the *.pov file did

  • It put a camera at x=-25, y=25, z=25.
  • The sky command aligned the camera along the z -axis. (If there was a pole sticking out the top of the camera, the pole would be parallel to the z axis.)
  • The camera is pointing at x=10, y=0, z=0.
  • There is a light at the same location as the camera.
  • Three cylinders start at the origin <0,0,0> and run along the x, y, and z axes respectively.
  • Finally, there's a sphere at x=10, y=10, z=10.

7) When you pressed Run, POV-Ray worked out what the camera would have seen and created a *.png file of the view.

That's the basics. Everything else I've done in POV-Ray is just an extension of these sorts of techniques. I'll describe a few of my tricks in upcoming posts.

If you want to see what experts can do, take a look at the POV-Ray Hall of Fame.

No comments:

Post a Comment