@Niello; still there?
In the middle of next steps for using mesh instances instead of full mesh for every object right now.
I'm now starting to take the following approach:
- create index table in mesh class containing a list with ID's of the instances of that mesh
(or maybe do this in my scene class, like 2 dimensional array, not sure if this works memory allocation wise?)
Do this trick 2 times, one for blended and one for opaque instances
- create index table in scene cass with array per material, containing the mesh ID's of meshes using this material
(create at startup for all static objects, no solution yet for dynamic objects)
- at rendertime I split rendering into a few main steps:
1a. culling; loop through all mesh instances and check against frustum. Mark with bool visible true/false
(in the future in this step I could add binary space checking, tree's, portals or whatever)
1b. sort blended meshinstances
2. main rendering loop:
a* loop through all materials
b* select material (state changes)
c* loop through mesh index that contains which meshes contain active material
d* select mesh (state changes, set buffers)
e* for each mesh, loop through the meshinstances index
f* if meshinstance visible true/false
h* if in frustum select meshinstance (state changes)
i* for each submesh of meshinstance do 'live' check boundingsphere in frustum
j* do draw call
... till end of scene
All steps above 2x, one for opaque and one for blended.
On state changes I will definitely save quite few setstreamsources/ setindices.
I'll also do some profiling on the number of batches/ draw calls I do per frame and how many triangles they include.
What's your advice on this, am I shooting myself in the foot for expansions in the future? (i.e. combining buffers, binary space positioning etc.).
Also curious what you think about the 'shared float' thingie above.
update 21-1;
still working on it and making nice steps, just decided I want a renderqueue class to handle all this. To be able in having a flexible 'render bucket'. In the class I'll have all indices for meshes, materials, submeshes, save depths, sorting functions etc.
Still curious though on your thoughts/questions on the last updates
Edited by cozzie, 20 January 2013 - 05:17 PM.