Introduction — continued
![]() Top: Pixar's Photorealistic RenderMan renderer Bottom: Peercy & co.'s multi-pass OpenGL renderer |
Peercy's paper demonstrated precisely how to translate complex codein this case, those of the RenderMan Shading Language used at places like Pixarinto OpenGL rendering passes using a compiler. The compiler would accept RenderMan shading programs and output OpenGL instructions. In doing so, Peercy was treating the OpenGL graphics accelerator as a general SIMD computer. (SIMD, or Single Instruction Multiple Data, is the computational technique employed by CPU instruction set extensions like MMX and SSE. SIMD instructions perform the same operation on entire matrices of data simultaneously.) If you know a little bit about CPUs and a little bit about graphics, the notion makes sense as Peercy explains it:
One key observation allows shaders to be translated into multi-pass OpenGL: a single rendering pass is also a general SIMD instructionthe same operations are performed simultaneously for all pixels in an object. At the simplest level, the framebuffer is an accumulator, texture or pixel buffers serve as per-pixel memory storage, blending provides basic arithmetic operations, lookup tables support function evaluation, the alpha test provides a variety of conditionals, and the stencil buffer allows pixel-level conditional execution. A shader computation is broken into pieces, each of which can be evaluated by an OpenGL rendering pass. In this way, we build up a final result for all pixels in an object.Peercy goes on to explain how the OpenGL "computer" handles data types, arithmetic operations, variables (which are stored in textures) and flow control. It's heady stuff, and it works. Peercy's demonstration compiler was able to produce output nearly identical to RenderMan's built-in renderer.
Peercy compiled RenderMan Shading Language to OpenGL, but the same principle could be applied to other high-level shading languages and other graphics APIs, like Direct3D. The implications were simple but powerful: this method would enable consumer graphics chips to accelerate the rendering of just about "anything." Even if the graphics chips couldn't handle all the necessary passes in real time, they could generate the same ouput far faster than even the speediest general-purpose microprocessor.
| Friday night topic: The trouble with Best Buy | 145 |