In my game I'm trying to use texture splatting technique which allow me to have up to 5 textures on landscape chunk. For this I need to generate blend map so my game engine know how to blend those textures. I was googling a lot and found few tutorials describing how to mix 2 textures with one stencil. But I need to mix 4 textures and since I'm very new in Blender and design I'm experiencing few problems:

  1. For beginning I added 3 textures (grass, dirt and sand) and 2 stencils between them. But with this approach I can only draw sand on dirt, I cant add sand on grass because first stencil block it. It does change stencil but I can't see sand over grass.

enter image description here

how can I solve this?

  1. At least I can paint on stencils and now I have to combine them to get one colored texture with each channel intensity of some texture. I was manage to achieve this using node editor:

enter image description here

but now, how do I export this to external image file so that I can use this blend map in my game?

Maybe in common I moving in wrong direction and there are better ways to generate blend map for 4 textures, while painting on landscape mesh in Blender?


1 Answer 1


You basically had the right idea about breaking it down by color channel.

Here's one example of how you can solve this:

Using RGB and black to create a 4-texture blend map

A blend map controlling the mapping of four grass textures

I could have used the alpha channel, but opted for the absence of color (black) instead to represent the fourth channel because you can't see the alpha channel in the 3D Viewport or paint it in Texture Paint Mode.

This is what the node setup looks like (Blender Internal):

Blender internal material node setup

What's happening in the node setup

From the 'Blend Map' texture the RGB channels are separated and each one used to additively factor in the color of the texture against solid black.

Separate RGB sparates the red, green, and blue channels The grass texture is added, only in areas where the blend map is red

The RGB Curves node just gives enough of a boost that the transitions between regions won't look dark. (Mute the node in the .blend to see the difference it makes.)

The ColorRamp and Invert nodes isolate the darker parts of the blend map and that becomes the fourth channel mask (black).

Isolating darker areas of the blend map using the ColorRamp and Invert nodes

The Material node receives the final additive mix of color data (the four textures) and applies it to a material created just for this node setup that I named 'NodeComponent'. This is just the quirky way of doing things in BI's nodes so that the material will receive specular highlights and not be shadeless.

A Material node is inserted before the Output node in order to receive light and shadows A separate material exists for the purpose of giving specular, etc

For cases when you need more than four textures, you can repeat the blend mapping process iteratively. So for example, within the red region of the blend map there could be another blend map with its own red, green, blue, and black regions. So you could use the first blend map to control what kind of terrain (grass, sand, snow, stones), and then the second level blend map to map out the grass textures within the grass region. In such a case it would be best to create a Group node and reuse it for each blend map, to keep your nodes manageable.

Getting it into your game

As for exporting, you can bake your blend map to a new massive texture, but it wouldn't be good for a game because such a large image would need to be generated. It's better to use the individual tiling textures and the blend map to combine them. I don't know what game engine you plan to use, but if you are using the BGE or Blend4Web you can use this node setup as-is. For other engines you should look into what kind of data those engines expect for a blend map.

*Terrain material is set to 'Shadeless'. Turn off 'Shadeless' to see lighting.

  • $\begingroup$ Thank you for this extended response. With your approach I should draw colors on terrain instead actual drawing textures. So I would not see how it all would look on terrain unless I load it into my game. With my approach I can see where is there should be more/less of each texture so it make drawing process more descriptive. But I have that overlapping problem (#1 described in my question). $\endgroup$
    – SET
    Apr 23, 2016 at 6:30
  • $\begingroup$ @SET You can press [Shift Z] to quickly toggle Viewport Rendering. Make sure BI's material nodes are enabled when previewing the terrain, and disabled when painting (because BI node materials and Texture Paint Mode are not compatible, so you'll see only magenta if you try to paint on a node material). Add a texture slot for the blend map texture (while nodes are disabled) and move this to the top of the texture stack so that it will show while in Texture Paint Mode. If you do this it's actually a very efficient workflow for painting your blend map and checking the results. $\endgroup$
    – Mentalist
    Apr 24, 2016 at 5:44
  • $\begingroup$ Here's an example .blend of the setup I explained in my comment. When painting turn nodes off, and when render-previewing turn them on. Don't forget to save the textures you paint, as they won't be automatically saved when you save the .blend file. $\endgroup$
    – Mentalist
    Apr 24, 2016 at 5:57
  • $\begingroup$ "you can't see the alpha channel in the 3D Viewport or paint it in Texture Paint Mode." No, you can paint alpha in Texture Paint mode. You can choose add or erase alpha option from the blending method. See this $\endgroup$ Jul 30, 2022 at 5:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .