Prev | Next


CSG (Constructive Solid Geometry)


RenderMan for Maya provides functionality for CSG Boolean operations on geometric surfaces — computed in the renderer. CSG stands for “Constructive Solid Geometry,” allowing two, or more, objects (or groups of objects) to be combined in a number of ways, creating complicated geometry and special effects.

Using CSG requires that objects have RenderMan attributes attached to designate them as special CSG primitives. Then they must be grouped together and that group must have a CSG attribute applied to it as well. Here's how…

 


1 - Create Geometric CSG primitives


First create two pieces of geometry in Maya, as seen here. (For best results the geometry should be a closed solid, with no open holes.)

Next designate each geometric piece as a CSG primitve. Select the geometry (not the Shape node) and then from the Attributes menu, in the Attribute Editor…

Attributes-> RenderMan-> Add CSG Solid Type

This will add a dropdown menu to the Extra RenderMan Attributes. The objects at the base of a CSG hierarchy should always be designated as a CSG Primitive.


2 - Group and Apply CSG Operation


Group the two objects together. Now apply a CSG operation on the grouped node, in the same way you did to each piece of geometry.


3 - Render "Difference"


Select Difference as the Solid Type for your grouped node. Render the scene.

The final image give us a CSG difference, with the cylinder making a hole through the sphere. In this case the hole is made in the sphere since it is the first item in the group. If the cylinder was first, then the sphere would make a hole in the cylinder. An objects order in the hierarchy of the group determines how objects are subtracted. 

Note: The section the cylinder cuts away is shaded by the cylinder's shader.


4 - The "Intersection" 


Change the Solid Type to Intersection. Now render.

An object is formed from only the area that the objects both occupy.


5 - The "Union"


Finally, use the third operator by changing the type to Union Render. A single object is created from the intersecting objects.

Note: These two pieces of geometry are now "fused" together into one piece. This can be useful in cases where the fused geometry will be used to perform other CSG operations on other geometry. 


6 - Conclusion


CSG is a powerful technique for the following reasons:

  • Groups of objects, entire characters or vehicles, can be added to CSG operations. (Be sure to designate all components of a object hierarchy (such as a character) as CSG primitives, grouping them with "Union" operators.)
  • Easily animated, including motion blur.
  • Multiple primitives can be grouped in a CSG operation.
  • Hierarchies of consecutive CSG operations can be constructed. (For example, an "intersection" can be applied to a group of primitves and that result can be used in a "difference" operation against another primitive, and even that can be subtracted from another object.) 

The image to the right was created by adding the cylinder and sphere to a larger hierarchy of CSG operations. We'll leave it as an exercise to the reader to figure out how this bizarre geometric artifact was accomplished.

 


Prev | Next


 

 

Pixar Animation Studios
Copyright© Pixar. All rights reserved.
Pixar® and RenderMan® are registered trademarks of Pixar.
All other trademarks are the properties of their respective holders.