Reference:Union

From POV-Wiki
Revision as of 19:09, 15 March 2012 by Jholsenback (talk | contribs) (1 revision: Reference Migration Initial Load)
Jump to navigation Jump to search
RefImgUnionobj.gif

The union of two objects.

The simplest kind of CSG is the union. The syntax is:

UNION:
  union {
    OBJECTS...
    [OBJECT_MODIFIERS...]
    }

Unions are simply glue used to bind two or more shapes into a single entity that can be manipulated as a single object. The image above shows the union of A and B. The new object created by the union operation can be scaled, translated and rotated as a single shape. The entire union can share a single texture but each object contained in the union may also have its own texture, which will override any texture statements in the parent object.

You should be aware that the surfaces inside the union will not be removed. As you can see from the figure this may be a problem for transparent unions. If you want those surfaces to be removed you will have to use the merge operations explained in a later section.

The following union will contain a box and a sphere.

union {
  box { <-1.5, -1, -1>, <0.5, 1, 1> }
  cylinder { <0.5, 0, -1>, <0.5, 0, 1>, 1 }
  }

Earlier versions of POV-Ray placed restrictions on unions so you often had to combine objects with composite statements. Those earlier restrictions have been lifted so composite is no longer needed. It is still supported for backwards compatibility.

Split_Union

split_union is a boolean keyword that can be added to a union. It has two states on/off, its default is on.

split_union is used when photons are shot at the CSG-object. The object is split up in its compound parts, photons are shot at each part separately. This is to prevent photons from being shot at 'empty spaces' in the object, for example the holes in a grid. With compact objects, without 'empty spaces' split_union off can improve photon gathering.

union {
  object {...}
  object {...}
  split_union off
  }