Standard shadow maps
Ordinary shadow maps are 2D images rendered from a light. The value of each pixel in the image represents the distance to the nearest surface. Once Houdini renders the shadow map once, it can use it to figure out which surfaces are visible to the light, and which are in shadow.
Deep shadow maps are 2.5D texture maps rendered from a light. In a deep shadow map, each pixel stores multiple values, representing the cumulative opacity of each surface the light ray hit. So, unlike an ordinary shadow map which only stores the closest surface, mantra can use a deep shadow map to properly calculate shadows cast by translucent surfaces.
Houdini creates deep shadow maps when you turn on the Transparent shadows checkbox on the Shadows tab of the light.
Deep camera maps
Deep camera maps are useful for rendering beauty images rendered from a camera.
Deep camera maps work similarly to deep shadow maps, but each pixel stores multiple “channels” of information for each surface “hit” by the light ray.
A standard deep shadow map (DSM) stores two channels per “record” (hit surface): The Pz channel stores the z-depth associated with the record, and the Of channel stores the cumulative opacity at that z-depth. A deep camera map, in addition to the Pz and Of channels, stores all deep raster planes for each Z-record.
Because a DCM stores color, opacity, and depth, you can use it to render out scenes with transparency (such as volumes) and then composite the rendered DCMs together with correct depth compositing.
Rendering deep camera maps
To render a deep camera map, you must add two rendering properties to the camera or render driver node.
Select the camera or render driver node.
In the parameter editor, click the
Gear menu and choose Edit rendering parameters.
In the tree sub-pane on the left, open the Mantra folder, then Output.
In the Output folder, right click Deep Resolver (`vm_deepresolver`) and choose Install parameters. Do the same thing with DCM Filename (`vm_dcmfilename`).
This adds the Deep Resolver and DSM filename parameters to the node’s parameter interface.
Click Accept.
Click the Output tab. On a render driver node, Output is a sub-tab of Properties.
Set the Deep Resolver parameter to Deep Camera Resolver. Set the DSM filename to the name of the RAT file you want to save the into, for example
$HIP/textures/$OS_$F_dcm.rat.(
$HIPis the directory containing the current file.$OSis the name of the current node.$Fis the frame number.)When you render, mantra will write out the DCM in addition to the output image.
Working with deep maps
To composite two rendered DSMs together, use the DSM Merge render node or the dsmmerge command line utility.
Use the DSM Flatten compositing node to convert a DSM/DCM into a flat 2D image.
Using deep maps in shaders
In VOPs, see the Shadow Map VOP,
In VEX, see teximport, shadowmap, and dsmpixel. For example:
cvex dsminfo(string map="foo.rat") { string names[], name; float Pz[]; vector Of[]; vector res; int x, y; if (teximport(map, "texture:resolution", res)) printf("%s resolution: %g\n", map, res); teximport(map, "texture:channelnames", names); printf("%d channels:\n", arraylength(names)); foreach (name; names) printf("\t'%s'\n", name); x = res[0] * .5; y = res[1] * .5; if (dsmpixel(map, "Pz", x, y, Pz) && dsmpixel(map, "Of", x, y, Of)) { int i, n; n = arraylength(Pz); printf("Depth complexity[%d,%d] = %d\n", x, y, n); for (i = 0; i < n; i++) printf("\tZ=%g, Of=%g\n", Pz[i], Of[i]); } }