Home Unity

Few questions about total tri count, shadows, and texture resolution relating to performance

insane polycounter
Offline / Send Message
Alex Javor insane polycounter
Hey guys, I have a couple general questions about how to optimize my game better.


Im making a desktop pc game.

In the largest scenes, tri count rarely exceeds 500k, until you turn on shadows. Then it can go from 1-3 million. I've disabled shadow casting on all but the essential character and enviro pieces. I have baked reflection probes. Most scenes using an HDRI skybox for ambient lighting, and I use one or two directional lights set to realtime mode. No GI, realtime or baked. Our environment geometry is bare bones so the programmer didn't think baking lights would give us much benefit, though neither of us really know. Just speculating. First question then, is that about right? And for older machines?

Particle fx adds a big wallop to the tri count as well. We've trimmed those down mostly by reducing total number of particles and disable shadow cast. Anything else to do with that?

Texture resolution is where all the RAM goes, right? Which is going to be the bottleneck for older video cards? Initially, I had been using 2k maps for all characters, but that wasn't necessary so I reduced to 512. I thought that would be a huge performance boost but I didn't see much. Likely cause I am on a modern machine, but the goal is for the game to run well on older machines. Any way to gauge that without buying a toaster just for testing? Some metrics to look for?


An example scene :

The main thing contributing to the tri count is characters. They are still being optimized. By the end, they will be reduced by about 3/4 total tris. This will take about a weeks worth of work, but that is a week I could put into other things if I knew the benefit wouldn't be significant.... Anybody have experience with that? Would reducing tri's by a million matter much? Would time be better spent compositing the textures into atlases? For instance, about 30 character materials at 512 could become about 7 x 1k materials.

Replies

  • RyanB
    Offline / Send Message
    RyanB Polycount Sponsor
    You need to profile the game on the lowest-end machine you plan to support.  Without testing on device and profiling, you are guessing.

    But...
    You have 3099 shadow casters in your scene.  That's very high.  I would guess that literally everything in the scene is casting a high resolution shadow which is not a good thing.  Every plant, every weapon, flag, etc.

    Alternatives:
    - bake everything except the characters
    - use lightprobes

    I would only use one direct light.  Use a simple shader on anything that is not a character. 

    Design change could help too.  Make all of the unselected characters use a simpler shader and grey them out a bit.  The char you pick could be the only one using a full shader.

    Your characters probably have lots of separate pieces, like helmet, armor, etc.  If you can weld lots of small pieces into single pieces you will reduce the number of shadow casters significantly.

    Tri-count is very high for a scene like that.  You could probably reduce it to 300k and not notice the difference.

    Reducing number of textures will slightly reduce your load time and memory but is probably a very minor savings.

    If VFX is affecting your tri-count you must be using a huge number of particles or spawning some crazy meshes.

    Simplifying everything would also significantly reduce across the board:


  • Alex Javor
    Offline / Send Message
    Alex Javor insane polycounter
    thanks @RyanB .


    I have to ask my colleague about the shaders, he's the one who takes care of that. As far as the shadow casters goes, probably I can go through and just randomly select batches of trees and turn off shadows. Who'd notice? That is probably the biggest thing as there's shit tons of trees.

    But characters are the biggest thing for sure. Indeed they have lots of little pieces. They are way too complex for what they are. A lot of them have individual teeth meshes -- i've begun stripping them down so hopefully that will be enough to get us down to 500k or less.

    Thanks so much.


    *** update : well, i turned shadows off on all the hidden parts of the hexs, as well as about half the trees. also adjusted shadow distance. scene looks the same, and now has about 700 casters. What a difference.
  • Alex Javor
    Offline / Send Message
    Alex Javor insane polycounter
    about the directional lights, i am using a second one with shadows turned off solely to give the "eerie" trim light for that cheesy horror movie look. I'm not sure how else I could achieve that other than some kind of fancy GI solution?

    If I can find a better way I'll note it here, but any suggestions would be greatly apprecciated.
  • RyanB
    Offline / Send Message
    RyanB Polycount Sponsor
    about the directional lights, i am using a second one with shadows turned off solely to give the "eerie" trim light for that cheesy horror movie look. I'm not sure how else I could achieve that other than some kind of fancy GI solution?

    If I can find a better way I'll note it here, but any suggestions would be greatly apprecciated.
    Assuming you are using forward rendering, a second per-pixel directional light requires a second pass in a shader (I believe). 

    If you use a single directional light and a single pass shader you will reduce your GPU times but it's not going to affect your shadowcasters or tri-count.

    Three options instead of a second directional light:
    - light probes
    - use vertex lighting
    - shader with matcaps or some other fake lighting

    I wrote a post in this thread about using Shade4PointLights.  Haven't used it in 2019 but reading the docs I think it's still an option.

    Check your camera far plane and make sure it's as close as possible.  If you can get it to 60 units or less you could turn down your realtime shadow quality  to medium or lower and it will still look crisp which will reduce memory a bit and improve performance.

  • Alex Javor
    Offline / Send Message
    Alex Javor insane polycounter
    you deserve a medal @RyanB . I'll check these options out.
  • RyanB
    Offline / Send Message
    RyanB Polycount Sponsor
    Glad you find it useful.  There are some older threads with a lot of tips and tricks that might help:
    I think there's more if you search.

    I'm in the optimization stage on a VR game right now so I'm thinking about this stuff again.  VR forced me to optimize my VFX TOO THE EXTREME.


  • Alex Javor
    Offline / Send Message
    Alex Javor insane polycounter
    awesome, i'll check these out. We are using deferred rendering, I've learned. A number of our systems depend on that -- stuff all over my head right now. To me, a lot of this stuff is still like magic. I think before release on this game I get the characters optimized properly, get more control on the shadow casters, and that will be the most I can do this time around. Still gotta make trailers and stuff... all that marketing hoopla nobody wants to do but we just gotta. :(

    But after launch programmer and I are gonna do a little training, try to improve our tools and figure out what we can do to improve our next game. Definitely gotta spend more time learning more about lighting and shaders. I bookmark these threads you've linked. Looks like you're the go to guy @ryanb
  • Alex Javor
    Offline / Send Message
    Alex Javor insane polycounter
    @RyanB thanks again. I am going through disabling all these extraneous shadow casters and it's made almost a 10ms difference on some scenes. I haven't got all the characters optimized but I think that's going to help a lot as well.

    We also discovered that the internal geometry of our gameboard (which is never seen) is cost almost as much as our FX. Lots of little hidden things like that all add up.

    Most of our particle fx had shadow cast turned on too. Funny how clicking a simple checkbox that shows no visual difference can effect performance so much. Just a matter of knowing!

    Good luck with your project!

Sign In or Register to comment.