Building Your First Layered Material
Build a layered material with height blending and vertex color masking.
In this guide, we'll create a layered material using Material Layers.
We'll be blending 2 SurfaceMaterials together using a MaskMaterial that uses height blending and vertex color masks.
Before we begin, there's a few things we need to know about the system. See the Architecture Overview for the big picture.
LayerMaterials (SurfaceMaterial, MaskMaterial etc.) are used in LayerGraphs. You connect different LayerNodes such as Surface, Mask, Overlay and Data together to create a layered material.
A LayerGraph is used by a LayerStack to generate the final layered material.
Step 1: Creating the LayerMaterials
- Create a new
SurfaceMaterialin the filesystem. Assign thesurface_base_material.gdshaderfile to the shader slot. - Duplicate and assign different sets of textures to both materials.
- Create a new
MaskMaterialin the filesystem. Assign themask_hblend_vcol.gdshaderfile to the shader slot.
Step 2: Using LayerMaterials in a LayerGraph
- Create a new
LayerGraphin the filesystem. - Double-click the
LayerGraph, then clickOpen Graph. This opens the LayerGraph editor. - Drag and drop the
SurfaceMaterialsandMaskMaterialinto theLayerGraph. - Connect the
SurfaceNodesinto theBaseandBlendinput ports of theMaskNode. - Create an
OutputNodeand connect theMaskNodeto it. - Save the
LayerGraphby clickingSavefrom the file popup or in theOutputNode.
Step 3: Generating the final material using a LayerStack
- Create a new
LayerStackfrom the filesystem or a material slot. - Assign a
LayerGraphto theLayerStackand pressGenerate.
And that's it! It should now result in a blended material. Make sure the vertex colors are correctly set up. You can paint vertex colors with a vertex painter addon like Nexus Vertex Painter, or in a 3D modeling program like Blender.