It's possible to also use the alpha channel as a color weight to get an additional texture for the terrain (or something else). (Using alpha/transparency makes drawing (at least in Gimp) difficult, see this next HowTo for a better editable improvement with six colors&textures: Expand default terrain material to 6 textures using the six primary&secondary colors).

Add another texture to the terrain material "Data/Materials/Terrain.xml" like:

    <technique name="Techniques/TerrainBlend.xml" />
    <texture unit="0" name="Textures/TerrainWeights.png" />
    <texture unit="1" name="Textures/" />
    <texture unit="2" name="Textures/" />
    <texture unit="3" name="Textures/" />
    <texture unit="4" name="Textures/" />
    <parameter name="MatSpecColor" value="0.5 0.5 0.5 16" />
    <parameter name="DetailTiling" value="16 16" />

For OpenGL: Change the "CoreData/Shaders/GLSL/TerrainBlend.glsl" to additionally use the alpha channel:

uniform sampler2D sWeightMap0;
uniform sampler2D sDetailMap1;
uniform sampler2D sDetailMap2;
uniform sampler2D sDetailMap3;
uniform sampler2D sDetailMap4;          // <- added
void PS()
    // Get material diffuse albedo
    vec4 weights = texture2D(sWeightMap0, vTexCoord).rgba;             // <- changed
    weights.a=1.0-weights.a;                                           // <- added. Alpha should be weight in reverse (easier editing)
                                                                       //    with 0 (fully transparent) being full weight.
    float sumWeights = weights.r + weights.g + weights.b + weights.a;  // <- changed
    weights /= sumWeights;
    vec4 diffColor = cMatDiffColor * (
        weights.r * texture2D(sDetailMap1, vDetailTexCoord) +
        weights.g * texture2D(sDetailMap2, vDetailTexCoord) + 
        weights.b * texture2D(sDetailMap3, vDetailTexCoord) +          // <- changed
        weights.a * texture2D(sDetailMap4, vDetailTexCoord)            // <- added

If you want to use DirectX, also change the HLSL accordingly.

Use another splatting image (watch out for high red/green/blue values inside the alpha, it should be black with high alpha). My texture weight image and the result look like this:

Rgba terrain

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.