FAQ: Toon Rendering with SOFTIMAGE 3D and Mental Ray
  
PSS ID Number: Q176608
Article last modified on 11-13-1997
 
IRIX:3.7; WINNT:3.7
 
IRIX winnt
 

======================================================================
---------------------------------------------------------------------
The information in this article applies to:
 
 - Softimage 3D for IRIX, version 3.7
 - Softimage 3D for Windows NT, version 3.7
---------------------------------------------------------------------
 
SUMMARY
=======
 
This article covers Toon rendering with SOFTIMAGE 3D and mental ray. The
following questions are addressed:
 
1. What is Toon rendering?
2. What are Toon shaders?
3. What is the ToonAssistant?
4. If the ToonAssistant does all of this, why would I apply Toon material
   shaders manually when using the ToonAssistant?
5. What antialiasing settings should I use when Toon rendering?
6. Why is Toon rendering slower than normal rendering?
7. Are there any special modeling techniques I should use for Toon
   rendering?
8. Can I use mental ray's motion blur when Toon rendering?
9. Can I use mental ray's depth of field when Toon rendering?
10. How do I go about setting up materials for Toon rendering?
11. Where will ink lines show up?
12. What color(s) are used for the ink lines?
 
MORE INFORMATION
================
 
1. Q. What is Toon rendering?
 
1. A. Toon rendering with SOFTIMAGE 3D (SI3D) is a method of simulating cel
   animation (such as 2D or traditional animation) using 3D animation
   techniques; common characteristics of cel animation, such as contour
   lines, outlines, and solid color shading are all replicated. It is
   possible to render 3D models and animation so that the results are
   indistinguishable from images created using traditional cel
   techniques. Because the images you are imitating are produced using
   ink-and-paint techniques, you can refer to many of the 3D equivalents
   using similar terms: ink (instead of contour lines), paint (shading),
   etc.
 
2. Q. What are Toon shaders?
 
2. A. To create a Toon rendering, shaders are used. The mental ray renderer
   uses the shaders to achieve the ink and paint effects. Shaders, like
   plug-ins for other software, enhance the basic capabilities of mental
   ray. When Toon rendering, instead of shading models with Phong, Flat,
   or Lambert shading (the defaults), you can use Toon shading, for
   example, to create the flat color highlights and shadows on surfaces.
 
   There are two Toon shaders that are relied on most: a lens shader (for
   ink effects) and a material shader (for paint effects). These shaders
   work together to create a complete Toon rendering. The lens shader has
   a global control over ink: it allows control over line width, waviness,
   color, etc. The material shader, because it is applied to each
   individual model (or parts of a model if it is a polygonal mesh),
   allows local control of Toon rendering attributes; that is, local
   control of both the paint effect (size of highlight, style of
   highlight, etc.), and certain parameters of the ink used on each model
   (for example, each Toon material shader may specify a different line
   width, relative to the line width specified to the lens shader).
 
   Although you can use the material shader alone, without the lens shader
   the ink effects are not rendered. None of the lens shader's ink effects
   will render without the material shader applied to models so the two
   shaders are usually used together.
 
3. Q. What is the ToonAssistant?
 
3. A. The ToonAssistant is a plug-in for SI3D that offers a convenient
   interface for managing the shader applications (allows previews of the
   scene, and animation of the various rendering parameters). Using the
   ToonAssistant allows you to apply materials and textures as you
   normally would when using SI3D, then apply the Toon effects as a final
   step in rendering. It is not necessary to go through the tedious steps
   of applying shaders to each material, lens shaders to the camera, etc.
   When using the ToonAssistant, it is not necessary to apply the Toon
   lens shader, although there are particular models where it is useful to
   apply Toon material shaders manually.
 
4. Q. If the ToonAssistant does all of this, why would I apply Toon
   material shaders manually when using the ToonAssistant?
 
4. A. As mentioned before, there are certain properties local to each
   material that you can manipulate from the Toon material shader
   interface, such as object grouping, line width, etc. If the
   ToonAssistant produces satisfactory results, you will not need to use
   the Toon shaders. If, however, the results are unsatisfactory and it is
   necessary to tweak the ink-line width of only one model, then you can
   apply the Toon material shader to that one model and adjust the line
   width from the Toon material shader interface. When rendering with the
   ToonAssistant, all existing Toon material shaders are left untouched
   and their values are used to alter the rendering properties for the
   models to which they are applied.
 
4. Q. What antialiasing settings should I use when Toon rendering?
 
5. A. This depends on the results you want for the rendered images. Higher
   levels of antialiasing produce better results. Insufficient
   antialiasing is particularly noticeable where ink lines are drawn: the
   lines chatter during animation. (In some cases, the lines show the
   dreaded "jaggies".) If every other frame of the animation is rendered,
   then less antialiasing is required. The recommended settings are:
 
    - use mental ray's adaptive sampling algorithm. This minimizes wasted
      samples (on large empty areas of the frame).
 
    - for medium-quality work with decent lines (sufficient for
      broadcast), set Min Samples to -1 and Max Samples to 2. When higher
      quality is required (film applications), set Min Samples to 0 and
      Max Samples to 2. For print work, add the Gaussian filter with a
      width and height of 2 (this adds additional smoothness by blurring
      neighboring samples together, though rendering is much longer).
 
    - set low oversampling thresholds: perhaps 0.02, 0.02, 0.02. [This
      separates the SI3D Toon shaders from other similar rendering
      products. The algorithm SI3D used for ink lines is not post-
      processing (graphical edge, detection), but rather the ink lines are
      generated during the sampling stage, whereas post-processing filters
      are applied to finished pixels. SI3D ink lines are thus capable of
      resolving sub-pixel sized details in the model.]
 
6. Q. Why is Toon rendering slower than normal rendering?
 
6. A. The Toon lens shader does more sampling (for example, firing of rays)
   than mental ray's eye-ray casting. On average, Toon rendering requires
   that about five times the usual number of rays be fired from the camera
   to render a frame. This is offset a bit because the shading
   computations for Toon rendering are much simpler than those required by
   Phong shading. Also, because SI3D ink is rendered during the sampling
   process, there is no post-processing time to take into account. If
   multiple processors/machines are being used co-operatively, then the
   processing time for ink lines are divided among them (this is not be
   the case when post processing is employed to render contours).
   Nonetheless, rendering times are longer.
 
7. Q. Are there any special modeling techniques I should use for Toon
   rendering?
 
7. A. Toon rendering produces satisfactory results with most models. Most
   modelers prefer free-form surfaces (such as standard and NURBS patches)
   to polygonal meshes. Toon rendering of free-form surfaces results in
   very smooth surfaces. This is necessary in simulating cel animation
   because most cel-animated characters and objects are drawn with smooth
   surfaces.
 
   To insure perfectly smooth surfaces when using patches, you may specify
   that a surface be tessellated using a view-dependant method (such as
   how many pixels wide each triangle resulting from patch subdivision
   will appear). To set the subdivision method for any model, use
   Info->Selection. For groups of models, use Info->mental ray. Polygonal
   surfaces, on the other hand, will show irregular contours at the edge
   of highlights if care is not used to create the illusion of smoothness.
 
   When surfaces are smooth-shaded, such as with Phong and Lambert
   shading, discontinuities in surface curvature are mostly hidden by the
   shading itself, although there are limits here as well: If very large
   polygons are used, their flatness will become obvious. Unless a
   stylized cutout look is desired, polygon models look best when modeled
   with fairly high detail.
 
   When polygon modeling for Toon rendering, it is recommended that you
   set SI3D's display to show edge flag, and sometimes even surface
   normals. In addition, it may be necessary to raise the automatic
   discontinuity threshold higher than the default 60 degrees. Where edge
   flags or discontinuities are shown in the SI3D modeling interface, ink
   lines are drawn as well. (This is an advantage because it allows
   modeling of ink lines by toggling edge flags between adjacent
   polygons.) All of the Viewpoint polygonal models that come as gifts
   with Softimage 3D Toon render properly.
 
8. Q. Can I use mental ray's motion blur when Toon rendering?
 
8. A. Both ink and paint effects will motion blur. Expect much longer
   rendering times than without motion blur. (This is also the case when
   not using Toon shaders as well.)
 
9. Q. Can I use mental ray's depth of field when Toon rendering?
 
9. A. Yes. Both ink and paint effects can be rendered out of focus but you
   should expect longer rendering times. You may need to increase the
   level of antialiasing.
 
10. Q. How do I go about setting up materials for Toon rendering?
 
10. A. The simplest method is to apply materials as you would when setting
   up a scene to render with SI3D (the same rules apply: materials are
   inherited by children in a hierarchy, models without material are
   rendered using a default material, etc.). Then, without assigning any
   Toon shaders, use the ToonAssistant for the rest.
 
11. Q. Where will ink lines show up?
 
11. A. The Toon lens shader "inks" the rendering in a few places:
 
    - the outlines of objects (such as their silhouettes).
 
    - the intersection of different models.
 
    - discontinuities in models' surfaces (such as areas of high curvature
      or depth from the camera, edge flags, and automatic discontinuity on
      polygonal models).
 
    - between colors (an option only available through the Toon material
      shader interface).
 
12. Q. What color(s) are used for the ink lines?
 
12. A. With either the ToonAssistant or the Toon material shader, two basic
   options are available: You can use the ambient color assigned in the
   Material Editor for the ink lines or you can use a "custom" color. If
   the ToonAssistant is being used, it is best to set each material's
   ambient color to one appropriate for the ink lines on the model (or
   collection of polys) to which the material is applied. Then, in the
   ToonAssistant's Ink Color tab, make sure you choose Material Ambient for
   the Ink color. This allows each model to have its own ink color, as set
   in the Material Editor.
 
   In certain cases, it may be desirable to use the custom ink-color
   swatch/sliders in the Toon material shader interface (or, alternately,
   ToonAssistant Ink Color tab), for example, if the material's ambient
   color is required to render shadows falling on a surface. In this case,
   unless you are using the same ink color for all models, use the Toon
   material shader interface. In either case, in addition to the basic
   color set for ink lines, there are options in both ToonAssistant and
   Toon material shader interfaces for drawing the outlines in a
   brighter/darker and less/more-saturated color than that used for
   internal contours. There are also options for modifying the color of ink
   lines based on whether the ink line being drawn is in or out of shadow.
 
REFERENCES
==========
 
If you have any questions concerning the information contained in this
article, contact support@softimage.com by e-mail.
 
Additional query words: si si3d si3dren si3dmr
======================================================================
Keywords          : si si3d si3dmr si3dren
Version           : IRIX:3.7; WINNT:3.7
Platform          : IRIX winnt
Issue type        : kbinfo
=============================================================================
Copyright Microsoft Corporation 1997.