Bump and Displacement Shaders |
RenderMan For Maya supports both bump and displacement shaders.
Bump mapping simulates roughness by perturbing the surface normal at any given point on an object. An object with a bump map appears to have pits and gouges, but the actually underlying geometry is unchanged. The normals are bent in ways that make the surface appear to be bumpy. The silhouette of a bumped surface will be the same as the original surface, as shown in the image on the right. Bump mapping can be useful, but when it is desirable to perturb the actual geometry of a surface, the more expensive option, displacement, can be used.
One of the most interesting, powerful, and unique features of RenderMan is the ability to displace the surface geometry during shading. This allows the modeling of true dents, wrinkles, and other rough features which are only approximated by other techniques, such as bump maps. Since the geometry is actually moved by the displacement shader, not only the shading is changed, as in bump mapping, but the silhouette is changed and parts the surface can occlude other parts, just as they do in "real life." Displaced surfaces can also cast displaced shadows. Displacements can also be animated with interesting results. None of these effects can be achieved with bump mapping.
Displacements are sometimes tricky to use, however, and often lead to unexpected artifacts or performance problems. In particular, the fact that displacements are made to the surface geometry during the shading means that all of the code earlier in the rendering pipeline can only guess what the displacement might eventually be like. By following the guidelines presented here, it should be possible to eliminate most of the artifacts.
Displacement shaders are evaluated and applied to the surface of objects during the shading stage. In fact, the displacement shader is the first shader that is evaluated on a surface, so that the subsequent light, surface, and atmosphere shaders are operating on the correctly moved data. The problem is, of course, that the various geometric operations which operate on the original surface geometry before shading (for example, bounding boxes and size estimation) don't know how much (if at all) the surface will move under the displacement. Therefore, the mechanisms that exist to eliminate geometric artifacts like polygonal silhouettes are occasionally outsmarted by the displacement.
Here are some of the artifacts that can be seen, and some hints on how to avoid them.
Displacement Bounds
All objects have a bounding box associated with them. This bounding box determines when the object is loaded into memory by the renderer, and it is usually tightly bound to the object in question. However, displaced geometry can be pushed outside of that box, and RenderMan doesn't pay any attention to an object until it reaches a pixel inside an object's bounding box, so things that are displaced out of the box will get missed, leaving large holes in the object. The following images show the artifacts associated with poorly set displacement bounds:
The displacement bound should be bound to the furthest extent of possible displacement (e.g. If your displacement has an amplitude of "1," the displacement bound should similarly be set to "1"). If you make the displacement bound too small, the object will still fall outside the bounding box and pieces may still disappear. If you make the displacement bound too large, then the bounding box will be too big and RenderMan will do far too much work processing the primitive and use up lots of memory storing the pieces that were done too early. Now we can see why getting the getting reasonable amplitude control are so helpful: because with both of those in place, figuring out the correct bound is much easier!
With care, it is possible to use displacement shaders in RenderMan with no objectionable artifacts and with almost no speed penalty. The most critical parameter is the displacement bound. In most case, this parameter should be easy to calculate. Since displacement shaders operate independently of surface shaders, it is possible to displace surfaces made of any type of material. Clearly, displacement shaders are a powerful tool for making interesting and highly detailed photorealistic images.
For more information about creating displacements refer to the Displacements Tutorial.
Pixar Animation Studios
|