Basic POV-Ray Scenes
Making Art With Computers – Summer HSSP 2002
All
POV-Ray scenes must have four elements in order to show anything.
sphere {
<0, 0,
0>, 1
texture
{
T_Stone35
}
}
This defines a sphere with its center at <0, 0, 0> and radius 1. The object must have a texture that defines how it looks, or it will be black. We use a predefined texture called “T_Stone35.”
background { color Black }
light_source { <10, 7, -5> color White}
This
defines a background color and a single, white point-light at <10, 7,
-5>.
camera {
location
<0, -.5, -5>
look_at <0, 0, 0>
}
This defines a camera at <0, 0.5, -5> that is looking at <0, 0, 0>.
#include "stones.inc"
#include "colors.inc"
This tells us to include “stones.inc,” where we get the definition for “T_Stone35,” and “colors.inc,” where we get the definitions for “Black” and “White.”
There are a number of primitive shapes available. You are limited in the ways you can define them, but they can be moved just about anywhere with transformations. Here are some examples.
box { <-1, 0, -1>, // Near lower left corner < 1, 0.5, 3> // Far upper right corner texture { T_Stone25 // Pre-defined from stones.inc scale 4 // Scale the texture by the same // amount in all directions } rotate y*20 // Equivalent to "rotate <0,20,0>" }
cone { <0, 1, 0>, 0.3 // Center and radius of one end <1, 2, 3>, 1.0 // Center and radius of other end texture { T_Stone25 scale 4 } translate 3*x // evaluates to <3,0,0> so move 3 units // in the x direction and none along y or z }
cylinder { <0, 1, 0>, // Center of one end <1, 2, 3>, // Center of other end 0.5 // Radius open // Remove end caps texture { pigment { color Red } } scale 5 // Evaluates as <5,5,5> so uniformly scale // by 5 in every direction.
}
plane { <0, 1, 0>, // “Up” points in positive y direction -1 // The plane starts at –1 * <0, 1, 0> = <0, -1, 0> pigment { // pigment { color Red } color Red // is a shorthand for } // texture { pigment { color Red } } }
torus { 4, 1 // major and minor radius rotate -90*x // so we can see it from the top pigment { Green } }