The Online POV-Ray Tutorial
Modifiers
The things in this file are used to modify the default behavior of certain
objects. These modifiers include the following.
Bounded By
The only effect of bounding is to speed the rendering of a scene. Specifying
a bounding object for another object tells POV-Ray the latter is entirely
contained by the former. When rendering, POV-Ray first does any ray tests
against the presumably simpler bounding object. If the ray does not intersect
the bounding object, then POV-Ray assumes that it does not intersect the
interior object either. POV-Ray then skips the potentially lengthy ray
intersection tests with the interior object. If the ray does intersect
the bounding object, POV-Ray then performs tests to see if the ray also intersects
the interior object. Bounding objects do not affect the way the scene looks.
Any object (except light sources) can
be bounded, although bounding will show the most speed improvement when used
with complex CSG or polynomial
objects. Boxes and spheres make wonderful bounding objects as they are highly
optimized, however, any object may be used to bound another.
Note that POV-Ray has a limited ability to do automatic bounding. Most
finite objects can be automatically bounded
with a reasonable amount of efficiency. Unions
can also be bounded fairly efficently. Things that cannot be automatically
bounded are infinite objects, differences,
intersections, or merges.
Here's an example of the use of bounded_by. Really_Complex_Chair is presumed
to be defined somewhere above this in the scene file.
object {
Really_Complex_Chair
bounded_by {
box {
<-4, 0, -4>, >4, 8, 4>
}
}
}
Objects should never extend outside their bounds. Doing so will have
undefined results. Sometimes the object will render ok, sometimes parts
that stick out will be trimmed away, sometimes things will just get weird.
If you want to slice away part of an object, use clipped_by
or CSG.
If you have an object which you clipped, and want to use the same object to
bound that you used to clip, you can do something like this . . .
object {
Some_Object_Or_Other
clipped_by {
sphere {
<0, 2, 0>, 3
}
}
bounded_by { clipped_by }
}
Clipped By
The clipped_by statement allows you slice away parts of objects to reveal a
hollow interior. It is similar to intersection
except it leaves holes where parts of the object were clipped away.
Any object (except light sources)
can be clipped, and any object (except for light sources again) can be used
to clip. For example, here is a cube that is clipped with a sphere.
Only the portions of the cube that are on the inside of the sphere are retained.
The notions of "inside" and "outside" in the clipping object can be switched
with the inverse keyword. Note that you can
specify multiple objects to clip with in one clipped_by statement. The result
will be that the object is clipped first with first object, then the result
is clipped with the second, and the result of that is clipped with the third,
etc. Here's an example of a cube with two clipping spheres.
If you've bounded an object with a second object,
and want to use that same second object to clip the first, you can do something
like this (presumably This_Is_An_Object is declared elsewhere)
object {
This_Is_An_Object
bounded_by {
cylinder {
<0, 0, 0>, <0, 1, 0>, 0.5
}
}
clipped_by { bounded_by }
}
Map Type
The map_type keyword is only applicable to image maps,
bump maps, and material
maps. It is used to modify how the image is projected onto the surface
in the mapping. The parameter for map_type is an integer which tells what kind
of mapping to use. The default is "map_type 0". This is a planar mapping in
which the image is projected along the z axis onto
the x-y plane. The image is rescaled to fit into the unit square in
the x-y plane. It also repeats infinitely in the x and y directions.
Other mappings are as follows.
- map_type 0
- The planar mapping as described above.
- map_type 1
- A sperical mapping. The image is mapped Mercator-style around the origin.
The right edge of the image ends up in the +x direction and is mapped clockwise
around the y-axis. The top and bottom edges of the image are compressed down
to points on the y-axis. The image shows a great deal of distortion around
the poles of the mapping (the y-axis by default). Each pixel in the image is transformed into a three
dimensional wedge shape which radiates from the origin.
- map_type 2
- A cylindrical mapping. The image is mapped around the y-axis like wrapping
paper. As with the spherical mapping, the right edge of the image ends up
in the +x direction, and the image is mapped around the y-axis in a clockwise
sense. The image is still rescaled in the y-direction to be one unit tall and
repeats infinitely up the y-axis. Each pixel in the image is
transformed into a pie-slice shape which radiates from the y-axis.
- map_type 5
- A toroidal mapping. This type of mapping is the most difficult to describe.
The image will fit around an untransformed torus (i.e. one that was created
with the torus primitive and then left
alone). Experiment with it.
Map types 3 and 4 are reserved for future use.
The following images show map types 0, 1, 2, and 5, respectively. Each map
type is projected onto its corresponding shape. Note that for types 1, 2,
and 5, the pigment was rotated to give a better view of what exactly was
going on.
For example, if you wanted to make a globe, you might try something like this
sphere {
<0, 0, 0>, 4
pigment {
image_map {
gif "earth.gif"
map_type 1
}
}
}
No Shadow
The no_shadow keyword is applicable to any object (not light
sources or cameras). When included in an
object, that object will not cast a shadow on anything else. This is
primarily useful for special effects, primarily those which simulate objects
which "produce" light. Laser beams are a good example. The no_shadow keyword
takes no parameter, it's either there, or it's not (in which case the
object will cast a shadow like normal).
The following images show the effect of no_shadow. The first image is normal, the second
has a sphere with the no_shadow keyword.
Once
The once keyword is only applicable to image maps,
bump maps, and material
maps. By default, the image which is mapped is repeated infinitely in
the x and y directions (this varies with the map type).
Adding the "once" keyword to a mapping specification will remove all the
duplications of the image except the one in the (0, 0), (1, 1) unit square.
With image maps, everywhere else becomes transparent; with bump maps, everywhere
else becomes flat; with material maps, everywhere else becomes texture 0.
The once keyword takes no parameter.
If, for example, you wanted to create a single image stamped into a mirror
you might try
box {
<-1, -1, -1>, <2, 2, 2>
pigment { color rgb <1, 1, 1> }
finish {
reflection 1
ambient 0
diffuse 0
}
normal {
bump_map {
gif "stamp.gif"
once
}
}
}
Open
THe open keyword controls the existence of endcaps on cylinders
and cones. It is not legal anywhere else.
This keyword takes no parameter. If it is specified, then cones and cylinders
will be rendered as hollow tubes. Otherwise they will have the circular
ends in place (default). Here are two sample scenes, the first without open
and the second with.
Sturm
Sturm is only applicable to blobs and
polynomial objects (including tori).
These objects require extremely accurate calculations to render. Normally
they will look ok with POV-Ray's default root-solver. However, in certain
cases they will render incorrectly. In these cases, you can specify the
keyword "sturm" inside the object's declaration to tell POV-Ray to use its
more accurate (but slower) Sturmian Root Solver. Another possible fix is to
rotate, translate,
or scale the object by a very small amount.