Archived

This topic is now archived and is closed to further replies.

RandomLogic

hierarchical or batched rendering? (sorry for the length)

Recommended Posts

Here''s how I currently handle objects in my engine. it''s important to state that the scenes I expect to display are a bunch of objects floating in space: A single 3D object holds a list of all instances of that same type (i.e. same model for all instances, each instance different position velocity etc.). After a culling pass I set the render states for that object and render all non culled instances. This way I get all the objects of the same type to render without state changes... Now I want to support hierarchical rendering and I''m stuck with the dilemma which would be more costly: 1) Doing extra changes to the World Matrix while still doing batched renders. This method implies that each parent object would have to save it''s world matrix and that each child would have to get it''s parent''s matrix and multiply/save it''s local. It also implies that I have to make sure that there''s no way that some A is parent of B and at the same type a different instance of B is a parent of some different A (something I''m not quite sure how to uphold). 2) Render according to hierarchy, each time resetting the render states. I''m talking about up to a few thousands of objects but I guess only a few hundred would have a child. The poly count doesn''t matter here as far as I can say. This is where you show me a graph (bench mark!?) of render state changes in relation to FPS . Ohh and of course the same graph onky with matrix multiplications... But seriously is there some clever way to have both? if not I''m looking for peoples expirience with either method. Cheers, RL

Share this post


Link to post
Share on other sites
Well if no one can plot out a graph, then maybe an article? Believe me I went through this site, GamaSutra and flipcode before I asked my question, and couldn''t find anything of use... or might be I just don''t know the right keywords. At least someone drop in here the correct technical term for hierarchical rendering methods so I can have a tree to bark up at

Thanks,
RL

Share this post


Link to post
Share on other sites
Believe me I thought about that. But I do like shortcuts when I can find one. I won''t be able to get an accurate measure of somehting like this without having a detailed hirarchy, and I won''t have a detailed hirarchy till I implement one... It''s a vicious cycle. There should be people out who are a lot smarter than me with possibly years and years of expirience on me, so what''s the harm in asking for pointers I say.

Share this post


Link to post
Share on other sites
As always with question like this one, there is no general answer. It depends on too many factors, making it impossible to give even a remotely accuracte prediction.

1) it depends on your general engine design: what kind of hierarchy, how deep, how many renderstates do you have per frame, what's the average render state to leaf ratio per frame, how about the mesh, what's the general polycount per object, do you use a LOD system, how do you render geometry (streamed, cached, etc), and dozen more questions...

2) it highly depends on the type of 3D scene you render: number of objects per frame, topography, how clustered are your objects, how do they interact with the hierarchy, etc.

3) Of course, it also depends on your particular 3D hardware. Some GPUs might be faster on matrix reloads, some might have faster state changes. Some hardware might do the matrix-matrix multiply on the GPU, other does not.

And don't assume that polycount doesn't matter. The state of the GPU command FIFO, as well as transform and rasterization pipeline can have a large impact on the speed of matrix reloads and state changes (sometimes the GPU has to wait for another operation to complete, sometimes there are FIFO stalls, etc).

In other words: you have to test it yourself, there is no way around that


[edited by - Yann L on December 24, 2002 10:11:36 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by RandomLogic
Believe me I thought about that. But I do like shortcuts when I can find one. I won''t be able to get an accurate measure of somehting like this without having a detailed hirarchy, and I won''t have a detailed hirarchy till I implement one... It''s a vicious cycle. There should be people out who are a lot smarter than me with possibly years and years of expirience on me, so what''s the harm in asking for pointers I say.



You could always try it, document it, make graphs and post it as an article, since there are none as you said yourself. If you always look for shortcuts/articles, it might be time to give something back to the community aswell? *grin*

Share this post


Link to post
Share on other sites