5.6 MISC FEATURES
-------------------
Here are a variety of other topics about POV-Ray features.
5.6.1 FOG
POV-Ray includes the ability to render fog. To add fog to a scene, place
the following declaration outside of any object definitions:
fog {
color Gray70 // the fog color
distance 200.0 // distance for 100% fog color
}
The fog color is then blended into the current pixel color at a rate
calculated as:
1-exp(-depth/distance) =
1-exp(-200/200) =
1-exp(-1) =
1-.37... =
0.63...
So at depth 0, the color is pure (1.0) with no fog (0.0). At the fog
distance, you'll get 63% of the color from the object's color and 37% from
the fog color.
Subtle use of fog can add considerable realism and depth cuing to a scene
without adding appreciably to the overall rendering times. Using a black
or very dark gray fog can be used to simulate attenuated lighting by
darkening distant objects.
5.6.2 MAX_TRACE_LEVEL
The "#max_trace_level" directive sets a variable that defines how many
levels that POV-Ray will trace a ray. This is used when a ray is reflected
or is passing through a transparent object. When a ray hits a reflective
surface, it spawns another ray to see what that point reflects, that's
trace level 1. If it hits another reflective surface, then another ray is
spawned and it goes to trace level 2. The maximum level by default is 5.
If max trace level is reached before a non-reflecting surface is found,
then the color is returned as black. Raise max_trace_level if you see black
in a reflective surface where there should be a color.
The other symptom you could see is with transparent objects. For instance,
try making a union of concentric spheres with the Cloud_Sky texture on
them. Make ten of them in the union with radius's from 1-10 then render the
Scene. The image will show the first few spheres correctly, then black.
This is because a new level is used every time you pass through a
transparent surface. Raise max_trace_level to fix this problem. For
example:
#max_trace_level 20
Note: Raising max_trace_level will use more memory and time and it could
cause the program to crash with a stack overflow error. Values for
max_trace_level are not restricted, so it can be set to any number as long
as you have the time and memory.
5.6.3 MAX_INTERSECTIONS
POV-Ray uses a set of internal stacks to collect ray/object intersection
points. The usual maximum number of entries in these "I-Stacks" is 64.
Complex scenes may cause these stacks to overflow. POV-Ray doesn't stop
but it may incorrectly render your scene. When POV-Ray finishes rendering,
a number of statistics are displayed. If you see "I-Stack Overflows"
reported in the statistics, you should increase the stack size. Add a
directive to your scene as follows:
#max_intersections 200
If the "I-Stack Overflows" remain, increase this value until they stop.
5.6.4 BACKGROUND
A background color can be specified if desired. Any ray that doesn't hit
an object will be colored with this color. The default background is
black. The syntax for background is:
background { color SkyBlue }
Using a colored background takes up no extra time for the ray tracer,
making it a very economical, although limited, feature. Only solid colors
can be specified for a background. Textures cannot be used. No shadows
will be cast on it, which makes it very useful, but at the same time, it
has no "roundness", or shading, and can sometimes cause a scene to look
"flat". Use background with restraint. It's often better, although a bit
slower, to use a "sky sphere", but there are times when a solid background
is just what you need.
5.6.5 THE #VERSION DIRECTIVE
Although POV-Ray 2.0 has had significant changes to the language over POV-
Ray 1.0, almost all 1.0 scenes will still work if the compatibility mode is
set to 1.0. The +MV switch described earlier, sets the initial mode. The
default is +MV2.0.
Inside a scene file you may turn compatibility off or on using the
"#version" directive. For example:
#version 1.0
// Put some version 1.0 statements here
#version 2.0
// Put some version 2.0 statements here
Note you may not change versions inside an object or declaration.
The primary purpose of the switch is to turn off float and expression
parsing so that commas are not needed. It also turns off some warning
messages.
Note some changes in tiles and material_maps cannot be fixed by turning the
version compatibility on. It may require hand editing of those statements.
See the special texture section for details.
Future versions of POV-Ray may not continue to maintain full backward
compatibility. We strongly encourage you to phase in 2.0 syntax as much as
possible.