User Guide
useDiffuseWithTexture 1071
Example
This toggles the alpha channel of cast member “foreground” on and off:
-- Lingo syntax
member("foreground").useAlpha = not(member("foreground").useAlpha)
// JavaScript syntax
switch(member("foreground").useAlpha) {
case 0:
member("foreground").useAlpha = 1;
break;
case 1:
member("foreground").useAlpha = 0;
break;
}
useDiffuseWithTexture
Usage
member(whichCastmember).shader(whichShader).useDiffuseWithTexture
Description
3D standard shader property; allows you to get or set whether the diffuse color is used to
modulate the texture (
TRUE) or not (FALSE).
When set to
TRUE, this property works in conjunction with the blendFunction and
blendConstant properties: when blendFunction is set to #blend, the diffuse color is weighed
with the texture color to determine the final color. For example, if
blendFunction is set to
#blend, and
blendConstant is set to 100.0, the final color is the pure texture color. If we change
blendConstant to 0.0, the final color is the diffuse color. If we change blendConstant to 10.0,
the final color is 10% texture color, and 90% diffuse color.
The default value for this property is
FALSE.
All shaders have access to the
#standard shader properties; in addition to these standard shader
properties shaders of the types
#engraver, #newsprint, and #painter have properties unique to
their type. For more information, see
newShader.
Example
In this example, the shaderList of the model MysteryBox contains six shaders. Each shader has
a texture list which contains up to eight textures. The
diffuseColor property of the cast member
(Level2) is set to rgb(255, 0, 0). The blendFunction property of all six shaders is set to #blend,
and the blendConstant property of all six shaders is set to 80. This statement sets the
useDiffuseWithTexture property of all shaders used by MysteryBox to TRUE. A little bit of
red will be blended into the surface of the model. This property is affected by the settings of the
blendFunction, blendFunctionList, blendSource, blendSourceList, blendConstant, and
blendConstantList properties.
member("Level2").model("MysteryBox").shaderlist.useDiffuseWith\
Texture = TRUE
See also
blendFunction, blendConstant