Blending materials on a Source 2 model using Blender

From Valve Developer Community
Jump to navigation Jump to search
English (en)Translate (Translate)

A quick guide on how to add material blending to your model in Source 2 using ModelDoc and Blender.

Note.pngNote: Requires basic knowledge of vertex painting in Blender and creating simple models in ModelDoc.
Warning.pngWarning: Map compilers do not recognize blended materials on models. You must manually create separate physics meshes or hulls for different surface types.

Step 1. Creating a Color Attribute

Icon-Important.pngImportant: Skip this step if you're working with Half-Life: Alyx, since its compiler incorrectly identifies the attribute name from Blender. See step 3 for more details.
  1. Switch to Vertex Paint mode.
  2. Click the Attribute dropdown in the top header.
  3. Click the plus button on the right.
  4. Set the following parameters in the pop-up window:
    • Name: VertexPaintBlendParams
    • Domain: Face Corner
    • Data Type: Byte Color
  5. Click Add.

Step 2. Vertex Painting

In Blender, switch to Vertex Paint mode and paint the model's surfaces with your chosen colors. Use the reference tables below to find the required vertex colors that match the requirements of Source 2 shaders.

Counter-Strike 2 Csgo Environment Blend
Vertex Сolor HEX Layer in shader Notes
Black #000000 Layer 1
Red #FF0000 Layer 2
Green #00FF00 Layer 3
Blue #0000FF Wetness Mix with black (layer 1)
Pink #FF00FF Wetness Mix with the red color (layer 2)
Cyan #00FFFF Wetness Mix with the green color (layer 3)
Counter-Strike 2 Csgo Simple 2way Blend
Vertex Сolor HEX Layer in shader Notes
Black #000000 Layer 1
Red #FF0000 Layer 2
Half-Life: Alyx Vr Simple 2way Blend
Vertex Сolor HEX Layer in shader Notes
Black #000000 Layer 1
Red #FF0000 Layer 2
Dota 2 Multiblend
Vertex Сolor HEX Layer in shader Notes
Black #000000 Layer 0 Enable "No Vertex Color" in the shader options for correct behavior on models.
Red #FF0000 Layer 1
Green #00FF00 Layer 2
Blue #0000FF Layer 3

Step 3. Renaming a data stream

Icon-Important.pngImportant: Skip this step if you're working with Counter-Strike 2 or Dota 2, since their compilers correctly identifies the attribute name from Blender. See step 1 for more details.
  1. Open your model via ModelDoc.
  2. Right-click on the render mesh.
  3. Find and select Add RenameStream.
  4. Click on RenameStream under the desired mesh and fill in the nodes as shown below:
    • From Name: color$0
      Note.pngNote: Digit specifies the slot for vertex painting in Blender, so instead of 0 (first slot), it can be anything if your model has more than one slot.
    • To Name: VertexPaintBlendParams$

Step 4. Enjoyment

See also