Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions

IMaterialViewportShading Class Reference

This reference page is linked to from the following overview topics: Hardware Shader UI Feature.


Search for all occurrences

Detailed Description

A new interface for 3ds Max 2008.

This interface is used for manipulating material shading model in the viewport. A material would implement this interface so as to control the "Show map in viewport" (SMIV) button. In 3dsmax 2008 the SMIV button can now show as a flyoff, for regular shading (Blue) and Hardware shading (Pink). If a material supports a Hardware representation then it can implement this interface and return the correct level support in IsShadingModelSupported. This will mean the UI is reflective of the support available. This interface DOES NOT provide any support for the actual Hardware implementation - purely the UI synchronisation. An implementation for this interface can be found at .cpp where it support the case where the material deals with plugin hardware shaders as well. Currently in 3ds max 2008, only two materials implement a Hardware version, and they are the Standard Material and Mental Images's Architectural and Design Material.

#include <IMaterialViewportShading.h>

Inheritance diagram for IMaterialViewportShading:
Inheritance graph
[legend]

List of all members.

Public Types

enum   ShadingModel { Standard, Hardware, OtherTypes }
 

This enumeration defines how the material is behaving in viewport.

More...

Public Member Functions

virtual CoreExport BaseInterface GetInterface (Interface_ID id)
virtual CoreExport Interface_ID  GetID ()

Static Public Member Functions

static CoreExport bool  IsShadingModelSupported (const MtlBase &material, ShadingModel model)
  Does the material support a specific shading model in viewport.
static CoreExport ShadingModel  GetCurrentShadingModel (const MtlBase &material)
  Used to query the material for its current level of viewport rendering.
static CoreExport bool  SetCurrentShadingModel (MtlBase &material, ShadingModel model)
  Set the shading model of the material in viewport and update the UI of material editor.
static CoreExport int  GetSupportedMapLevels (const MtlBase &material)
  The map levels needs to be defined by the material, it will tell the various shader compilers how far to go in the search of materials/maps.

Protected Member Functions

virtual bool  IsShadingModelSupported (ShadingModel model) const =0
  Does the material support a specific shading model in viewport.
virtual ShadingModel  GetCurrentShadingModel () const =0
  Used to query the material for its current level of viewport rendering.
virtual bool  SetCurrentShadingModel (ShadingModel model)=0
  Set the shading model of the material in viewport.
virtual int  GetSupportedMapLevels () const =0
  The map levels needs to be defined by the material, it will tell the various shader compilers how far to go in the search of materials/maps.

Member Enumeration Documentation

This enumeration defines how the material is behaving in viewport.

Enumerator:
Standard 

the material is rendered in standard way - original Viewport rendering.

Hardware 

the material is rendered by using hardware shaders.

OtherTypes 

other render types, such as plugin effect shading.


Member Function Documentation

virtual CoreExport BaseInterface* GetInterface ( Interface_ID  id ) [virtual]
Remarks:
Returns a pointer to the interface whose ID is specified.
Parameters:
Interface_ID id

The ID of the interface to return.
Default Implementation:
{ return NULL; }

Reimplemented from BaseInterface.

virtual CoreExport Interface_ID GetID ( ) [virtual]
Remarks:
This method returns the unique interface ID.

Reimplemented from BaseInterface.

virtual bool IsShadingModelSupported ( ShadingModel  model ) const [protected, pure virtual]

Does the material support a specific shading model in viewport.

This will be used to enable the SMIV options.

Parameters:
model The shading model, for now it must be Standard or Hardware.
Returns:
if the shading model is supported, return true; otherwise return false
virtual ShadingModel GetCurrentShadingModel ( ) const [protected, pure virtual]

Used to query the material for its current level of viewport rendering.

Returns:
current shading model.
virtual bool SetCurrentShadingModel ( ShadingModel  model ) [protected, pure virtual]

Set the shading model of the material in viewport.

Parameters:
model The shading model, must be Standard or Hardware.
Returns:
If the shading model is set successfully, return true; otherwise return false.
virtual int GetSupportedMapLevels ( ) const [protected, pure virtual]

The map levels needs to be defined by the material, it will tell the various shader compilers how far to go in the search of materials/maps.

Most materials will stop searching after one level, as the shader becomes too complex. For example specifiying 1 will mean the first map found will be used e.g a BitmapTex in a diffuse slot. The compiler will not search any further for maps to support. In this case it will probably bake the submaps to textures and will not try to generate shader code for these submaps.

Returns:
How deep the shader compilers will go in the search of material/Maps in the tree.
static CoreExport bool IsShadingModelSupported ( const MtlBase material,
ShadingModel  model 
) [static]

Does the material support a specific shading model in viewport.

This will be used to enable the SMIV options.

Parameters:
material The material you want to test. If the material does not support IMaterialViewportShading interface, then only standard shading model is supported.
model The shading model, for now it must be Standard or Hardware.
Returns:
if the shading model is supported, return true; otherwise return false
static CoreExport ShadingModel GetCurrentShadingModel ( const MtlBase material ) [static]

Used to query the material for its current level of viewport rendering.

Parameters:
material The material you want to get shading model from. If the material does not support IMaterialViewportShading interface, then the function will return Standard shading model.
Returns:
current shading model.
static CoreExport bool SetCurrentShadingModel ( MtlBase material,
ShadingModel  model 
) [static]

Set the shading model of the material in viewport and update the UI of material editor.

Parameters:
material The material you want to set its shading model. If the material does not support the shading model, the function will fail.
model The shading model, must be Standard or Hardware.
Returns:
If the shading model is set successfully, return true; otherwise return false.
static CoreExport int GetSupportedMapLevels ( const MtlBase material ) [static]

The map levels needs to be defined by the material, it will tell the various shader compilers how far to go in the search of materials/maps.

Most materials will stop searching after one level, as the shader becomes too complex. For example specifiying 1 will mean the first map found will be used e.g a BitmapTex in a diffuse slot. The compiler will not search any further for maps to support. In this case it will probably bake the submaps to textures and will not try to generate shader code for these submaps.

Parameters:
material The material you want to get map levels from. If the material does not support IMaterialViewportShading interface, the function returns 1.
Returns:
How deep the shader compilers will go in the search of material/Maps in the tree.

IMaterialViewportShading IMaterialViewportShading IMaterialViewportShading IMaterialViewportShading IMaterialViewportShading IMaterialViewportShading IMaterialViewportShading IMaterialViewportShading IMaterialViewportShading IMaterialViewportShading
IMaterialViewportShading IMaterialViewportShading IMaterialViewportShading IMaterialViewportShading IMaterialViewportShading IMaterialViewportShading IMaterialViewportShading IMaterialViewportShading IMaterialViewportShading IMaterialViewportShading