Class IllumParams

3DS Max Plug-In SDK

Class IllumParams

See Also: Class Shader, Class Point3, Class Color.

class IllumParams : public BaseInterfaceServer

Description:

This class is available in release 3.0 and later only.

This class allows the Standard material to get the parameters from a Shader plug-in. It also allows the Shader to supply its computed color data back to the Standard material. The Standard material will handle the texturing but it needs to know the color before the texturing is done.

The shader object holds some raw parameters. But these parameters may be textured. So for each pixel that will be shaded, the 3ds max shade routine asks the shader to fill in the raw values. Then it applies the texture over the top of any of the values which are textured.

Data Members:

public:

Shader* pShader;

This parameter is available in release 4.0 and later only.

A pointer to the shader.

Mtl* pMtl;

This parameter is available in release 4.0 and later only.

A pointer to the material being shaded or NULL if it’s a background.

Color channels[32];

A color channel for each of the possible parameters that may be textured. Note that these channels don't have specific meanings. They are defined by each Shader. The Shader tells the Standard material what data is in these channels using its ChannelType() and StdIDToChannel() methods.

float falloffOpac;

Shaders using standard opacity can ignore this data member. This is available for certain Shaders which don't use the standard 3ds max transparency equation. This allows these Shaders to simulate the 3ds max version. This is the pre-computed textured opacity with standard falloff applied. The value here is pre-computed to consider all the standard opacity settings of falloff direction, etc. The standard transparency computation then uses this after shading. So a shader could modify this value if it wanted to to affect the transparency.

Note: The regular opacity can be obtained from the channel data.

float kR;

This value is used when there is a reflection and an atmosphere present. Normally if there is no atmosphere (for instance no Fog in the scene) then the transparency of the reflection is 100% (it is unaffected). However, if there is an atmosphere present it will impart some level of opacity. This opacity (alpha value) is not available via the reflection color. Thus this data member is here to provide this opacity information to the Shader.

This value is the alpha which is returned by the reflection query that has the transparency of the atmosphere contained within it, which is then multiplied by the Amount spinner. This can then be used either by the Shader or by the standard handling for reflection maps.

ULONG hasComponents;

These are the bits for the active components of bump, reflection, refraction and opacity mapping. If the bit is set that component is active. This provides a quick way for a Shader to check if they're used (as opposed to looking through the channels array searching for these channel types).

HAS_BUMPS -- If bump mapping is present this is set.

HAS_REFLECT -- If there is any kind of reflection (raytraced, etc) then this is set.

HAS_REFRACT -- If there is any kind of refraction then this is set..

HAS_OPACITY -- If opacity mapping is used this is set.

HAS_REFLECT_MAP -- If there is a reflection map only this is set. This is used by the Straus shader for example. If it sees a reflection map present it dims the diffuse channel.

HAS_REFRACT_MAP -- If there is a refraction map only then this is set.

ULONG stdParams;

The standard parameter bits. See List of Shader Standard Parameter Flags. This is filled in by the Standard material.

Color ambIllumOut;

This is the ambient output from the Illum() method.

Color diffIllumOut;

This is the diffuse output from the Illum() method.

Color transIllumOut;

This is the transparency output from the Illum() method.

Color selfIllumOut;

This is the self illumination output from the Illum() method.

Color specIllumOut;

This is the specular illumination output from the Illum() method.

Color reflIllumOut;

This is the reflection output from the Illum() method. Certain shaders may wish to store the reflection output here (as opposed to providing it in the channels array). This is the '"raw " color from the direction of reflection (unattenuated). Some combiner implementations (Shader::CombineComponents())can get the reflection data here, others may get it from the channels.

float diffIllumIntens;

Used only by reflection dimming, intensity of diffIllum prior to color multiply.

float finalAttenuation;

The final attenuation for combining components.

float finalOpac;

This is the final opacity value used for combining components together in Shader::CombineComponents().

Color finalC;

This is the final output color that the Shader::CombineComponents() composites together.

Color finalT;

This is the final Shader transparency color output.

Methods:

public:

Prototype:

void ClearOutputs();

Remarks:

This method is called by the Standard material prior to calling the Illum() method of the Shader. It sets to black all the output colors:

ambIllumOut=diffIllumOut=transIllumOut=selfIllumOut=

 specIllumOut=reflIllumOut=Color(0.0f, 0.0f, 0.0f);