This tutorial provides a number of scripts suitable for writing geometric and shading data to a
that can be subsequently rendered as a geometric primitive. Using brickmaps as
geometry is a technique ideally suited to situations where surfaces are rendered using
computationally expensive techniques.
Baking a brickmap from a scene that is rendered without raytracing is straightforward. However, when raytracing it is essential the "Hider" is "reyes", figure 1, and geometry is set to single sided - figure 2.
Ordinarily, baking brickmaps and subsequently using them as geometric primitives involves a rather cumbersome sequence of operations. The motivation for preparing the scripts presented by this tutorial is to reduce the "bake-and-serve" workflow to a couple of mouse clicks. The tricky part is ensuring the scripts are installed correctly and the two shaders (listings 1 & 2) are compiled and their .slo files are copied to the project directory that contain the Maya scene files.
Download and unzip scripts.zip file. It contains all the scripts and shaders used by this tutorial.
Move the following four scripts to the directory that RMS sources at startup.
Step 3 - Preparing the Scene
Launch Maya, set the project directory and open the scene to be used for baking a brickmap. Hide all the objects except for the "target" surfaces that are intended to be baked into the brickmap. Make sure RenderMan is the chosen renderer and the "target" object is tightly framed by the camera. Ensure the shaders assigned to the geometry have their specularity set to zero. Make a note of the dimensions of the object being baked. The quality of the brickmap will depend on the frame size, shading rate and a value know as "maxerror".
Step 4 - Baking the Brickmap
Open the script editor and use the following command to render and bake the brickmap.
The proc parameter, in this example 0.002, sets the "maxerror" when a temporarty pointcloud
generated by PRMan is converted by a utility program called "brickmake" to the final brickmap.
Rendering will begin immediately and at its conclusion the data directory should contain a
brickmap. The mel proc takes care of,
Step 5 - Resolving Errors
If Maya cannot find the procedure use these commands,
source "/PATH_TO/bakeGeoBrickmap.mel"; bakeGeoBrickmap(0.002);
Step 6 - Viewing the Brickmap
To view the brickmap open a terminal, cd to the data directory and use this command,
Step 7 - Using the Brickmap
Begin a new Maya scene. Make sure the scene is saved and the project directory has been set. Create a polygon cube with dimensions that match those of the object that was baked. If the cube is scaled make sure that "Freeze Transforms" is applied to it. Select the cube and in the script window enter this command.
Toggle the transform and shape tabs of the attribute window. A new panel titled
"Extra RenderMan Attributes" will appear in the lower part of the shape tab -
Use the browse button and locate the brickmap. By default the brickmap will be rendered,
without raytracing, using the material assigned to the cube (proxy object).
The blobby was baked as a brickmap and assigned to 8 proxy cubes, figure 5.
The 8 proxies used the barebones shader given in listing 1; the "floor" was assigned RMSGPMatte. A spherical geo area light illuminated the "floor". Total rendering time, including the depth-of-field, was 2 min 28 sec. With the floor, area light and raytracing turned "off" a single instance of a blobby brickmap took 9 seconds to render!
Listing 1 (barebones.sl)
© 2002- Malcolm Kesson. All rights reserved.