RiMel - Menger3d

return to main index


Figure 1


This tutorial presents five scripts that implement an interface that enables a polycube to be rendered as a Menger sponge - figure 1. Two of the scripts are taken from the tutorial, Python: Menger Sponge.

Figure 2 - Menger UI

Step 1 - Install the Scripts

It is assumed the reader has followed the recommendations on customizing RenderMan for Maya presented in the tutorial, "RfM: Customizing".

Download and unzip menger3d.zip and move,
    menger3d.py, and
to your maya/projects/RfM_python directory.
    Menger3dUI.mel, and
to your maya/projects/RfM_mel directory.

Step 2 - Using the Scripts

Launch Maya and check the RenderMan_for_Maya plugin is loaded.
    - create a (1x1x1 divisions) poly cube,
    - deselect, then re-select the cube,
    - execute the folloiwng mel command Menger3dUI();
    - toggle the transform and shape tabs in the attribute editor.
The interface, figure 2, should appear in the shape tab of the polycube. Assign a RIS material to the polycube and render.

Step 3 - To Menger or Not to Menger

A great variety of Menger-like shapes can be created by specifying the indices of the cubes to be removed when the Menger is recursively sub-divided. The scripts have been written so that the cubes that have been removed - the Menger "holes" - can be rendered using the "Menger Style" dropdown menu. For example, the following "Deleted Cubes" indices,
generated the positive and negative Mengers shown below.

Figure 3

© 2002- Malcolm Kesson. All rights reserved.