A variety of modifiers may be attached to objects. The following items may be applied to any object:
clipped_by
{
UNTEXTURED_SOLID_OBJECT... }
| clipped_by
{
bounded_by
}
|
bounded_by
{
UNTEXTURED_SOLID_OBJECT... }
| bounded_by
{
clipped_by
}
|
no_shadow
| inverse
| sturm
[ Bool ] | hierarchy
[ Bool ] |
interior
{
INTERIOR_ITEMS... }
|
texture
{
TEXTURE_BODY }
| pigment
{
PIGMENT_BODY }
|
normal
{
NORMAL_BODY }
| finish
{
FINISH_ITEMS... }
|
Transformations such as translate, rotate and scale have already been discussed. The modifiers "Textures" and its parts "Pigment", "Normal", and "Finish" as well as "Interior", and "Media" (which is part of interior) are each in major chapters of their own below. In the sub-sections below we cover several other important modifiers: clipped_by
, bounded_by
, no_shadow
, hollow
, inverse
, sturm
, and hierarchy
. Although the examples below use object statements and object identifiers, these modifiers may be used on any type of object such as sphere, box etc.
The clipped_by
statement is technically an object modifier but it provides a type of CSG similar to CSG intersection. The syntax is:
clipped_by
{
UNTEXTURED_SOLID_OBJECT... }
| clipped_by
{
bounded_by
}
Where UNTEXTURED_SOLID_OBJECT is one or more solid objects which have had no texture applied. For example:
object { My_Thing clipped_by{plane{y,0}} }
Every part of the object My_Thing
that is inside the plane is retained while the remaining part is clipped off and discarded. In an intersection
object the hole is closed off. With clipped_by
it leaves an opening. For example the following figure shows object A
being clipped by object B
.
An object clipped by another object.
You may use clipped_by
to slice off portions of any shape. In many cases it will also result in faster rendering times than other methods of altering a shape. 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 bounded_by { box { <0,0,0>, <1,1,1> } } clipped_by { bounded_by } }
This tells POV-Ray to use the same box as a clip that was used as a bounds.
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. POV-Ray 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 doesn't have to be tested against objects in another, far away part of the scene. When large a number of objects are present the boxes are nested inside each other. POV-Ray 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's 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 ray-tracer 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
{
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
POV-Ray 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 POV-Ray's current system. However most unions you create yourself can be easily bounded by the automatic system. For technical reasons POV-Ray cannot split a merge object. It is may be best to hand bound a merge, especially if it is very complex.
Note that 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 POV-Ray to use the same box as a bounds that was used as a clip.
When using CSG it is often useful to invert an object so that it'll be inside-out. The appearance of the object is not changed, just the way that POV-Ray perceives it. When the inverse
keyword is used the inside of the shape is flipped to become the outside and vice versa. For example:
object { MyObject inverse }
The inside/outside distinction is also important when attaching interior
to an object especially if media
is also used. Atmospheric media and fog also do not work as expected if your camera is inside an object. Using inverse
is useful to correct that problem.
Finally the internal_reflections
and internal_highlights
keywords depend upon the inside/outside status of an object.
POV-Ray by default assumes that objects are made of a solid material that completely fills the interior of an object. By adding the hollow
keyword to the object you can make it hollow. That is very useful if you want atmospheric effects to exist inside an object. It is even required for objects containing an interior media. The keyword may optionally be followed by a float expression which is interpreted as a boolean value. For example hollow off
may be used to force it off. When the keyword is specified alone, it is the same as hollow on
. The default no hollow
is specified is off
.
In order to get a hollow CSG object you just have to make the top level object hollow. All children will assume the same hollow
state except their state is explicitly set. The following example will set both spheres inside the union hollow
union { sphere { -0.5*x, 1 } sphere { 0.5*x, 1 } hollow }
while the next example will only set the second sphere hollow because the first sphere was explicitly set to be not hollow.
union { sphere { -0.5*x, 1 hollow off } sphere { 0.5*x, 1 } hollow on }
You may specify the no_shadow
keyword in an object to make that object cast no shadow. This is useful for special effects and for creating the illusion that a light source actually is visible. This keyword was necessary in earlier versions of POV-Ray which did not have the looks_like
statement. Now it is useful for creating things like laser beams or other unreal effects. During test rendering it speeds things up if no_shadow
is applied.
Simply attach the keyword as follows:
object { My_Thing no_shadow }
Some of POV-Ray's objects allow you to choose between a fast but sometimes inaccurate root solver and a slower but more accurate one. This is the case for all objects that involve the solution of a cubic or quartic polynomial. There are analytic mathematical solutions for those polynomials that can be used.
Lower order polynomials are trivial to solve while higher order polynomials require iterative algorithms to solve them. One of those algorithms is the Sturmian root solver. For example:
blob { threshold .65 sphere { <.5,0,0>, .8, 1 } sphere { <-.5,0,0>,.8, 1 } sturm }
The keyword may optionally be followed by a float expression which is interpreted as a boolean value. For example sturm off
may be used to force it off. When the keyword is specified alone, it is the same as sturm on
. The default no sturm
is specified is off
.
The following list shows all objects for which the Sturmian root solver can be used.
blob
cubic
lathe (only with quadratic splines)
poly
prism (only with cubic splines)
quartic
sor