Email: nexusmail at this Web site address
Table of Contents
A more dramatic sceneWith the preceding scene in mind, let's analyze a somewhat more dramatic scene -- one which has been done so many times by ray-tracers that it's become a cliche:
// Persistence Of Vision raytracer version 3.0 sample file.
// Use copies of this file for starting your own scenes.
#include "colors.inc"
#include "textures.inc"
#include "finish.inc"
camera {
location <0, 4,-20>
look_at <0,1,10>
angle 25
}
light_source {<0, 20, -30> color White}
background {color Blue}
// Floor
plane { <0,1,0>, 0
pigment {checker color White, Red}
finish {Dull}}
// Sphere object
sphere { <0, 2, 0>, 1
pigment {color White}
finish {Mirror}
}
Render this with width 320, height 240, and this is what you'll get:
Pretty impressive! Let's go through the POV-Ray code above and dissect it piece by piece: Comments// Persistence Of Vision raytracer version 3.0 sample file. // Use copies of this file for starting your own scenes.
These are comments, remarks that are ignored by the POV-Ray program. Comments follow the usual style in the programming language C++. Use a double slash "//" to "comment" text on a single line, and the pair of symbols "/*" and "*/"to enclose two or more lines of commented text. As an example: //This comment can only go on one line, /* whereas this one can spread out over several lines, if it feels like it. */
Comments are very useful for making notes in your scene files, and make it much easier to track down problems (and rest assured, you will run into problems regularly). Now, back to the scene file we've been examining: "Include" files#include "colors.inc" #include "textures.inc" #include "finish.inc"
These are common include files. Specify an include file by using The camera
camera {
location <0, 4,-20>
look_at <0,1,10>
angle 25
}
Here's the camera. The You'll also note that I wrote the
camera {location <0, 4,-20> look_at <0,1,10> angle 25}
and POV-Ray will interpret it in exactly the same way. The only thing you mustn't do is break up individual keywords with spaces. Similarly, in the large majority of cases, the order of keywords makes no difference: we could also write this camera as:
camera {look_at <0,1,10> location <0, 4,-20> angle 25}
Play around with the format of POV-Ray declarations until you find one that works well for you. The light source
light_source {<0, 20, -30> color White}
Here's the light source. Notice that I haven't specified a color using A cautionary note:Although POV-Ray lets you use white space freely, all commands and attributes in POV-Ray are case-sensitive. Specifying
Light_source {<0, 20, -30> color White}
causes POV-Ray to stop with an error message, since POV-Ray doesn't recognize Defining a background
background {color Blue}
The Defining another object: the plane
// Floor
plane { <0,1,0>, 0
texture {
pigment {checker color White, Red}
finish {Dull}}
Here's something a little more complicated. POV-Ray can define not only finite objects, like This plane also has something called a The first section of our texture is something called
but more complicated pigments are possible. Here, I've used, instead of a single color, the pigment There's also something called The reflective sphere
// Sphere object
sphere { <0, 2, 0>, 1
pigment {color White}
finish {Mirror}
}
And here's the shiny sphere. Defining a sphere is simple -- give a vector specifying the position of the center of the sphere, and a number specifying its radius. I've taken a couple of shortcuts here. There is no "texture" block here -- the pigment and finish statements stand by themselves. POV-Ray will let you use these by themselves. Similarly, many very common statements can be condensed. For example, a The "Mirror" finish makes the sphere metallic-looking and highly reflective. In fact, it effectively turns off the color of the sphere itself (we've specified "White" above"), since it's now only reflecting its surroundings. |
|||

