21.2. RenderManIn 1988, after several years of development, Pixar published the RenderMan Interface Specification. This was an interface intended to define the communications protocol between modeling programs and rendering programs aimed at producing images of photorealistic quality. The original target audience for this interface was animation production, and the interface has proved to be very successful for this market. It has been used as the interface for producing computer graphics special effects for films such as Jurassic Park, Star Wars Episode 1: The Phantom Menace, The Lord of the Rings: The Two Towers, and others. It has also been used for films that have been done entirely with computer graphics such as Finding Nemo, Toy Story, A Bug's Life, and Monsters, Inc. One of the main differences between the OpenGL Shading Language and RenderMan is that RenderMan attempts to define the entire interface between modeling programs and rendering programs. It provides an entire graphics processing pipeline of its own that has no relationship to OpenGL. Although a hardware implementation was envisioned at the time RenderMan was first defined, it was primarily designed as a high-quality, realistic rendering interface; therefore, it provides no compromises for interactivity or direct hardware implementation on today's graphics hardware. RenderMan includes support for describing geometric primitives, hierarchical modeling, stacking geometric transformations, camera attributes, shading attributes, and constructive solid geometry. OpenGL already provides many of these capabilities; therefore, they need not be addressed in the OpenGL Shading Language. Figure 21.1. RenderMan execution environment
Of particular interest, however, is the portion of RenderMan called the RenderMan Shading Language. This language completely describes arbitrary shaders that can be passed to a renderer through the RenderMan interface. This language was also based on C, and as such, it bears some resemblance to the OpenGL Shading Language. In a general way, the RenderMan interface is similar to OpenGL, and the RenderMan Shading Language is similar to the OpenGL Shading Language. The RenderMan interface and OpenGL both let you define the characteristics of a scene (viewing parameters, primitives to be rendered, etc.). Both shading languages compute the color, position, opacity, and other characteristics of a point in the scene. One of the main differences between the OpenGL Shading Language and the RenderMan Shading Language is in the abstraction of the shading problem. The OpenGL Shading Language closely maps onto today's commercial graphics hardware and has abstracted two types of shaders so far: vertex shaders and fragment shaders. The RenderMan Shading Language has always had uncompromising image quality as its fundamental goal, and it abstracts five shader types: light shaders, displacement shaders, surface shaders, volume shaders, and imager shaders. The RenderMan shader types lend themselves to the implementation of high-quality software rendering implementations, but they do not match up as well with hardware that has been designed to support interactive rendering with OpenGL. As a result, RenderMan implementations have typically been software based, but attempts to accelerate it in hardware have been made (read Interactive Multi-Pass Programmable Shading by Peercy, Olano, Airey, and Ungar, 2000). The OpenGL Shading Language was designed from the beginning for acceleration by commodity graphics hardware. There are some differences in the data types supported by the two languages. RenderMan supports native types that represent colors, points, and normals, whereas the OpenGL Shading Language includes the more generic vectors of 1, 2, 3, or 4 floating-point values that can support any of those. RenderMan goes a bit further in making the language graphics-specific by including built-in support for coordinate spaces named object, world, camera, NDC, raster, and screen. RenderMan supports a number of predefined surface shader variables, light source variables, volume shader variables, displacement shader variables, and imager shader variables. The OpenGL Shading Language contains built-in variables that are specific to OpenGL state values, some of which are similar to the RenderMan predefined variables. Because it is aimed at producing animation, RenderMan also has built-in variables to represent time. The OpenGL Shading Language does not, but such values can be passed to shaders through uniform variables to accomplish the same thing. On the other hand, the two languages have much in common. In a very real sense, the OpenGL Shading Language can be thought of as a descendant of the RenderMan Shading Language. The data type qualifiers uniform and varying were invented in RenderMan and have been carried forward to mean the same things in the OpenGL Shading Language. Expressions and precedence of operators in both languages are very much like C. Keywords such as if, else, while, for, break, and return are the same in both languages. The list of built-in math functions for the OpenGL Shading Language is largely similar to the list of built-in math functions for the RenderMan Shading Language. |