Five Texture Splatmaps

This seems like such a broad and theoretical question that it didn’t really strike me as fitting in the Unity shader section (please move it if you disagree), but I was wondering why it is that terrain splatmaps contain four textures per splat. I understand that each texture has its own alpha, in the red, green, blue and alpha channels, but surely the texture in the bottom layer wouldn’t need an alpha channel at all, as it would always be completely opaque. So working under the massive assumption that it doesn’t need a channel, why do we not tag it along for a free ride?

Now, I’m not suggesting we should all go do this, instead I’m simply asking why it is that we can’t do this, as I assume if it were possible it would already be done that way. Also please understand that shaders are currently the bane of my life, and I have next to no skill with regard to them at all. I just wish to better know my enemy.

It doesn’t work that way; the textures are layered on top of each other, otherwise they couldn’t blend. If you had a texture that everything else was drawn on top of, it would show through all the other textures. If you add another pass, then you might as well add four textures with another splatmap instead of just one (and this is what the terrain system does).

–Eric

Thanks Eric, that’s was fast! I think I understand now. So rather than it being a system of textures piled on top of each other (like with passes) where holes in the top reveal things underneath; in splatmaps, they’re all just merged into the same picture, based on normalised opacities for each pixel, and then are subsequently treated as a single pass per four textures? If so, then would I be right in thinking that the order of layered textures is inconsequential?

Yep, the order doesn’t matter. If the channels of a pixel in the splatmap add up to more than 1.0, then you get weird overbrightening of mixed textures. On the other hand, you can darken textures if a channel is less than 1.0 and the other channels are 0.0, so in a sense solid black might be considered a “fifth texture”. (That’s not something you can do with the terrain editing tools in Unity; you’d have to edit the splatmap in Photoshop.)

–Eric

Ah got it. That’s all good to know actually. I might have a shot at using the overbrightening and darkening to add some variation to tiled textures.

Thanks again!