Improving DTS rendering performance (too many state changes)
by Manoel Neto · in Torque Game Engine · 01/19/2006 (5:16 am) · 6 replies
Does anyone have any tips on reducing the large amount of state changes while rendering many TSMeshes? We are using lots of replicators in our game (it's mostly external levels, barely no DIFs, many trees and small objetcs), and performance drops a lot when 60+ statics are in view.
A quick glance at the rendering code shows lots of OpenGL calls that could be avoided when rendering the same mesh consecutively, but it also looks like the scenegraph doesn't care about grouping objects with the same DTS and drawing them one after another. A per-material approach would be great, but I'm clueless about how to do one without transfigurating both the scenegraph and the tsmesh classes.
Any help is welcome.
A quick glance at the rendering code shows lots of OpenGL calls that could be avoided when rendering the same mesh consecutively, but it also looks like the scenegraph doesn't care about grouping objects with the same DTS and drawing them one after another. A per-material approach would be great, but I'm clueless about how to do one without transfigurating both the scenegraph and the tsmesh classes.
Any help is welcome.
About the author
Recent Threads
#2
I certainly don't have the skills to do this, but I'm sure a few people on here do... John of TLK fame for one.
Seems to me that a lot of people would benefit from a Torque Render Kit ;-)
01/19/2006 (4:32 pm)
I'm a little surprised that this optimization hasn't been done as a resource. Unless it would involve masses and masses of code changes.I certainly don't have the skills to do this, but I'm sure a few people on here do... John of TLK fame for one.
Seems to me that a lot of people would benefit from a Torque Render Kit ;-)
#3
01/20/2006 (5:22 am)
I've read that before, but only did the Canvas.cc and the terrain occlusion optimizations. I just commented the dglSetCannonicalState() call in TSStatic, and the framerate upped by 13%. I'm going to try a quick hack to reduce the state changes (basically, using extra IF statements to check if the state really needs to change) and see what happens.
#4
Synapse Gaming does a lot of contract work on Torque related products, both in and out of the community, including (though certainly not limited to) optimization, graphical/rendering enhancements, networking, and of course lighting.
Generally optimization is handled on a case-by-case basis, but we have a number of pre-rolled solutions, especially in regards to DTS rendering. Something to keep in mind during your development cycle!
-John Kabus
Synapse Gaming
01/20/2006 (5:53 am)
Hi guys, I'm flattered that I leapt to mind. :)Synapse Gaming does a lot of contract work on Torque related products, both in and out of the community, including (though certainly not limited to) optimization, graphical/rendering enhancements, networking, and of course lighting.
Generally optimization is handled on a case-by-case basis, but we have a number of pre-rolled solutions, especially in regards to DTS rendering. Something to keep in mind during your development cycle!
-John Kabus
Synapse Gaming
#5
I'm not suffering from performance problems at the moment... But I will. I plan on having objects made from a LOT of other objects.. which I think is going to eat FPS for breakfast.
01/20/2006 (6:04 am)
So no render kit then John? LOL :-)I'm not suffering from performance problems at the moment... But I will. I plan on having objects made from a LOT of other objects.. which I think is going to eat FPS for breakfast.
#6
01/20/2006 (8:43 am)
That was my approach as well, Manoel. I simply added an if(dglIsCanonicalState()) check to the beginning of dglSetCanonicalState() and returned if the renderer was already in a canonical state. I never did any serious profiling to see what this did to performance but it couldn't hurt.
Associate Chris Haigler
Jester Dance
I don't know how much of it still applies to 1.4 (the last time I really delved into the process of removing redundant state changes was over a year ago) but there are definitely some savings to be had.
I wish he had went into more in-depth talks regarding some of the optimizations (specifically the changes made to the scenegraph so it knows when it's in "3Space mode" and "canonical mode") but perhaps it'll serve as a starting point for you (or someone else brave enough to tackle the task).