I’m trying to create a splat shader which blends four textures based on the RGBA channels of a fifth texture. I’ve been mucking about with Bill’s LayerShader, but I can’t figure out a way using the fixed pipeline to blend based on anything other than the alpha channel.
Could someone perhaps point me in the right direction on this?
This can be hard to do in fixed function. About the only way I an think of is using dot product texture combiner, but then you’ll probably run into combiner count limit. In a shader that would be much easier.
Eek, it’s not even documented! Adding note for myself to doc it…
It’s basically “dot3rgba” operator, so where you could write something like
combine texture * primary
in a similar way you can write
combine texture dot3rgba primary
This treats both arguments as signed numbers (black=-1.0, gray=0.0, white=1.0), does a dot product between them, and outputs the value to RGBA channels. There’s also a “dot3” operator, the only difference is that it outputs to RGB channels only, leaving alpha unmodified. Both are direct correspondence to ARB_texture_env_dot3 OpenGL extension.
…but now that I think of it, it probably will be really hard to blend four textures using RGBA channels as blend weights in fixed function.
That means we need more and better docs… Point taken And the four-layer terrain shader is on it’s way to the wiki…