How To Create a 2-Texture Material for Vertex Color Painting

This page shows you a specific example of how to create and use a Two-Texture Material for use with vertex color painting on Meshes.

Windows
MacOS
Linux

Vertex Color Painting is a powerful tool, and there are many ways to use it. The Create a Material for 2-Way Texture Blending page gives a basic explanation for how to set up a Material for blending textures with vertex color painting. This page provides a more concrete use case for this technique. This document demonstrates how to create a two-texture Material for vertex color painting, that blends a rock texture and a moss texture. Once you’ve created this blended texture, you can use Mesh Paint Mode to paint this texture onto any mesh in your level. You can adjust the settings in the Mesh Paint Mode panel to increase coverage or decrease it, so that the texture is variable across the mesh.

Rock without Moss

Rock with Moss

Steps

Create the Material

  1. In the Content Browser, click Add New > Material.

    Click image for full size.

  2. Name your new material. In this example, we are using M_2TextureMoss.

    RenameMaterial.png

  3. Double-click the new Material to open the Material Editor.

Create and Set Up TextureSample Nodes

  1. First we need to add a texture. Right-click in the graph, and in the search bar type texture. In the list of results, select TextureSample. This adds the TextureSample node to the graph.

    Click image for full size.

  2. We need four for our example, so copy the TextureSample node and paste it three times so that you have a total of four TextureSample nodes.

    Click image for full size.

  3. Position the nodes so that two are together near the top of your graph, and two are together toward the bottom of the graph. This will make them easier to distinguish from each other, and make things more organized.

  4. First we'll select our Diffuse textures. Click one of the top TextureSample nodes. In the Details panel on the left, locate the Material Expression Texture Base section. For the Texture property, click the dropdown to select a texture. In the search bar, type in rock_b. In the results, select T_Rock_Basalt_D.

    Click image for full size.

  5. Click on the second of the top TextureSample nodes. In the Details panel, click the Texture dropdown, and in the search bar type grass. In the results, select T_Ground_Grass_D. This is the second of our Diffuse maps.

    Click image for full size.

  6. Now we need to select our Normal maps. Click the first of the lower TextureSample nodes. In the Details panel, click the Texture dropdown and type in rock_b again. This time, select T_Rock_Basalt_N. This is the Normal map that matches the Diffuse map we selected in steps 4 and 5.

    Click image for full size.

  7. Click the last TextureSample node, and in the Details panel, click the Texture dropdown and type in grass again. In the resutls, select T_Ground_Grass_N.

    Click image for full size.

Add the Vertex Color and Linear Interpolation Nodes

  1. Now we’ll add the Vertex Color node. Right-click in the graph, and type vertex in the search bar. In the results, select VertexColor. When the VertexColor node is added, notice that it is a red Input Data node.

    Click image for full size.

  2. The VertexColor node will combine the two Diffuse maps based on a linear interpolation, or lerp. Right-click the graph and type linear in the search bar. In the results, select LinearInterpolate. This places a Lerp node on the graph.

    Click image for full size.

  3. We need two, so copy the first Lerp node and paste a second one on the graph. One is for the Diffuse maps, and the other is for the Normal maps, so position the Lerp nodes accordingly.

    Click image for full size.

  4. On the Rock Diffuse map, drag off the RGB output and connect it to the A input on the first Lerp node.

    Click image for full size.

  5. On the Grass Diffuse map, drag off the RGB output and connect it to the B input on the first Lerp node. Both your Diffuse maps are now connected.

    Click image for full size.

  6. On the Rock Normal map, drag off the RGB output and connect it to the A input on the second Lerp. On the Grass Normal map, drag off the RGB output and connect it to the B input on the second Lerp node. Both your Normal maps are now connected.

    Click image for full size.

  7. The Alpha input on the Lerp nodes is the variable that controls the mixture of the Rock and Grass textures. The VertexColor node is going to control the Alpha value, so drag off the top output on the VertexColor node and connect it to the Alpha input on the Diffuse Lerp node, then do the same again for the Normal Lerp node.

    Click image for full size.

  8. Now drag off the output of the Diffuse Lerp node and connect it to the Base Color input on the Material node. Drag off the output of the Normal Lerp node and connect it to the Normal input on the Material node.

    Click image for full size.

Set Up Remaining Material Properties

  1. Now we’ll set the remaining properties on the Material node. Drag off the Metallic input on the Material node, and in the search bar type in constant. Select Constant to add a Constant node. Leave the value at the default of 0.

    Click image for full size.

  2. We also want the Specular value to be 0, so connect the Specular input on the Material node to the same Constant node we made in step 1.

  3. We want the Roughness value to be higher than 0, so copy-paste the original Constant node to create another one. Connect the Roughness input to the second Constant node. Select that Constant node, and in the Details panel, set the value to 1.

    Click image for full size.

Final Result

Now we have a Material that we can use with Vertex Color painting to paint a texture on our mesh. You can adjust the Strength setting in the Brush section to vary how much of your moss texture is painted onto the mesh. You can adjust the Radius setting up or down, depending on whether you need to paint large sections or small details. You can adjust the Falloff setting to create a hard edge to your texture, or to have it fade out gradually.

RockAfterVertexPaint.png

Select Skin
Light
Dark

새로운 언리얼 엔진 4 문서 사이트에 오신 것을 환영합니다!

문서 사이트에 대한 의견을 모을 수 있는 피드백 시스템을 포함해서 여러가지 새로운 기능을 준비하고 있습니다. 아래 Documentation Feedback 포럼(영문) 또는 언리얼 엔진 네이버 공식 카페(한글) 중 편하신 곳에 의견이나 문제점을 알려 주세요.

새 시스템이 준비되면 알려 드리겠습니다.

네이버 카페
공식 포럼