ShaderFX Introductory Sample Workflow

This example demonstrates how to create two texture nodes and blend them together.

It demonstrates how to:

Example: Create a ShaderFX shader and open the ShaderFX editor:

  1. In the Perspective viewport, create a Plane object.
  2. Open the Material Editor and apply a DirectX Shader material to the plane.

    If you use the Slate Material Editor, double-click the DirectX Shader node so you can see its parameters.

  3. On the DirectX Shader rollout, turn on User ShaderFX and then click Open ShaderFX.

    3ds Max opens the ShaderFX editor.

Example continued: Create two textures and blend them using a Float node:

  1. Right-click the ShaderFX work area. From the Right-click menu, choose Hw Shader Nodes Textures Texture Map.

    ShaderFX adds a TextureMap node to the graph.

  2. Click the TextureMap node to display its settings in the Properties panel to the right of the work area.
  3. On the Properties panel, click the browse button beside MyTexture / Path.

    In the file dialog that opens, choose a texture file. In this example, a concrete texture is used.

  4. Repeat steps 1 and 2 for the second texture. In this example, a grass texture is used.

    Textures courtesy of www.cgtextures.com.

  5. -click the work area and choose Hw Shader Nodes Math Linear Interpolate Mix to create a LerpOp node to combine the two textures.
  6. -click and choose Hw Shader Nodes Values Float to create a Val node that contains a Float value.
  7. Connect the Color attribute of the first Texture Map to the first Value attribute of LerpOp.
  8. Connect the Color attribute of the second Texture Map to the second Value attribute of LerpOp.
  9. Connect the Float attribute of the Val node to the Mix attribute of LerpOp.

    The Float value controls the amount that each texture contributes to the blended result. For example, if set at 0.2, the resulting texture is dominated by the concrete texture. If set at 0.8, the resulting texture is dominated by the grass texture. If set at 0.5, it is an equal mix of the two.

  10. To see a swatch of the results, click the Render Swatch icon , on top of the Linear Interpolate node, until a large preview appears.

    Float set to 0.2

    .

    The Linear Interpolate Mix preview swatch shows that the concrete texture is dominant.

    Float set to 0.5

    .

    The concrete and grass textures are evenly mixed together.

    Float set to 0.8

    .

    The grass texture is dominant.

  11. Connect the Result attribute of the LerpOp to the Diffuse Color attribute of the TraditionalGameSurfaceShader node.

    Now you can visualize your shader in Realistic or Shaded viewports.

Example continued: Blend the textures using a Vertex Color node:

  1. -click and choose Hw Shader Nodes Inputs Common Vertex Color.

    Instead of using the Float node, you will use the vertex color to blend the textures.

  2. Click to highlight the wire that connects the Float node from Linear Interpolate, then press .
  3. Connect the Red attribute of VertexColor to the Mix attribute of LerpOp. This way, you use the Red channel to blend your textures.
  4. In a viewport, make sure the Plane object is selected. On the Modify panel, increase the value of Length Segs and Width Segs to 20. This adds more vertices to your plane to increase definition for vertex painting.
  5. Also on the Modify panel, apply a VertexPaint modifier to the Plane.

    3ds Max opens the VertexPaint Paintbox.

    Now you will paint some of your vertices red. The vertices that are painted red will display your grass texture.

  6. On the Paintbox, click to activate (Disable vertex color display).
  7. The default color swatch should show black. (If it isn't black, click it and use the Color Selector to change it to black.) Click (Paint All) to make the Plane black.

    With vertices assigned the black channel, the plane shows the concrete texture.

  8. Click the color swatch and change the color to a bright red.
  9. Click (Paint) and paint on your plane. The vertices that you paint as red take on the grass texture values. You have now blended your textures by painting your vertices.

Example continued: Multiply your texture to repeat it in a tile pattern to create a different, more dense effect:

  1. On the modifier stack, click to highlight the VertexPaint modifier and then click (Remove Modifier From The Stack).
  2. In the ShaderFX editor, disconnect the VertexColor node by clicking its wire and pressing , then reconnect the Val node's Float value to the Mix attribute of LerpOp.
  3. Click to highlight the VertexColor node and press .
  4. -click and choose Hw Shader Nodes Inputs Common UV Set to create a UV Set node.
  5. -click and Hw Shader Nodes Math Multiply to create a MulOp node.
  6. -click and choose Hw Shader Nodes Values Float to create another Val node.
  7. Connect the UV attribute of the UV Set node to the first Value attribute of MulOp.
  8. Connect the Float attribute of the new Val node to the second Value attribute of MulOp.
  9. Connect the Result attribute of the MulOp node to the UV attribute of the TextureMap whose pattern you would like to tile.
  10. Click to select the new Val node, and on the Properties panel, change its Float value. Set Float to a higher value so that the pattern repeats more often and is more dense, and a lower value so that the pattern does not repeat as often. You can preview the resulting pattern by clicking the Render Swatch icon of the TextureMap node.

    Value=0.5

    Value=2.0