7.11 Rendering Outlines for Illustrations
3Delight has advanced "inking" features for "toon rendering" and other illustration purposes. This is implemented using edge detection algorithms in image space. All edge detection features are controlled through parameters to the RiDisplay
call. Since 3Delight can output many such displays in one render, it becomes possible to output different edge detection results into different files or framebuffers. For example, one display can output edge detection based on depth variation and another one on surface normals variation.
Oi (opacity) and z (depth). Note how outlines get thinner with distance. Example scene available in `$DELIGHT/examples/toon'. |
Additionally, it is possible to output, in the same display, edges detected on many variables at once (such as depth, normals and any other surface variable).
Table 7.1 contains the list of all edge detection parameters accepted by RiDisplay
.
|
At least edgevariables
and edgethreshold
must be specified to enable edge rendering. It works by looking for abrupt variations of one or more output variables over the image. For example, rendering outlines based on changes in depth would be done with:
Declare "outline" "color" Quantize "outline" 255 0 255 0.5 Display "depth_outline.tif" "tiff" "outline" "string edgevariables" "z" "float edgethreshold" 0.1 "float edgefilterwidth" 1.5
The Declare
command specifies an aribitrary output variable which is used as a placeholder for edge data. A Quantize
command is used to specify that the output is to be 8-bit. Variables specified with edgevariables
(in this case only 'z') are the ones processed to detect edges.
It is possible to use any predefined or user-defined output variable to control the presence of outlines. It is also possible to process more than one variable in the same image. For example, to emphasize the contour of the object in the previous example we would use:
Declare "outline" "color" Quantize "outline" 255 0 255 0.5 DisplayChannel "N" "float edgefilterwidth" 1 "float edgethreshold" 0.3 DisplayChannel "Oi" "float edgefilterwidth" 2.5 "float edgethreshold" 0.1 "color edgecolor" [1 0.3 0.3] Display "mixed_outline.tif" "tiff" "outline" "string edgevariables" "N,Oi"
Notice that this time we base most of the edge detection on normals instead of depth. Which is better depends on the scene involved and the goals of the artist.
Finally, 3Delight allows basic compositing of detected edges over any output variable. For example, to see what the edges would look like over the normal image:
DisplayChannel "N" "float edgefilterwidth" 2 "float edgethreshold" 0.3 "color edgecolor" [0 0 0] Display "cheesy.tif" "tiff" "rgb" "string edgevariables" "N"
3Delight 10.0. Copyright 2000-2011 The 3Delight Team. All Rights Reserved.