3D Lingo Dictionary > A-B > blendFunction |  |

blendFunction

Syntax

    member(whichCastmember).shader(whichShader).blendFunction
    member(whichCastmember).model(whichModel).shader.blendFunction
    member(whichCastmember).model(whichModel).shaderList{[index]}.blendFunction

Description

3D `#standard` shader property; indicates the type of blending used by the first texture layer of the shader.

If the shader's `useDiffuseWithTexture` property is set to `TRUE`, the texture blends with the color set by the shader's `diffuse` property. If `useDiffuseWithTexture` is `FALSE`, white is used for blending.

Each of the other texture layers blends with the texture layer below it. Use the `blendFunctionList` property to control blending in those texture layers.

The `blendFunction` property can have the following values:

`#multiply` multiplies the RGB values of the texture layer by the color being used for blending (see above).

`#add` adds the RGB values of the texture layer to the color being used for blending, and then clamps to 255.

`#replace` prevents the texture from being blended with the color set by the shader's `diffuse` property.

`#blend` combines the colors of the texture layer with the color being used for blending in the ratio set by the `blendConstant` property.

The default value of this property is `#multiply`.

Example

In this example, the shader list of the model named MysteryBox contains six shaders. This statement sets the `blendFunction` property of the second shader to `#blend`. This enables the settings of the `blendSource`, `blendSourceList`, `blendConstant`, and `blendConstantList` properties.

    member("Level2").model("MysteryBox").shaderList[2].blendFunction = #blend

See also

`blendConstant`, `blendConstantList`, `blendFunctionList`, `blendSource`, `blendSourceList`, `useDiffuseWithTexture`, `diffuse`, `diffuseColor`