- Home /
Stuttering when using Shadows on larger resolutions when also using SSAO
I keep running into the same issue for a while now and never was able to figure out what's the deal. So I guess I try this neat Unity Answers for once. ;)
All my projects start to develop a severe case of frame rate hick-ups when using realtime shadows while also using SSAO on a viewport resolution larger than 1779 pixels in width. The height is not a problem, at least not with my display, which is maxing out at 1920x1200. There is, however, one thing to note: Sometimes this 1779px-barrier seems to be a little higher, sometimes a little smaller, albeit always present.
The next thing I can tell is that these hick-ups are quite strange in that respect that they are "regularly irregular". The editor is always rendering two consecutive frames at around 6ms, which is fine, but then one frame really slowly at around 300ms, which is of course not fine. The steps between the "bad" frames are a little larger in the stand alone version, though still present and still very annoying and not very MUCH larger. I'm just not able to count them. But it feels like it's rendering three or four frames fine and then a bad one. The steps feel consistent in length, just like in the editor, only that they are obviously a bit larger.
Now let's have a loot at what the profiler tells me when set on Deep Profile. Every frame that is rendered at around 6ms looks absolutely fine to me. Memory usage and calculation times as well as draw calls look good. But at every third, and this is a rule in the editor, there's this bad frame. And during these bad frames, the Camera.Renderer function shows me round about 300ms of time taken. When I open this Camera.Renderer element to show me the child functions it tells me that it has four children: Drawing, UpdateDepthTexture, Camera.ImageEffects and Culling. The latter three are just fine concerning the time it takes them to complete, but Drawing shows me that it takes 99.5% of the time taken to complete. Now let's open up Drawing. It has also four children: MeshRenderer.Renderer, Shader.SetPass, Shader.SetShadowCasterPass and Terrain.CullAllTerrainsShadowCaster(). But: None of them take up even one percent of the Drawing's time. But I don't find any other function or procedure that really takes all that extra time.
The only thing that is apparent to me is that, during those bad frames, the required texture memory spikes up from 95MB to 170MB - only to fall back at 95 during good frames. And that's really all I can tell from the Profiler: This spike in used texture memory and the Drawing process itself taking the biggest bite of the time taken to complete the frame, but none of its children.
So from what I can tell now I guess that the hick-ups are resulting from the delay in uploading something to the texture memory. - But what?! Nothing in my project(s) is changing every three frames. So my guess is that it has something to do with Unity, especially since I only seem to have this issue when using SSAO plus realtime shadows - both Unity's own functionality.
Now here comes my question, despite from the obvious "What the hell?! How can I fix this?!": What do you guys think? Does that sound like a bug or more like a think that I can handle myself?
I will happily serve any more information when needed to get this solved.
My hardware is, by the way, pretty much straight forward: MacPro3,1 with 2x Quad Core 2.8GHz, 10 Gig of RAM and the standard GF8800GT with 512MB of VRAM that came with those MacPros back in the day when this thing was top notch.
Well, that was a lot of text and I hope I can get this thing resolved. Plus I also hope that I was halfway able to get those infos across without being all to much complicated. I tend to get lost in details... ;)
I put a lot of time and effort into getting on the bottom this problem now but I am still not able to tell why this happens. I'd appreciate any hint that points me in a certain direction. A complete solution would sure be nice, but I'd even be very happy if I only knew why this happens at all, even if there's no solution for it...
Answer by Whimsical · Aug 29, 2010 at 08:56 PM
I was able to track the issue down to a few broken geometries, which in turn, I suspect to be a problem with the FBX exporter plug-in in Maya, because the objects seem to be technically perfectly fine and do not differ from the OK ones in no way other than their shape, of course.
So the answer to my question now is as follows: Take a look at the geometries, they might be broken. Each one of them slowed the render process down a bit, which for itself was not very clear, but this slow-down accumulated because of the multiple render passes for SSAO, shadows and the like to result in this stuttering.
Funny additional fact: On my GeForce 8800 GT in my Mac Pro (and 8400 on my MacBook Pro) the broken objects were not rendered slower by a lot, so this itself was barely noticeable. But after my 8800 GT went up in smoke two weeks ago I bought a new ATI HD 4870 for my Mac Pro. On this new card the broken objects resulted in a frame rate drop of <95%. Instead of previously 550 fps I was barely hitting 4 fps any more. (Without any post effects or shader assigned, but with the very same objects.) So there's a difference in using nVidia and ATI chips concerning this issue.
Your answer
![](https://koobas.hobune.stream/wayback/20220613065535im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Slower realtime shadow update speed? Possible? 1 Answer
How to measure the area of shadow on a GameObject? 0 Answers
How to deal with shadow scale and self-shadows? 1 Answer
Cheapest way to have Real-Time lights on Forward Rendering? 0 Answers
SSAO and Shadows On Android ( Mobile Devices ) .. Not Working ? 0 Answers