Viewing the rendering mesh

Air renders most geometric primitives as meshes of polygons.  Viewing the rendering mesh can sometimes help diagnose errors or optimize rendering, whether the mesh is a polygon mesh provided as input or the result of tessellating a smooth surface primitive.

You can use Air’s outline capability to view the individual polygons in a mesh:

One way Air detects edges for outlines is based on a toon id value that is assigned to each element.  By default each geometric primitive is assigned a unique id.  Where two primitives abut in the rendered image, the toon id value changes, and Air will draw an outline.

The toon id for an object can be explicitly specified with:

Attribute "toon" "float id" [n]

If the toon id is set to the special value -2, Air automatically assigns a unique id to each face in the rendering mesh.

So to view the rendering mesh, we just need to enable outlines and to set the toon id to -2 for the objects whose mesh we wish to view.  We can do that by placing a few commands in a small text file:

Option "toon" "maxinkwidth" [0.5]
Attribute "toon" "inkwidth" [0.5]
Attribute "toon" "float id" [-2]

Save the above commands to a file named viewmesh.rib.  Then render with:

air -d viewmesh.rib myscene.rib

We can achieve the same result using a couple of Air’s command line options:

air -d -inkw 0.5 -at toon id -2 myscene.rib

Here are a few images showing the effect of adjusting the flatness tessellation criterion for a blobby object (from 8 to 4 to 2).

This entry was posted in Outlines and tagged , . Bookmark the permalink.

Comments are closed.