I have come into a road block with my current project which goal is to test my rendering engine. The problem occurs when attempting to draw a multitude of small models (less than 50 triangles). Since each of those model have their own VB and IB, they are each drawn individually. Of course this higher the draw calls and each of them have very little vertices to output, leaving me bounded by CPU speed.
The solution is to batch these suckers up, but I have some doubts about how to proceed.
Note that all the models are static.
- Since each model have their own transformation matrix, do I have to pre-transform each vertex before adding it to my batch vertex buffer?
- How do I still take advantage of per-model frustum culling?
- How efficient is it to re-create the batch every frame post frustum cull checks?
The way I am currently thinking about doing this is like so:
- On startup, allocate enough memory for a static geometry batch VB & IB.
- Do the frustum cull checks on each model...
- Static models that can be batched (share same textures, materials, etc...) have each of their vertex transformed and added to the batch.
- Flush batch, rebuild it for other models that share common textures, materials...
and so on....
How efficient would it be do transform vertices and recreate the batches (multiple times) per frame? Does anyone have any insights?
Edited by french_hustler, 27 March 2013 - 06:20 PM.