3D Lingo Dictionary > O-S > shader |  |

shader

Syntax

    member(whichCastmember).shader(whichShader)
    member(whichCastmember).shader[index]
    member(whichCastmember).model(whichModel).shader
    member(whichCastmember).modelResource(whichModelResource).face[index].shader

Description

3D element, model property, and face property; the object used to define the appearance of the surface of the model. The shader is the "skin" which is wrapped around the model resource used by the model.

The shader itself is not an image. The visible component of a shader is created with up to eight layers of `texture`. These eight texture layers are either created from bitmap cast members or image objects within Director or imported with models from 3D modeling programs. See `texture` for more information.

Every model has a linear list of shaders called the `shaderList`. The number of entries in this list equals the number of meshes in the model resource used by the model. Each mesh can be shaded by only one shader.

The 3D cast member has a default shader named `DefaultShader` which cannot be deleted. This shader is used when no shader has been assigned to a model and when a shader being used by a model is deleted.

The syntax `member(``whichCastmember``).model(``whichModel``).shader` gives access to the first shader in the model's `shaderList`, and is equivalent to `member(``whichCastmember``).model(``whichModel``).shaderList[1]`.

Create and delete shaders with the `newShader()` and `deleteShader()` commands.

Shaders are stored in the shader palette of the 3D cast member. They can be referenced by name (`whichShader`) or palette index (`shaderIndex`). A shader can be used by any number of models. Changes to a shader will appear in all models which use that shader.

There are four types of shaders:

`#standard` shaders present their textures realistically.

`#painter`, `#engraver`, and `#newsprint` shaders stylize their textures for painting, engraving, and newsprint effects. They have special properties in addition to the `#standard` shader properties.

See the 3D Lingo by Feature section for a complete list of shader properties.

The shaders used by individual faces of `#mesh` primitives can be set with the syntax `member(``whichCastmember``).modelResource(``whichModelResource``).face[``index``].shader`. Changes to this property require a call to the `build()` command.

Example

This statement sets the shader property of the model named Wall to the shader named WallSurface.

    member("Room").model("Wall").shader = member("Room").shader("WallSurface")

See also

`shaderList`, `newShader`, `deleteShader`, `face`, `texture`