Material Methods

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

AddMaterialToLayer

Adds a material to a layer.

AddMaterialToObject

Adds a material to an object.

CopyMaterial

Copies a material's definition to another material.

IsMaterial

Verifies the existence of a material in the document.

IsMaterialDefault

Verifies that a material is a default material

IsMaterialReference

Verifies that a material is a reference material.

MatchMaterial

Matches the material of one object to another.

MaterialBump

Returns or modifies a material's bump map.

MaterialColor

Returns or modifies a material's color.

MaterialCount

Returns the number of materials in the document.

MaterialEnvironmentMap

Returns or modifies a material's environment map.

MaterialId

Returns the identifier of a material given the material's index.

MaterialIds

Returns the identifiers of all material in the document.

MaterialIndex

Returns the index of a material given the material's identifier.

MaterialIndices

Returns the indices of all material in the document.

MaterialName

Returns or modifies a material's name.

MaterialReflectiveColor

Returns or modifies a material's reflective color.

MaterialsByColor

Returns all materials of a specified diffuse color.

MaterialsByName

Returns all materials of a specified name.

MaterialShine

Returns or modifies a material's shine quality.

MaterialTexture

Returns or modifies a material's texture map.

MaterialTransparency

Returns or modifies a material's transparency quality.

MaterialTransparencyMap

Returns or modifies a material's transparency map.

ResetMaterial

Resets a material to Rhino's default material.