DIF Performance in TGEA
by DragonSix · in Constructor · 07/03/2008 (2:05 pm) · 9 replies
When I put ~15 000 polygons worth of my own DIFs on screen, TGEA is crawling to 20/40 fps.
Knowing what my computer is, Core 2 Duo 3ghz, Geforce 8800gt 512mo , 2go DDR ram, which runs totally smoothly Crysis in high, I suppose there's something very wrong.
Plus, the base DIFs in the barricade demo are way more complex than mine, and runs way smoother (~100fps).
I do not use portals, neither "detail meshes" (I don't even know what it is). I imported my DIF with the "export in DIF" base option of the last Constructor 1.0.51.
As soon as I look away from the DIFs, it goes back to normal even if there's more polygons on screen (with static shapes for exemple).
I will try to export with previous version of Ctor maybe...
Knowing what my computer is, Core 2 Duo 3ghz, Geforce 8800gt 512mo , 2go DDR ram, which runs totally smoothly Crysis in high, I suppose there's something very wrong.
Plus, the base DIFs in the barricade demo are way more complex than mine, and runs way smoother (~100fps).
I do not use portals, neither "detail meshes" (I don't even know what it is). I imported my DIF with the "export in DIF" base option of the last Constructor 1.0.51.
As soon as I look away from the DIFs, it goes back to normal even if there's more polygons on screen (with static shapes for exemple).
I will try to export with previous version of Ctor maybe...
#2
I should've read the DIF section of TDN before going head down into the interior creation.
07/03/2008 (2:35 pm)
Thanks David, now I see why it was so slow. I had a lot of intersecting brushes ^^'I should've read the DIF section of TDN before going head down into the interior creation.
#3
07/03/2008 (2:50 pm)
Actually, as long as you go in and change the brushes that are causing the problems and re-export, you should be fine. You shouldn't have to do a huge amount of reworking.
#4
07/03/2008 (3:48 pm)
I got it working fast. But... what's preventing me from using only (or almost only) detail brushes? Portals will?
#5
Also, keep the texture sizes down, and the number of textures down. If it comes down to you can do either one (have smaller and more numerous textures, or have larger and less textures), in general (but not always), less textures wins.
07/03/2008 (4:31 pm)
If you want to portalize your dif, then you need to use structural brushes. In general, the brushes that define your structure (like walls, floors and ceilings) should be structural brushes, and the rest should be detail brushes.Also, keep the texture sizes down, and the number of textures down. If it comes down to you can do either one (have smaller and more numerous textures, or have larger and less textures), in general (but not always), less textures wins.
#6
And because those hidden faces aren't removed, you can wind up with overlapping faces that flicker and strobe as the engine tries to draw them both in the same space -- z-fighting.
It's much better to develop good level-building habits, avoiding overlapping brushes and trimming what you can't avoid. Reserve detail brushes for things that really are details, like columns, architectural widgets, and so on, things that would otherwise break up your structural brushes into lots of little brushes.
As for portals and LOD, do yourself a favor and look up tutorials on them. They rock!
Portals are invisible brushes that seal off doors and windows on your DIFs. If the engine can't see a portal, it doesn't draw anything beyond it, which means it won't have to render thousands of polygons that you won't see. (Makes sense, right? If you can't even see the doorway, why waste time drawing what's on the other side? Portals tell the engine where those doorways are.)
LOD is a tiny bit more complicated to implement... it involves making a lower-poly version of your building that gets swapped out at a distance you specify. So, your elaborate building can have 50,000 polygons up close, when full detail is needed. But when the player is half a mile away, all they can see is the tiny rectangular shape of your building, so you can swap out your 50,000 poly model with a simple 6-poly box. You can create multiple levels of detail so the transition from high-detail to no-detail is nice and smooth. Massive savings on rendering time, especially when you have complex buildings.
Both of those techniques can make your frame rates zoom.
07/03/2008 (4:44 pm)
As I understand it, changing all your brushes to detail brushes can introduce performance issues. In Constructor, detail brushes do not have hidden surfaces removed, so you waste some processing time drawing faces that nobody will ever see. Multiply that by every brush in your level, and it could be a substantial hit.And because those hidden faces aren't removed, you can wind up with overlapping faces that flicker and strobe as the engine tries to draw them both in the same space -- z-fighting.
It's much better to develop good level-building habits, avoiding overlapping brushes and trimming what you can't avoid. Reserve detail brushes for things that really are details, like columns, architectural widgets, and so on, things that would otherwise break up your structural brushes into lots of little brushes.
As for portals and LOD, do yourself a favor and look up tutorials on them. They rock!
Portals are invisible brushes that seal off doors and windows on your DIFs. If the engine can't see a portal, it doesn't draw anything beyond it, which means it won't have to render thousands of polygons that you won't see. (Makes sense, right? If you can't even see the doorway, why waste time drawing what's on the other side? Portals tell the engine where those doorways are.)
LOD is a tiny bit more complicated to implement... it involves making a lower-poly version of your building that gets swapped out at a distance you specify. So, your elaborate building can have 50,000 polygons up close, when full detail is needed. But when the player is half a mile away, all they can see is the tiny rectangular shape of your building, so you can swap out your 50,000 poly model with a simple 6-poly box. You can create multiple levels of detail so the transition from high-detail to no-detail is nice and smooth. Massive savings on rendering time, especially when you have complex buildings.
Both of those techniques can make your frame rates zoom.
#7
07/04/2008 (8:06 am)
Continuing on what Jaimi has said about textures, does the same theory apply to brushes. I have the habit of using the knife which breaks the brush down. In short, should there be the same number of brushes as there are textures, or is there a ratio to follow. As much as I love the knife I always second guess when I use it but I talk myself into it with the ability to unify textures.
#8
@Meyou: truthfully, I'm not sure; but I've found that when you want more detailed light maps that having a few smaller brushes as compared to one big brush gives me better results. I guess it would be a decision on what works best for you: having more detail or simpler construction and compare the performance results.
Also: pay attention to the xx.txt file that gets outputted when you export to dif. If you have a one room dif but have 17 zones then you have lots of extraneous brushes being formed due to overlap. Debug-render mode can help you spot these 'extra' zones.
These are mostly my own observances based on trial and error and the final results. Over time I've found that using these simple guidelines improves the overall performance of my .dif s.
07/04/2008 (9:49 am)
Just to reiterate: Use detail brushes to prevent structural brushes being broken up into several brushes. Structural brushes get broken up whether they overlap or have face-to-face brushes. LOD is your friend - yeah it can be tedious but it beats rendering that 50,000+ poly monster when all you can see is maybe 50. Definitely make use of portals to close off open doorways and/or windows - especially if you don't want rain inside your buildings. To increase performance when using lots of detail brushes make use of the null texture on surfaces that can't be seen - that will also fix the flicker and strobing (z-fighting) mentioned above. @Meyou: truthfully, I'm not sure; but I've found that when you want more detailed light maps that having a few smaller brushes as compared to one big brush gives me better results. I guess it would be a decision on what works best for you: having more detail or simpler construction and compare the performance results.
Also: pay attention to the xx.txt file that gets outputted when you export to dif. If you have a one room dif but have 17 zones then you have lots of extraneous brushes being formed due to overlap. Debug-render mode can help you spot these 'extra' zones.
These are mostly my own observances based on trial and error and the final results. Over time I've found that using these simple guidelines improves the overall performance of my .dif s.
#9
Lets take the Cathedral.csx as an example. As a test (just today) I exported this with 100% of the brushes set to detail brushes. This resulted in a framerate of 59.1fps.
Then, I exported it as-is (all structural brushes). This blew up. So I went through and put detail brushes where I could, and got it to export. This resulted in a frame rate of 54.2 fps.
As you can see - sometimes it is the case where you don't want to have any HSR. (you can just turn it off in the options without setting everything to detail though). This test was done in TGE (not tgea).
07/04/2008 (2:43 pm)
The best thing to do is measure and see. Having more polygons is worse than having less polygons in most cases - just like having more textures is worse than having less textures.Lets take the Cathedral.csx as an example. As a test (just today) I exported this with 100% of the brushes set to detail brushes. This resulted in a framerate of 59.1fps.
Then, I exported it as-is (all structural brushes). This blew up. So I went through and put detail brushes where I could, and got it to export. This resulted in a frame rate of 54.2 fps.
As you can see - sometimes it is the case where you don't want to have any HSR. (you can just turn it off in the options without setting everything to detail though). This test was done in TGE (not tgea).
Associate David Montgomery-Blake
David MontgomeryBlake
Here is a good explanation of detail brushes.