|
Let's try out a computer graphics standard "The Checkered
Floor". We add the following object to the first version of the
demo.pov
file, the one including the sphere.
plane { <0, 1, 0>, -1 pigment { checker color Red, color Blue } }
The object defined here is an infinite plane. The vector <0,1,0> is the surface normal of the plane (i.e. if we were standing on the surface, the normal points straight up). The number afterward is the distance that the plane is displaced along the normal from the origin -- in this case, the floor is placed at y=-1 so that the sphere at y=1, radius=2, is resting on it.
Note: even though there is no texture
statement there is
an implied texture here. We might find that continually typing statements
that are nested like texture {pigment
} can get to be tiresome so
POV-Ray let's us leave out the texture
statement under many
circumstances. In general we only need the texture block surrounding a
texture identifier (like the T_Stone25
example above), or when
creating layered textures (which are covered later).
This pigment uses the checker color pattern and specifies that the two colors red and blue should be used.
Because the vectors <1,0,0>, <0,1,0> and <0,0,1> are used
frequently, POV-Ray has three built-in vector identifiers x
,
y
and z
respectively that can be used as a
shorthand. Thus the plane could be defined as:
plane { y, -1 pigment { ... } }
Note: that we do not use angle brackets around vector identifiers.
Looking at the floor, we notice that the ball casts a shadow on the floor. Shadows are calculated very accurately by the ray-tracer, which creates precise, sharp shadows. In the real world, penumbral or "soft" shadows are often seen. Later we will learn how to use extended light sources to soften the shadows.
|