The DirectX Shader material enables you to shade objects in viewports using DirectX (Direct3D) shaders. With DirectX shading, materials in a viewport more accurately represent how the material will appear in another application, or on other hardware such as a game engine. You can use this material only when you are using the Direct3D Display driver and DirectX 9.0 or DirectX 10.0 is chosen as the Direct3D version.
The DirectX Shader material can use the following types of shaders:
An FX file defines a DirectX (DX9 or DX10) shader. It is a text file created using the Higher-Level Shading Language (HLSL) standard.
By default, DirectX shaders, including FX files, are saved in \maps\fx\ in the 3ds Max program directory.
CGFX is a shader-description format developed by NVIDIA. It is compatible with DirectX (DX9 and DX10), and also with OpenGL (however, 3ds Max doesn’t support hardware shading in OpenGL viewports).
By default, DirectX shaders, including CGFX files, are saved in \maps\fx\ in the 3ds Max program directory.
An XMSL file stores one or more shader trees in the MetaSL format developed by mental images ® . You can use MetaSL shaders in the Slate Material Editor; also, with the Map To Material Conversion node, you can save a MetaSL shader tree as an XMSL file. (Once saved, you can’t edit the XMSL file in 3ds Max.)
Another way to develop MetaSL shaders is to use the mental mill ® application. For a MetaSL shader to work with mental ray, you must save it from mental mill as a phenomenon. Phenomena are described in the mental mill Artist Edition User Guide.
Typically FX and CGFX shaders are coded to use a specific number of lights: usually just a single light. If the FX/CGFX file you open is coded this way, the shader-specific rollouts display a control that lets you pick the light to use. For example:
XMSL shaders, on the other hand, are not coded to use specific lights, so they use all active lights in the scene.
When you assign a map to a mappable component of a DirectX shader, you can choose from among these map types:
Shows all the file types listed in the remainder of this list.
When you open a Photoshop PSD file that contains layers, 3ds Max displays a dialog that lets you choose to either collapse the layers and display the composited image, or use just a single layer.
The rollouts that appear below the DirectX Shader rollout and above the Software Rendering rollout are the interface to the shader you chose. These rollouts are specific to each shader.
For example, when you choose an XMSL file, a rollout appears for each MetaSL shader in the shader tree. You can adjust the shader settings locally for the current scene, although the XMSL file remains unchanged.
Example of locally editable MetaSL shader rollouts for a DirectX material using an XMSL file
When you load a shader that is not appropriate for 3ds Max, then instead of parameters you might see a rollout that displays an error message. For example:
An XMSL file can contain more than one shader. When you open one of these, 3ds Max prompts you to choose which shader the material will use. For example:
Specifies a material that controls software shading and rendering of objects to which the DirectX Shader material is applied. Viewports use DX shading unless the Software or OpenGL driver is active. Renderings always use software shading.
Usually you will want to choose a material that clearly identifies which objects in your scene have the DirectX Shader material applied.
If DirectX is not available on your system, but you assign the DirectX Shader material anyway (by using the Material/Map Browser's Incompatible option), this is the only rollout that appears in the Material Editor.