Rhino rendering materials are stored in a material table, or array in the Rhino document. Thus, Rhino objects and layers maintain a material index which identifies which material in the table to use when rendering.
If ObjectMaterialIndex or LayerMaterialIndex returns a material index of -1, then the object or layer does not have a material. When objects and layers are created in Rhino, they are assigned a material index of -1 to denote they will just use Rhino's default (read-only, non-modifiable) material. This saves system memory for those who want to model in Rhino but never need render a scene.
When you want to modify an object's or layer's material property, you first need to make sure that the object or layer has a material. If it does not, use AddMaterialToObject or AddMaterialToLayer to add one. Note, when you use the Properties or Layers window to modify material properties, the before mentioned is done for you automatically.
The following methods are available for creating, querying or manipulating object and layer rendering materials.
Method |
Description |
Adds a material to a layer. |
|
Adds a material to an object. |
|
Copies a material's definition to another material. |
|
Verifies the existence of a material in the document. |
|
Verifies that a material is a default material |
|
Verifies that a material is a reference material. |
|
Matches the material of one object to another. |
|
Returns or modifies a material's bump map. |
|
Returns or modifies a material's color. |
|
Returns the number of materials in the document. |
|
Returns or modifies a material's environment map. |
|
Returns the identifier of a material given the material's index. |
|
Returns the identifiers of all material in the document. |
|
Returns the index of a material given the material's identifier. |
|
Returns the indices of all material in the document. |
|
Returns or modifies a material's name. |
|
Returns or modifies a material's reflective color. |
|
Returns all materials of a specified diffuse color. |
|
Returns all materials of a specified name. |
|
Returns or modifies a material's shine quality. |
|
Returns or modifies a material's texture map. |
|
Returns or modifies a material's transparency quality. |
|
Returns or modifies a material's transparency map. |
|
Resets a material to Rhino's default material. |