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 when you are using a Nitrous driver (the default driver is Nitrous Direct3D 11) or the Legacy Direct3D driver.
The DirectX Shader material can use the following types of shaders:
An FX file defines a DirectX (DX9 or DX11) 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.
The DirectX Shader material gives you access to ShaderFX, which lets you create hardware shader trees and save them as HLSL, CGFX, or GLSL files. You can save HLSL files with an FX file name extension, which makes them available to the DirectX Shader material.
The Quicksilver Hardware renderer can render DirectX materials that use FX files or ShaderFX trees.
An XMSL file stores one or more shader trees in the XMSL format. 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.)
To develop MetaSL shaders, 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.
The mental ray renderer can render DirectX materials that use XSML files.
Typically FX shaders are coded to use a specific number of lights: usually just a single light. If the FX 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.
Click to display a file dialog that lets you open a shader. By default, the FX format (Direct3D Effects) is active and the shader is standardfx11.fx.
To open an XMSL file, choose that file type from the Files Of Type drop-down list in the file dialog.
Click to reload the active shader file. To update a shader file, you can edit it and then click Reload. You don't have to restart 3ds Max to see the effect of the changes to the shader.
While Use ShaderFX is on, the ShaderFX node tree overrides the current FX or XMSL shader.
For a quick introduction to the ShaderFX editor, see ShaderFX Introductory Sample Workflow. Also see About ShaderFX Nodes, Working with ShaderFX Nodes, and Working with ShaderFX Groups.
The rollouts that appear below the DirectX Shader rollout and above the Technique 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, the Technique rollout has a drop-down list that lets you choose which shader the material will use.
Specifies a material that controls software shading and rendering of objects to which the DirectX Shader material is applied. Nitrous and Legacy Direct3D viewports use DX shading. OpenGL viewports do not. Renderings other than the Quicksilver hardware renderer 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.