On this page |
Overview ¶
Deep camera maps are rendered images, where semi-transparent areas (such as volumes) between the camera and the nearest opaque surface are stored with depth information. Each pixel in the image is represented as a curve describing how the transparency value changes across the depth of the scene. This allows you to composite rendered images and have the semi-transparent areas blend correctly according to their depth.
Deep camera maps are useful for objects with high transparency across the object, such as swarms of sprites and clouds (volumes). You should render each such object as a separate DCM. DCMs let you render transparent objects separately from the objects that interact with them, allowing much more flexibility in compositing.
The main drawback of deep camera maps is high disk space overhead, given the amount of information stored per pixel. A 2K (2048×1080) DCM frame can typically take 1-2 GB of disk space, and the typical space budget for a shot might be 1 TB. Another drawback is that, since they are added in compositing, objects in DCMs cannot receive shadows.
Houdini only supports storing DCMs in the .rat
or .exr
texture file format. The same image can contain a deep camera map (depth per pixel information) and deep rasters (extra image planes).
How to ¶
To render a deep camera map, you must add two rendering properties to the camera or render driver node.
To... | Do this |
---|---|
Set up a camera or render output node to render as a DCM |
When you render, mantra will write out the DCM in addition to the output image. |
Customize trade-offs between accuracy and file size |
Several properties allow you to decrease depth compositing accuracy in order to reduce the size of DCM files. If the object in the DCM is not detailed or the distance between the near and far clipping planes is small, depth compositing accuracy is less important and these properties can be very useful.
|
Composite two rendered DCMs together |
Use the DSM Merge render node or the dsmmerge command line utility. |
Convert a DCM file into a flat image |
Use the DSM Flatten compositing node. |
Using deep maps in shaders ¶
In VOPs, see the Shadow Map VOP,
In VEX, you can use the teximport and dsmpixel functions to access deep pixel information from a deep map:
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]); } }