Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

SSAO slow downs in when switch to deferred mode

Discussion in 'Editor & General Support' started by LongMozart, Aug 15, 2012.

  1. LongMozart

    LongMozart

    Joined:
    Jul 5, 2011
    Posts:
    26
    Hi there

    I have just run into a very annoying issue. I am converting my scene to a night scene with a lot of lights so naturally I switch to deferred lighting. The thing is in deferred lighting mode, the SSAO runs really really slow. According to the profiler, SSAO takes only 8ms in forward lighting mode but jumps to 40ms when I switch to deferred lighting. My framerate drops dramatically as a result. Anybody know what cause this slow down in the SSAO script.

    Bests

    Long Nguyen
     
  2. LongMozart

    LongMozart

    Joined:
    Jul 5, 2011
    Posts:
    26
    Can anyone give me some advice. I am using unity 3.5.3f
     
  3. zelmund

    zelmund

    Joined:
    Mar 2, 2012
    Posts:
    437
    works fine for me. cant see drop of freme rate by switching in lighting modes
     
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    I would assume that your GPU is already heavily taxed by deferred on itself (its rather fillrate intense if you use many lights that fill lots of screen space, the higher the resolution the heavier it hits), so when you switch on SSAO, which is a fillrate bomb too, you then exceed the fillrate your gpu offers per second which in consequence means the FPS will drop (fillrate is a constant: fillrate per sec = pixels filled per frame * fps). That you are able to see it means that it drops far enough to no longer be smooth and above the screen refresh rate.

    Try reducing the screen space filled by your lights or alternatively use a screen resolution thats appropriate for your gpu when using deferred and SSAO as deferred with your number of lights and their screen coverage + SSAO + your resolution seems to be beyond your gpus reach.

    Alternatively: Do you really need all these lights to be dynamic? Would a directional lightmap + lightprobes cost you too much visual quality? Cause if not that would solve your problem pretty much I would assume
     
  5. LongMozart

    LongMozart

    Joined:
    Jul 5, 2011
    Posts:
    26
    Hi dreamora.

    Thank you for you reply. I am reading it right now.

    I have just further noticed that this slow down ONLY occur when I use HDR, otherwise the SSAO does NOT slow down in deffered mode.
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    That definitely points towards 'going too far for your hardware' as HDR is another heavy thing that requires a lot of processing power, as SSAO and Deferred rendering.

    What GPU do you have and what resolution do you run at in the build when testing?
     
  7. LongMozart

    LongMozart

    Joined:
    Jul 5, 2011
    Posts:
    26
    I am using an Nvidia GT 555M, which is a very decent GPU, the resolution I am using is relatively low, about 960 x 540.

    I understood your explanations. They sounded reasonable. But apparently fill rate is not what causes my problem.

    I keep noticing more and more strange things about this SSAO slow down. It already occurs in my daytime scene where I have only one directional light (the sun) with soft shadow.

    Now the strangest thing: When I switched to deferred mode for nighttime lighting with about 50 point lights, and turned the sun off, then the SSAO jumps from 5ms to about 20ms or even 30ms. Strangely, if I left the sun on, or at least let it affect only a few objects, then SSAO does NOT slow down. As soon as I disable the sun or its shadow, SSAO slow downs immediately. I suspect that this has something to do with the shadow map calculation?

    (FYI, the 50 no-shadow point lights only affect a few objects to produce the correct specular highlights, all diffuse lighting has been baked into lightmap using V-Ray, I wrote my own shaders to work with these lightmaps and these shaders use the default BlinnPhong lighting model so that they are supported in deferred mode).