   GLSL Terrain Splatting w/ 16 Textures
  Hello, I have recently been required to create a GLSL texture splatting shader that supports 16+ textures.  Prior implementations I have seen use an alpha texture, and are limited to 4 splatted textures (one for each RGBA element).  I have decided to use a GL_LUMINANCE texture do designate the tilemap of the terrain.  Each pixel in this texture contains a value from 0-15, designating the appropriate texture to that location.Any implementation ideas before I start?   
  Make sure you read through the Lighthouse3D Tutorials about texturing and have a good understanding of it. Also, remember you need to set the texture unit by using the glUniform1*() functions before you render.Also, I'm not sure about modern hardware, but accessing 16+ textures might get extremely slow, but you'll have to see how you fair.This should be fairly easy to implement actually.I'd suggest having an array of 2D Samplers in your GLSL, and the returned value from your luminence texture is the index into that array.Cheers   ;  Well, if you apply a specific luminance range to each texture you'd have to go without blending, i.e. you'd get sharp transitions between different textures.I use a shader that is able to blend up to 4 tile maps per pixel and can choose from up to 256 tile maps with only 3 texture slots.Basically I have a big texture atlas that contains all the tile maps (i.e. all the different ground types). It can contain 2x2, 4x4 or 16x16 different ground types - or even another combination if you do the math within the shader right.The other two textures are an index map (like your luminance texture, but all 4 channels are used) and a weight map. Inside the shader the appropriate tilemaps and offsets into the tilemaps are calculated and the textures are blended. This results in 6 texture reads per pixel, 1 for the index and weight maps each and 4 for the individual tilemaps. It would work with 2 or 3 texture reads too, if you restrict yourself to only 1 or 2 tilemap(s) per pixel which would allow you to combine the luminance and weight maps.Maybe this technique also fits your needs.   ;  If your terrain is subdivided enough in even increments:Send your weight attributes per-vertex as multi-texture coordinates. Then you can have 7*4 texture weights (the 8th would be the tile texture coordinates).  The textures can just be 1 3d texture with 16 levels deep.The downside is that this requires you to do 16 lookups no matter what. Most parts are only grass, or grass blended with sand.  So you can also just say that each vertex can have at max 4 textures associated to it. You would then send a multi-texcoord for weigths (x,y,z,w) and a multi-texcoord for indexing into the 3d texture (x,y,z,w).   