After reading this paper:
http://origin-developer.nvidia.com/docs ... hBatch.pdfAnd considering that all meshes in my engine pretty much use hardware geometry instancing, I decided it is affordable to try a different solution to multi-texturing. Here I am sharing it
Again, if one remembers, the problem with multi texturing is usually inherited to the use of the atlas, another problem is the number of texture sampling done in pixel shader.
Now, considering geometry shaders are the least expensive and fastest in our GPUs and the only real problem with them as actually in the CPU, how many times we call a "DrawSubset/DrawPrimitive" or any of the such, due to a overhead when the CPU is sending the request to the GPU, and taking into consideration that most engines today (mine included) use the Vertex Shader 3.0 ability for geometry instancing...
Now if you read the paper it seems the hundreds, even thousands of draw calls can be quite fine, also taking to consideration that in games you rarely have hundreds of DIFFERENT models in the screen and considering that every model which appears multiple times is simply batched via geometry instancing (so no additional draw calls)...
My solution to get rid of texture atlas (and all the brain-aching problems it brings with it, unless using hardware which supports texture arrays and therefore Shader Model 4.0/DirectX10-11/OpenGL I dunno, I don't use OpenGL) is to simply divide the mesh!
All triangles with the same material (read texture) I split to one draw call with the specific texture, no multi texturing. All triangles with multiple textures I put in another draw which uses simple texture splatting (3 textures) and that's it.
Draw calls increases by insignificant amount taking into consideration that areas usually have few dominant textures. Considering every other geometry is instanced (as I said before, 1 draw call for X entities of same model) the impact of the batches is not important.
Also taking into consideration that at least in the case of MLE we seem to be more GPU bound than CPU bound with all the post processing pixel shaders etc we're doing there, CPU is only used for Havok Physics, AI and game logic which doesn't take too much it seems (for now).
So that's it, I just wanted to share with you my new point of view on multi-texturing PolyVox geometry and the new data I gathered on the subject.
Feel free to tell me what you think, and good luck!
Advantages of this method:
Unlimited textures
No more texture atlas headaches (mip mapping/wrapping/filtering)
Simple to implement
Reduced Texture Sampling in comparison to texture splatting everything (as ker suggested)
Shader Model 2.0
GPU workload relief (due to shorter shaders, reduces texture sampling, reduces branching)
Disadvantages of this method:
Increased Draw/Batching calls
Recommended use in:
More GPU bound than CPU bound engines
Engines which already have high geometry instancing usage
Environments/Engines/Levels with low amount of Draw calls (be it due to low number of objects or geometry instancing of the objects)