This topic describes the primary classes involved in making 3ds Max materials compatible with mental ray shaders.
Mental Ray Shader Base Classes
In 3ds Max, all mental ray shaders either derive from Mtl or from Texmap. Material phenomena derive from class Mtl (and are thus material plugins), while all other shader types derive from class Texmap (and are thus texture map plugins).
Core Mental Ray Integration Interfaces
These abstract interfaces are implemented by 3ds Max and are the base of mental ray integration in 3ds Max.
- imrShader - This interface provides basic access to the parameters of the shader. Given a pointer to a mental ray shader, a pointer
to imrShader can be retrieved using the function GetIMRShader().
- imrPreferences - This interface provides access to the mental ray preferences, which are also accessible in the "mental ray" tab of the
3ds Max preferences dialog.
- imrShaderClassDesc - The base class for class descriptors of all mental ray shaders. It provides access to the parameter block descriptors,
provides access to the apply types of the shader, and exposes a method for creating an instance of the shader. To access the
class descriptor of a shader, call the method imrShader::GetClassDesc().
- imrMaterialCustAttrib - This interface provides SDK-level access to what is accessible through the user interface. It is implemented by the "mental
ray connection" material custom attributes. This custom attribute is assigned to every material in the material editor whenever
the "enable mental ray extensions" preference is on.
- IMtlRender_Compatibility_MtlBase - This class is used to detect compatibility between a material / texture map and a renderer. By default, all material and
texture map plug-ins are treated as compatible with the 3ds Max scan line renderer, but not with mental ray. Unless you check
the "Show Incompatible" check-box in the material/map browser, only compatible materials/maps will be visible.
Mental Ray Shader Translation Interfaces
These interfaces allow plug-in developers to handle the translation of various 3ds max elements into mental ray shaders.
- imrShaderTranslation - This is the fundamental interface used for the custom translation of a texture map plug-in to a mental ray shader. This
interface is implemented by plug-in developers.
- imrMaterialPhenomenonTranslation - This interface extends class imrShaderTranslation. It is the fundamental interface used for the translation of a material plug-in to a mental ray material phenomenon. This
interface is implemented by plug-in developers.
- imrGeomShaderTranslation - This interface is used to translate geometric objects (deriving from either GeomObject or ShapeObject) into mental ray geometry shaders. This interface is implemented by plug-in developers.
- imrShaderCreation - A pointer to this class is passed to class imrShaderTranslation to give developers an easy way to create instances of mental ray shaders based on the name of the shader, as declared in
the .mi file. This interface is implemented by 3ds Max.
- imrShaderTranslation_ClassInfo - This interface allows developers to extend the class descriptors, for their texture map plug-ins, with "apply type" information.
The apply type affects the locations where a shader can be assigned. For example, a shader with an apply type of "light" can
only be used as a light shader. These constraints are enforced by the material/map browser, which only shows the shaders which
are valid for any given slot.
Utility Classes
These classes are provided, along with an implementation, to facilitate the work of a plug-in developer. They are provided
with a source code implementation which must be included in the VC++ project.
- mrShaderFilter - This class can be used to impose "apply type" and "return type" constraints on texture map buttons. It may be used to specify
shader with which apply types and return types are accepted on a texture map button. By default, only shaders with apply types
"texture" or "material" and which return a color are accepted. This class can be used as-is, or can be extended by plug-in
developers. For more information on the material/map browser filtering feature, see the file IMtlBrowserFilter. h.
- mrShaderButtonHandler - This class is used by the SDK samples. It provides a generic UI handler for handling buttons which are to receive shaders.
This class is implemented by the plug-in developer.