Example: Creating an Interactive Shader Network to Blend Two Textures

This example demonstrates how to create a shader network using an Interactive material and ShaderFX nodes that allow you to blend two textures by painting the vertices.

Note: In 3ds Max 2018.4 Update, the Stingray physically-based shader is renamed Interactive.

It is similar to the example "Blend the textures using a Vertex Color node" in the topic "ShaderFX Introductory Sample Workflow"; however, this example uses the Interactive Standard Base node and its associated ShaderFX nodes.

Prepare the graph:

  1. Create a Plane in your scene. In the Perspective viewport, press G to turn off grid display.
  2. Open the Material Editor, choose a DirectX Shader material, and apply it to the plane.
  3. On the DirectX Shader rollout, choose Interactive from the drop-down list, then click Open ShaderFX.
  4. In the ShaderFX window, click to highlight the Standard Base node. In the Properties rollout, click Make Unique to make the shader a custom shader.
  5. On the Properties rollout, choose Preset Material Custom, and delete the other nodes from the Interactive preset.

    The shader network now contains only the Standard Base node.

Add nodes to the graph:

  1. Add a Math Linear Interpolate node.
  2. Add two Sampling Sample Texture nodes.
  3. Add a Vertex Inputs Texcoord0 node.
  4. Wire the RG output of the Textcoord0 node to the UV input of both Sample Texture nodes, and wire the RGBA output of each Sample Texture node to a Value input of the Linear Interpolate node.
  5. Add an Input Material Variable node.
  6. Highlight the Material Variable node, and on its Properties panel choose Type Scalar.
  7. Wire the Result output of the Material Variable node to the Mix input of the Linear Interpolate node, and wire the Result output of the Linear Interpolate node to the Base Color input of the Standard Base node.

    The graph is now complete. In the next procedure, you adjust the user interface and assign the actual texture maps.

Set up the textures and the BlendMaps parameter:

  1. Click the upper Texture Map node to highlight it, then on the Properties panel change its name to Texture1.
  2. Change the name of the other Texture Map node to Texture2.
  3. Change the name of the Material Variable node to BlendMaps.
  4. Minimize the ShaderFX Editor.
  5. On the Material Editor Parameters rollout, click the Texture1 button and assign a map; for example, Complete-Right-Side copy.jpg.
  6. Click the Texture2 button and assign a different map; for example, fac3.jpg.
  7. The textures used for this example are in the \tutorials\sceneassets\images folder, which is available if you download the tutorial files. See http://www.autodesk.com/3dsmax-tutorials-scene-files-2016. (If you use the fac3.jpg map, make sure that Sequence is turned off in the file dialog!)

Use BlendMaps to adjust the blending of the texture maps:

Save your work:

  1. Open the ShaderFX Editor again.
  2. On the ShaderFX Editor menu bar, choose File Export Graph.
  3. On the file dialog, save the new shader as blend_example.sfx.
  4. Close the ShaderFX Editor.
  5. Save the Scene as blend_example.max.