custom splat shader with bump maps

Hi All, I have a requirement for a shader in my current project. There is some budget available in the project to cover a reasonable cost for producing something that fits our needs.

I need an outdoor terrain with a mixture of tiled textures, but for various reasons I’m unable to use Unity’s terrain engine in this project, so I’m looking for a shader similar to the terrain engine shader, which will allow our 3D artists to use their own terrain with multiple textures blended over a single surface (i.e. a ‘splat map’).

However we also require that each texture has its own bumpmap, and - ideally - specular map, which is also blended using same alpha map controller as is used to blend the colour maps.

On top of this, we then need a lightmap layer which affects the entire surface.

I have found three shaders on the unifycommunity wiki which use an alpha mask to mix tiling textures, but none really come close to the functionality I need.
“LayerShader” just mixes two colour maps, no bump mapping or lightmap.
“TerrainFourLayer” is the same, but four colour maps.
“TerrainTwoLayerBumped” mixes two, but applies a single bump map over the result.

If this shader is for some reason completely impractical or impossible to implement, a solution enabling three, or even worst-case two sets of Colour Bump maps, with a lightmap layer over the top, would be great.

In addition, I guess it would need fallback modes where perhaps the bump/specular is omitted. Being a complete shader n00b there are probably other specifications that I have missed out, however this is what my 3D guy has provided as a specification for our ideal needs:

5 colour mixable shader with bump and a single lightmap slot.

Specifically:

Basecolour [rgba] and normal [rgb]

  • rgb : red green blue
  • a : specular
    Base colour normal [rgb]

Mix colour 1 [rgba]

  • rgb : red green blue
  • a : specular
    Mix colour 1 normal [rgb]

Mix colour 2 [rgba] and normal [rgb]

  • rgb : red green blue
  • a : specular
    Mix colour 2 normal [rgb]

Mix colour 3 [rgba]

  • rgb : red green blue
  • a : specular
    Mix colour 3 normal [rgb]

Mix colour 4 [rgba] and normal [rgb]

  • rgb : red green blue
  • a : specular
    Mix colour 4 normal [rgb]

Specular controls

Mixer map [rgba]

  • r: mix colour 1
  • g: mix colour 2
  • b: mix colour 3
  • a: mix colour 4

Light map [rgba]

Hope this makes sense!

  • Ben

This should help get you started:
http://www.unifycommunity.com/wiki/index.php?title=FourSplatBlendWrapShader

You should be able to blend 4 splats using 16 unique splats from a single texture.

If you put the bump map in the alpha channel of the diffuse texture, you could do all the blending with a single texture.