Example workflow: Use a Stingray Physically Based Shader to blend two textures

Note: Previously, in Maya 2016 and Maya 2016 Extension 1, the Preset Material drop-down list was named Parent Material, and the Parent Material attribute was named In Engine Material.

This example demonstrates how to create a shader network using a Stingray PBS node and ShaderFX nodes so that you can blend two textures by painting the vertices.

This workflow is similar to the Blending the textures using the Vertex Color node example in the ShaderFX introductory sample workflow topic; however, this example uses the Stingray PBS node and its associated ShaderFX nodes.

  1. Create a plane in your scene and increase its subdivisions to 20x20.

  2. Right-click the plane and select Assign New Material, then select Stingray PBS from the Assign New Material window.

    Press 6 for textured mode.

  3. In the StingrayPBS Attribute Editor, select Custom from the Preset Material drop-down list.

  4. Click Open ShaderFX in the Attribute Editor to open the ShaderFX editor window.

  5. Drag and drop a Sample Texture node from the Node Browser to the work area. Connect it to your first texture; in this example, concrete.

  6. Create a second Sample Texture node and connect it to your second texture; in this example, grass.

  7. Create a Texcoord 0 node.

    Note: You must connect a UV set node to the UV input of Sample Texture to set the texture co-ordinates of your object. The red border of the UV port also denotes that an input is mandatory.

  8. Connect the RG output of Texturecoord0 to the UV input of each of the Sample Texture nodes.

  9. Create a Vertex Color 0 node and a Linear Interpolate node.

  10. Connect the RGBA output of the first Sample Texture node to the first Value input of the Linear Interpolate node.

  11. Connect the RGBA output of the second Sample Texture node to the second Value input.
  12. Connect the RGBA output of the Vertex Color 0 node to the Mix input of the Linear Interpolate node.

    Vertex color is used to blend the two textures.

  13. Click the Mix attribute on the Linear Interpolate node. In the Attribute Editor, enter r in the Component Swizzle field.

    An r annotation is added beside the Mix attribute. The red channel is now used to blend the two textures.

  14. Connect the Result output of Linear Interpolate to the Base Color input of Standard Base.

  15. Select your plane, then select Mesh Display > Apply Color > .

    Set the Color to black and click Apply Color to ensure all vertices start with a vertex color of 0, 0, 0.

  16. Select Mesh Display > Paint Vertex Color Tool > .

    Set the Color value to red, since the red channel is used for blending.

  17. Paint on the plane and you will see that areas that are painted with red take on the values of the grass texture. You have now blended your textures by painting your vertices.

Textures courtesy of www.cgtextures.com.

Related topics