return to main index


    RifPlugin Wireframe.cpp source code.


The RifPlugin presented here will render polymesh geometries as wireframes. It does so by using the (reorderd) "P" vertex data of the mesh as the "P" control vertex data of a number of curves "packaged" into a single RiCurves geometric primitive. By assigning a custom attribute to each polymesh one of three effects can be achieved, namely,
    Attribute "user" "int wireframe" [0] mesh only
    Attribute "user" "int wireframe" [1] curves only (default)
    Attribute "user" "int wireframe" [2] mesh & curves

Figure 1 Rollover
With and without wireframe rendering

The width (diameter) of the curves can be set as a "Rif Arg".

Figure 2

Compiling the RifPlugin

Follow the instructions in the tutorial,
    "Cutter: Compiling and Building Plugins"

Assinging the Custom Attribute

If all the polymesh surfaces in a scene are to be represented as wireframes there is no need to assign a custom attribute. Only polymesh geometries that are either to be rendered "normally" OR are to be rendered as a polymesh + wireframe require the use of a custom attribute.

Go to the shape tab of a polymesh add "Manage Attributes...".

Figure 3

From the list of available attributes choose "Pre Shape MEL".

Figure 4

In the "Pre Shape MEL" text field enter the following MEL command,
    RiAttribute("user", "int wireframe", 2);
A value of 0 will indicate to the RifPlugin the mesh should be rendered normally.
A value of 1 will indicate to the RifPlugin the mesh should be rendered as a wireframe.
A value of 2 indicates that both normal and wireframe rendering are required.

Figure 5

Finally, render the scene - welcome to the 1970's!

© 2002- Malcolm Kesson. All rights reserved.