This reference page is linked to from the following overview topics: Rendering Plug-ins, Plug-in Base Classes.
Used by developers to create Shader plug-ins.
The methods of this class must be implemented to provide data to the 3ds Max interactive renderer. This will let that renderer to properly reflect the look of the shader in the viewports. The methods associated with the actual Shader illumination code are from the base class BaseShader. There are various Get and Set methods defined in this class. Plug-in developers provide implementations for the 'Get' methods which are used by the interactive renderer. The implementations of the 'Set' methods are used when switching between shaders types in the Materials Editor. This is used to transfer the corresponding colors between the old Shader and the new one. Note that some shaders may not have the exact parameters as called for in the methods. In those case an approximate value may be returned from the 'Get' methods. For example, the Strauss Shader doesn't have an Ambient channel. In that case the Diffuse color is taken and divided by 2 and returned as the Ambient color. This gives the interactive renderer something to work with that might not be exact but is somewhat representative.
#include <shaders.h>
Public Member Functions |
|
virtual void | CopyStdParams (Shader *pFrom)=0 |
Copies the standard shader parameters from
pFrom to this object. |
|
virtual void | SetLockDS (BOOL lock)=0 |
Sets the state of the Diffuse/Specular lock
to on or off. |
|
virtual BOOL | GetLockDS ()=0 |
Returns the Diffuse/Specular lock'. |
|
virtual void | SetLockAD (BOOL lock)=0 |
Sets the state of the Ambient/Diffuse lock
to on or off. |
|
virtual BOOL | GetLockAD ()=0 |
Returns the Ambient/Diffuse lock. |
|
virtual void | SetLockADTex (BOOL lock)=0 |
Sets the state of the Ambient/Diffuse
Texture lock to on or off. |
|
virtual BOOL | GetLockADTex ()=0 |
Returns the Ambient/Diffuse Texture lock.
|
|
virtual void | SetSelfIllum (float v, TimeValue t)=0 |
Sets the Self Illumination parameter to the
specified value at the time passed as TimeValue. |
|
virtual void | SetSelfIllumClrOn (BOOL on)=0 |
Sets the Self Illumination Color On/Off state. |
|
virtual void | SetSelfIllumClr (Color c, TimeValue t)=0 |
Sets the Self Illumination Color at the specified time. |
|
virtual void | SetAmbientClr (Color c, TimeValue t)=0 |
Sets the Ambient Color at the specified time. |
|
virtual void | SetDiffuseClr (Color c, TimeValue t)=0 |
Sets the Diffuse Color at the specified time. |
|
virtual void | SetSpecularClr (Color c, TimeValue t)=0 |
Sets the Specular Color at the specified time. |
|
virtual void | SetGlossiness (float v, TimeValue t)=0 |
Sets the Glossiness parameter to the
specified value at the time passed. |
|
virtual void | SetSpecularLevel (float v, TimeValue t)=0 |
Sets the Specular Level parameter to the
specified value at the time passed. |
|
virtual void | SetSoftenLevel (float v, TimeValue t)=0 |
Sets the Soften Specular Highlights Level to
the specified value at the time passed. |
|
virtual BOOL | IsSelfIllumClrOn (int mtlNum, BOOL backFace)=0 |
Returns the The Self Illumination Color setting. |
|
virtual Color | GetAmbientClr (int mtlNum, BOOL backFace)=0 |
Returns the Ambient Color. |
|
virtual Color | GetDiffuseClr (int mtlNum, BOOL backFace)=0 |
Returns the Diffuse Color. |
|
virtual Color | GetSpecularClr (int mtlNum, BOOL backFace)=0 |
Returns the Specular Color. |
|
virtual Color | GetSelfIllumClr (int mtlNum, BOOL backFace)=0 |
Returns the Self Illumination Color. |
|
virtual float | GetSelfIllum (int mtlNum, BOOL backFace)=0 |
Returns the Self Illumination Amount.
|
|
virtual float | GetGlossiness (int mtlNum, BOOL backFace)=0 |
Returns the Glossiness Level. |
|
virtual float | GetSpecularLevel (int mtlNum, BOOL backFace)=0 |
Returns the Specular Level. |
|
virtual float | GetSoftenLevel (int mtlNum, BOOL backFace)=0 |
Returns the Soften Level as a float.
|
|
virtual BOOL | IsSelfIllumClrOn ()=0 |
Returns the Self Illumination Color setting. |
|
virtual Color | GetAmbientClr (TimeValue t)=0 |
Returns the Ambient Color at the specified time. |
|
virtual Color | GetDiffuseClr (TimeValue t)=0 |
Returns the Diffuse Color at the specified time. |
|
virtual Color | GetSpecularClr (TimeValue t)=0 |
Returns the Specular Color at the specified time. |
|
virtual float | GetGlossiness (TimeValue t)=0 |
Returns the Glossiness value at the
specified time. |
|
virtual float | GetSpecularLevel (TimeValue t)=0 |
Returns the Specular Level at the specified
time. |
|
virtual float | GetSoftenLevel (TimeValue t)=0 |
Returns the Soften Specular Highlights
setting at the specified time. |
|
virtual float | GetSelfIllum (TimeValue t)=0 |
Returns the Self Illumination Amount at the
specified time. |
|
virtual Color | GetSelfIllumClr (TimeValue t)=0 |
Returns the Self Illumination Color at the specified time. |
|
virtual float | EvalHiliteCurve (float x) |
Evaluates the hightlight curve that appears
in the Shader user
interface. |
|
virtual float | EvalHiliteCurve2 (float x, float y, int level=0) |
This is the highlight curve function for the
two highlight curves which intersect and appear in the UI, for
instance in the Anistropic shader. |
|
CoreExport void | ShadeReflection (ShadeContext &sc, IllumParams &ip, Color &mapClr) |
Implements the Max std way of handling
reflection to provide the default implementation. |
|
CoreExport void | ShadeTransmission (ShadeContext &sc, IllumParams &ip, Color &mapClr, float amount) |
Implements the Max std way of handling
transmission to provide the default implementation. |
|
void | PreShade (ShadeContext &sc, IReshadeFragment *pFrag) |
void | PostShade (ShadeContext &sc, IReshadeFragment *pFrag, int &nextTexIndex, IllumParams *ip) |
BaseInterface * | GetInterface (Interface_ID id) |
Inherited from Animatable. |
|
void * | GetInterface (ULONG id) |
Inherited from Animatable. |
virtual void CopyStdParams | ( | Shader * | pFrom | ) | [pure virtual] |
Copies the standard shader parameters from pFrom to this object.
Note that plug-ins typically disable the macro recorder during this operation as the Get and Set methods are called. See the sample code for examples.
pFrom | The pointer to the source parameters. |
virtual void SetLockDS | ( | BOOL | lock | ) | [pure virtual] |
Sets the state of the Diffuse/Specular lock to on or off.
lock | true for on, false for off. |
virtual BOOL GetLockDS | ( | ) | [pure virtual] |
Returns the Diffuse/Specular lock'.
virtual void SetLockAD | ( | BOOL | lock | ) | [pure virtual] |
Sets the state of the Ambient/Diffuse lock to on or off.
lock | true for on, false for off. |
virtual BOOL GetLockAD | ( | ) | [pure virtual] |
Returns the Ambient/Diffuse lock.
virtual void SetLockADTex | ( | BOOL | lock | ) | [pure virtual] |
Sets the state of the Ambient/Diffuse Texture lock to on or off.
lock | true for on; false for off. |
virtual BOOL GetLockADTex | ( | ) | [pure virtual] |
Returns the Ambient/Diffuse Texture lock.
virtual void SetSelfIllum | ( | float | v, |
TimeValue | t | ||
) | [pure virtual] |
Sets the Self Illumination parameter to the specified value at the time passed as TimeValue.
v | The value to set. |
t | The time to set the value. |
virtual void SetSelfIllumClrOn | ( | BOOL | on | ) | [pure virtual] |
Sets the Self Illumination Color On/Off state.
on | true for on, false for off. |
virtual void SetSelfIllumClr | ( | Color | c, |
TimeValue | t | ||
) | [pure virtual] |
Sets the Self Illumination Color at the specified time.
c | The color for the self illumination to set to. |
t | The time to set the color. |
virtual void SetAmbientClr | ( | Color | c, |
TimeValue | t | ||
) | [pure virtual] |
Sets the Ambient Color at the specified time.
c | The color for the ambient to set to. |
t | The time to set the color. |
virtual void SetDiffuseClr | ( | Color | c, |
TimeValue | t | ||
) | [pure virtual] |
Sets the Diffuse Color at the specified time.
c | The color for the diffuse color to set to. |
t | The time to set the color. |
virtual void SetSpecularClr | ( | Color | c, |
TimeValue | t | ||
) | [pure virtual] |
Sets the Specular Color at the specified time.
c | The color to set to. |
t | The time to set the color. |
virtual void SetGlossiness | ( | float | v, |
TimeValue | t | ||
) | [pure virtual] |
Sets the Glossiness parameter to the specified value at the time passed.
v | The value to set to. |
t | The time to set the value. |
virtual void SetSpecularLevel | ( | float | v, |
TimeValue | t | ||
) | [pure virtual] |
Sets the Specular Level parameter to the specified value at the time passed.
v | The value to set. |
t | The time to set the value. |
virtual void SetSoftenLevel | ( | float | v, |
TimeValue | t | ||
) | [pure virtual] |
Sets the Soften Specular Highlights Level to the specified value at the time passed.
v | The value to set. |
t | The time to set the value. |
virtual BOOL IsSelfIllumClrOn | ( | int | mtlNum, |
BOOL | backFace | ||
) | [pure virtual] |
virtual Color GetAmbientClr | ( | int | mtlNum, |
BOOL | backFace | ||
) | [pure virtual] |
Returns the Ambient Color.
The parameters to this method are not applicable and may safely be ignored.
virtual Color GetDiffuseClr | ( | int | mtlNum, |
BOOL | backFace | ||
) | [pure virtual] |
Returns the Diffuse Color.
The parameters to this method are not applicable and may safely be ignored.
virtual Color GetSpecularClr | ( | int | mtlNum, |
BOOL | backFace | ||
) | [pure virtual] |
Returns the Specular Color.
The parameters to this method are not applicable and may safely be ignored.
virtual Color GetSelfIllumClr | ( | int | mtlNum, |
BOOL | backFace | ||
) | [pure virtual] |
Returns the Self Illumination Color.
The parameters to this method are not applicable and may safely be ignored.
virtual float GetSelfIllum | ( | int | mtlNum, |
BOOL | backFace | ||
) | [pure virtual] |
Returns the Self Illumination Amount.
The parameters to this method are not applicable and may safely be ignored.
virtual float GetGlossiness | ( | int | mtlNum, |
BOOL | backFace | ||
) | [pure virtual] |
Returns the Glossiness Level.
The parameters to this method are not applicable and may safely be ignored.
virtual float GetSpecularLevel | ( | int | mtlNum, |
BOOL | backFace | ||
) | [pure virtual] |
Returns the Specular Level.
The parameters to this method are not applicable and may safely be ignored.
virtual float GetSoftenLevel | ( | int | mtlNum, |
BOOL | backFace | ||
) | [pure virtual] |
Returns the Soften Level as a float.
The parameters to this method are not applicable and may safely be ignored.
virtual BOOL IsSelfIllumClrOn | ( | ) | [pure virtual] |
virtual Color GetAmbientClr | ( | TimeValue | t | ) | [pure virtual] |
Returns the Ambient Color at the specified time.
t | The time at which to return the color. |
virtual Color GetDiffuseClr | ( | TimeValue | t | ) | [pure virtual] |
Returns the Diffuse Color at the specified time.
t | The time at which to return the color. |
virtual Color GetSpecularClr | ( | TimeValue | t | ) | [pure virtual] |
Returns the Specular Color at the specified time.
t | The time at which to return the color. |
virtual float GetGlossiness | ( | TimeValue | t | ) | [pure virtual] |
Returns the Glossiness value at the specified time.
t | The time at which to return the value. |
virtual float GetSpecularLevel | ( | TimeValue | t | ) | [pure virtual] |
Returns the Specular Level at the specified time.
t | The time at which to return the value. |
virtual float GetSoftenLevel | ( | TimeValue | t | ) | [pure virtual] |
Returns the Soften Specular Highlights setting at the specified time.
t | The time at which to return the value. |
virtual float GetSelfIllum | ( | TimeValue | t | ) | [pure virtual] |
Returns the Self Illumination Amount at the specified time.
t | The time at which to return the value. |
virtual Color GetSelfIllumClr | ( | TimeValue | t | ) | [pure virtual] |
Returns the Self Illumination Color at the specified time.
t | The time at which to return the color. |
virtual float EvalHiliteCurve | ( | float | x | ) | [inline, virtual] |
Evaluates the hightlight curve that appears in the Shader user interface.
This gets called from the DrawHilite() function which is available to developers in /MAXSDK/SAMPLES/MATERIALS/SHADER/SHADERUTIL.CPP
x | The input value. |
{ return 0.0f; }
virtual float EvalHiliteCurve2 | ( | float | x, |
float | y, | ||
int | level = 0 |
||
) | [inline, virtual] |
This is the highlight curve function for the two highlight curves which intersect and appear in the UI, for instance in the Anistropic shader.
x | The x input value. |
y | The y input value. |
level | This is used by multi-layer shaders to indicate which layer to draw. The draw highlight curve routines use this when redrawing the graph. |
{ return 0.0f; }
CoreExport void ShadeReflection | ( | ShadeContext & | sc, |
IllumParams & | ip, | ||
Color & | mapClr | ||
) | [virtual] |
Implements the Max std way of handling reflection to provide the default implementation.
Reimplemented from BaseShader.
CoreExport void ShadeTransmission | ( | ShadeContext & | sc, |
IllumParams & | ip, | ||
Color & | mapClr, | ||
float | amount | ||
) | [virtual] |
Implements the Max std way of handling transmission to provide the default implementation.
Reimplemented from BaseShader.
void PreShade | ( | ShadeContext & | sc, |
IReshadeFragment * | pFrag | ||
) | [inline, virtual] |
Reimplemented from IReshading.
{}
void PostShade | ( | ShadeContext & | sc, |
IReshadeFragment * | pFrag, | ||
int & | nextTexIndex, | ||
IllumParams * | ip | ||
) | [inline, virtual] |
Reimplemented from IReshading.
{ Illum( sc, *ip ); }
BaseInterface* GetInterface | ( | Interface_ID | id | ) | [inline, virtual] |
Inherited from Animatable.
Returns a pointer to the Base Interface for the interface ID passed.
id | - The unique ID of the interface to get |
Reimplemented from ReferenceTarget.
{ return BaseShader::GetInterface(id); }
void* GetInterface | ( | ULONG | id | ) | [inline, virtual] |
Inherited from Animatable.
Returns a pointer to the interface.
id | - The id of the interface. |
Reimplemented from ReferenceTarget.
{ if( id == IID_IReshading ) return (IReshading*)( this ); // else if ( id == IID_IValidityToken ) // return (IValidityToken*)( this ); else return BaseShader::GetInterface(id); }