Language:
Page Info
Skill Level:
Engine Version:

5-Way Blend Materials

Choose your OS:

To handle 5 textures in the blend weights setup, you need to create a material similar to this:

5-Way_Material.png

This works very similarly to the 3-way and 4-way setups. However, we now take one minus the alpha value to get a fifth color. Here is what is happening:

  • Each of the color channels (ARGB) gets its own Linear Interpolation expression.

  • An additional Lerp is added, driven by 1 minus the alpha of the Vertex Color node. This will be the fifth color.

  • Each texture plugs into the B input of its corresponding Lerp node.

  • The Lerp corresponding to Texture 1 plugs into the material, and its alpha will be driven by the Alpha channel from the vertex color.

  • The Lerp corresponding to Texture 2 plugs into the A input of the Lerp corresponding to Texture 1, and its alpha will be driven by the Red channel from the vertex color.

  • The Lerp corresponding to Texture 3 plugs into the A input of the Lerp corresponding to Texture 2, and its alpha will be driven by the Green channel from the vertex color.

  • The Lerp corresponding to Texture 4 plugs into the A input of the Lerp corresponding to Texture 3, and its alpha will be driven by the Blue channel from the vertex color.

  • The Lerp corresponding to Texture 5 plugs into the A input of the Lerp corresponding to Texture 4, and its alpha will be driven by the 1-alpha from the vertex color.

  • Texture one also wraps around and becomes the A plug for the 5th and final Lerp. This makes Texture 1 the default texture.

Once this is set up, the Blend Weights Texture Count setting should be set to 5 (1-ARGB).

5-Way_Setting.png

Here is an example of this material, first with the mesh viewed in RGB Mode, showing the vertex colors in place. Note that with this setup, alpha (shown black) corresponds to Texture 1, red corresponds to Texture 2, green corresponds to Texture 3, and blue corresponds to Texture 4. Incidentally, alpha is also used for Texture 5 and is also shown in black at the bottom.

5-Way_VertexColor.png

And here is the final result:

5-way_result.png

Notice that where the vertex color in the first image is black (Texture 1) there is no change. This is because Texture 1 is also plugged into the A input of the 4th Lerp expression (see above), making it the default texture. Essentially, you start with Texture 1 and can paint Textures 2, 3, and 4 down as you see fit, or paint Texture 1 back down over them at any time.

If you were going to be setting up such material over and over, this would be a great place to deploy a custom Material Function !