I'm still working on drawing my grass plants in Caveman 3.0.
Shader test 5 is drawing 1 million instances of the same mesh and texture, with animation based on wind.
I've just finished getting some decent plant meshes and textures going, as well as the code to generate the plants for.a temperate savanna terrain chunk, with nice scale, jitter, etc. I tested 12 different plant meshes vs 25 different plant textures
So now its time to combine the two.
there are 90,000 plants in a 300 foot wide terrain chunk.
i'd like to allocate the chunk instance VB's just one time at program start, and simply size them "big enough".
so do i make 22 instance VBs of 5000 plants each? one for each mesh and texture combo, then make 22 draw calls?
or do i just make 4 instance VB's - one for each mesh, and add some var to the instance data that says which texture to use - and make 4 draw calls?
i suspect dx9 is limited to 8 textures...
and different types of terrain might have a different number of mesh and texture combos that look good.... ugh!
it would probably be a good idea to keep the number of mesh and texture combos for all chunks the same, regardless of terrain type. that way you don't have unused instance VBs in some chunks. OTOH... the chunks for terrain types that that don't have instanced plants will have unused VB's all the time, so.... maybe its not a big deal.
I'm pretty sure all terrain types that will use instancing will draw the same number of instances (90,000 - one every foot on average). so if i keep the number of mesh types the same for all chunks, i should get fairly decent memory usage. needless to say, chunks that don't use instancing will still have unused instance VBs - se la vie. But i've already added them to chunks, just to make sure there's enough memory. I added 4 VBs of 25,000 instances each to a terrain chunk.
maybe just kick that up to 10 VBs at 10-15,000 instances each or something?
figure out the least number of mesh types a terrain type has, then use that as how many VBs all chunks have, and pick the best meshes for each terrain type?
or figure out the terrain type with the most types of meshes, and make that how many VB's a chunk has? but size them for the terrain with the least number of mesh types, and thus the most number of instances? so say 12 mesh types max, so 12 VB's, but there may be only 4 mesh types in some terrain, so make them at least 25-30,000 instances each, not just 90,000/12+some extra = 8000-9000 instances each.