Quite the same as above. Extend Urho's texture limit to at least eight textures (see above, has been increased to eight there).

Material.xml: Added a new number one for black (and lowered specular brightness and texture repeating to see the textures better in the screenshot).

    <technique name="Techniques/TerrainBlend_6splat.xml" />
    <texture unit="0" name="Textures/TerrainWeights.png" />
    <texture unit="1" name="Textures/black.png" />
    <texture unit="2" name="Textures/red.png" />
    <texture unit="3" name="Textures/yellow.png" />
    <texture unit="4" name="Textures/green.png" />
    <texture unit="5" name="Textures/cyan.png" />
    <texture unit="6" name="Textures/blue.png" />
    <texture unit="7" name="Textures/magenta.png" />
    <parameter name="MatSpecColor" value="0.1 0.1 0.1 16" />
    <parameter name="DetailTiling" value="16 16" />

The technique.xml file is identical to the default terrain technique.

GLSL Shader:

uniform sampler2D sWeightMap0;
uniform sampler2D sDetailMap1;
uniform sampler2D sDetailMap2;
uniform sampler2D sDetailMap3;
uniform sampler2D sDetailMap4;
uniform sampler2D sDetailMap5;
uniform sampler2D sDetailMap6;
uniform sampler2D sDetailMap7;  // eight textures in total for the weight map + seven splatting textures
void PS()
    vec3 colors = texture2D(sWeightMap0,vTexCoord).rgb;
    vec3 weights_rgb = colors;
    vec3 weights_ycm = colors;

    weights_rgb.r=clamp(colors.r-(colors.g+colors.b),0.0,1.0);         // red
    weights_rgb.g=clamp(colors.g-(colors.b+colors.r),0.0,1.0);         // green
    weights_rgb.b=clamp(colors.b-(colors.r+colors.g),0.0,1.0);         // blue 
    weights_ycm.r=clamp(colors.r*colors.g,0.0,1.0);                    // yellow
    weights_ycm.g=clamp(colors.g*colors.b,0.0,1.0);                    // cyan
    weights_ycm.b=clamp(colors.b*colors.r,0.0,1.0);                    // magenta
    float black=1.0-clamp(weights_rgb.r+weights_rgb.g+weights_rgb.b+   // black weight

    vec4 diffColor = cMatDiffColor * (
        black         * texture2D(sDetailMap1, vDetailTexCoord) +  // black   <- added black
        weights_rgb.r * texture2D(sDetailMap2, vDetailTexCoord) +  // red
        weights_ycm.r * texture2D(sDetailMap3, vDetailTexCoord) +  // yellow
        weights_rgb.g * texture2D(sDetailMap4, vDetailTexCoord) +  // green
        weights_ycm.g * texture2D(sDetailMap5, vDetailTexCoord) +  // cyan
        weights_rgb.b * texture2D(sDetailMap6, vDetailTexCoord) +  // blue
        weights_ycm.b * texture2D(sDetailMap7, vDetailTexCoord)    // magenta


Terrain 7splat

One could also use black as a weight with just the default terrain material with three terrain splatting textures (making it four splatting textures) or with the three plus alpha (making it five).

Note: there are also texture count limits in OpenGL and DirectX, so you can't increase the texture count endlessly. I heard OpenGL 2.0 should be able to have at least eight textures and OpenGL 3.0 at least 16.

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.