The calculations necessary to test if a ray hits an object can be quite time consuming. Each ray has to be tested
against every object in the scene. POVRay attempts to speed up the process by building a set of invisible boxes,
called bounding boxes, which cluster the objects together. This way a ray that travels in one part of the scene does
not have to be tested against objects in another, far away part of the scene. When a large number of objects are
present the boxes are nested inside each other. POVRay can use bounding boxes on any finite object and even some
clipped or bounded quadrics. However infinite objects (such as a planes, quartic, cubic and poly) cannot be
automatically bound. CSG objects are automatically bound if they contain finite (and in some cases even infinite)
objects. This works by applying the CSG set operations to the bounding boxes of all objects used inside the CSG
object. For difference and intersection operations this will hardly ever lead to an optimal bounding box. It is
sometimes better (depending on the complexity of the CSG object) to have you place a bounding shape yourself using a
bounded_by statement.
Normally bounding shapes are not necessary but there are cases where they can be used to speed up the rendering of
complex objects. Bounding shapes tell the raytracer that the object is totally enclosed by a simple shape. When
tracing rays, the ray is first tested against the simple bounding shape. If it strikes the bounding shape the ray is
further tested against the more complicated object inside. Otherwise the entire complex shape is skipped, which
greatly speeds rendering. The syntax is:
BOUNDED_BY:
bounded_by { UNTEXTURED_SOLID_OBJECT... } 
bounded_by { clipped_by }
Where UNTEXTURED_SOLID_OBJECT is one or more solid objects which have had no texture applied. For example:
intersection {
sphere { <0,0,0>, 2 }
plane { <0,1,0>, 0 }
plane { <1,0,0>, 0 }
bounded_by { sphere { <0,0,0>, 2 } }
}
The best bounding shape is a sphere or a box since these shapes are highly optimized, although, any shape may be
used. If the bounding shape is itself a finite shape which responds to bounding slabs then the object which it
encloses will also be used in the slab system.
While it may a good idea to manually add a bounded_by to intersection, difference and merge, it is
best to never bound a union. If a union has no bounded_by POVRay can internally split apart
the components of a union and apply automatic bounding slabs to any of its finite parts. Note that some utilities such
as raw2pov may be able to generate bounds more efficiently than POVRay's current system. However most
unions you create yourself can be easily bounded by the automatic system. For technical reasons POVRay cannot split a
merge object. It is maybe best to hand bound a merge, especially if it is very complex.
Note: if bounding shape is too small or positioned incorrectly it may clip the object
in undefined ways or the object may not appear at all. To do true clipping, use clipped_by as explained
in the previous section. Occasionally you will want to use the clipped_by and bounded_by
options with the same object. The following shortcut saves typing and uses less memory.
object {
My_Thing
clipped_by{ box { <0,0,0>,<1,1,1 > }}
bounded_by{ clipped_by }
}
This tells POVRay to use the same box as a bound that was used as a clip.
