3.4.8 Light Groups |
POV-Ray 3.6 for UNIX documentation 3.4.9 Object Modifiers |
3.5 Textures |
A variety of modifiers may be attached to objects. The following items may be applied to any object:
OBJECT_MODIFIER: clipped_by { UNTEXTURED_SOLID_OBJECT... } | clipped_by { bounded_by } | bounded_by { UNTEXTURED_SOLID_OBJECT... } | bounded_by { clipped_by } | no_shadow | no_image [ Bool ] | no_reflection [ Bool ] | inverse | sturm [ Bool ] | hierarchy [ Bool ] | double_illuminate [ Bool ] | hollow [ Bool ] | interior { INTERIOR_ITEMS... } | material { [MATERIAL_IDENTIFIER][MATERIAL_ITEMS...] } | texture { TEXTURE_BODY } | interior_texture { TEXTURE_BODY } | pigment { PIGMENT_BODY } | normal { NORMAL_BODY } | finish { FINISH_ITEMS... } | photons { PHOTON_ITEMS...} TRANSFORMATION
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
, material
, inverse
,
hollow
, no_shadow
, no_image
, no_reflection
, double_illuminate
and sturm
. 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: 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
.
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 bound.
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 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. 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 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 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: 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 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 POV-Ray to use the same box as a bound that was used as a clip.
One of the changes in POV-Ray 3.1 was the removal of several items from texture { finish{
...} }
and to move them to the new interior
statement. The halo
statement, formerly part of texture
, is now renamed media
and made a part of the interior
.
This split was deliberate and purposeful (see "Why are Interior and Media Necessary?") however beta testers pointed out that it made it difficult to entirely describe the surface properties and interior of an object in one statement that can be referenced by a single identifier in a texture library.
The result is that we created a "wrapper" around texture
and interior
which
we call material
.
The syntax is:
MATERIAL: material { [MATERIAL_IDENTIFIER][MATERIAL_ITEMS...] } MATERIAL_ITEMS: TEXTURE | INTERIOR_TEXTURE | INTERIOR | TRANSFORMATIONS
For example:
#declare MyGlass=material{ texture{ Glass_T } interior{ Glass_I }} object { MyObject material{ MyGlass}}
Internally, the "material" is not attached to the object. The material is just a container that brings the texture and interior to the object. It is the texture and interior itself that is attached to the object. Users should still consider texture and interior as separate items attached to the object.
The material is just a "bucket" to carry them. If the object already has a texture, then the material
texture is layered over it. If the object already has an interior, the material interior fully replaces it and the old
interior is destroyed. Transformations inside the material affect only the textures and interiors which are inside the
material{}
wrapper and only those textures or interiors specified are affected. For example:
object { MyObject material { texture { MyTexture } scale 4 //affects texture but not object or interior interior { MyInterior } translate 5*x //affects texture and interior, not object } }
Note: The material
statement has nothing to do with the material_map
statement. A material_map
is not a way to create patterned material. See "Material
Maps" for explanation of this unrelated, yet similarly named, older feature.
When using CSG it is often useful to invert an object so that it will 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.
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, also see the "Empty
and Solid Objects" chapter. 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
. By default hollow
is off
when not specified.
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 when 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 }
Syntax:
OBJECT { [OBJECT_ITEMS...] no_image no_reflection }
These two keywords are very similar in usage and function to the no_shadow
keyword, and control an
object's visibility.
You can use any combination of the three with your object.
When no_image
is used, the object will not be seen by the camera, either directly or through
transparent/refractive objects. However, it will still cast shadows, and show up in reflections (unless no_reflection
and/or no_shadow
is used also).
When no_reflection
is used, the object will not show up in reflections. It will be seen by the camera
(and through transparent/refractive objects) and cast shadows, unless no_image
and/or no_shadow
is used.
Using these three keywords you can produce interesting effects like a sphere casting a rectangular shadow, a cube that shows up as a cone in mirrors, etc.
Syntax:
OBJECT { [OBJECT_ITEMS...] double_illuminate }
A surface has two sides; usually, only the side facing the light source is illuminated, the other side remains in
shadow. When double_illuminate
is used, the other side is also illuminated.
This is useful for
simulating effects like translucency (as in a lamp shade, sheet of paper, etc).
Note: double_illuminate
only illuminates both sides of the same surface,
so on a sphere, for example, you will not see the effect unless the sphere is either partially transparent, or if the
camera is inside and the light source outside of the sphere (or vise versa).
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
.
By default sturm
is off
when not specified.
The following list shows all objects for which the Sturmian root solver can be used.
3.4.8 Light Groups | 3.4.9 Object Modifiers | 3.5 Textures |