I'm working on an SSAO implementation. I've had an idea to speed it up by having AO fragment shader finish faster for fragments that are not occluded (depending on the scene, this can be a significant portion of the screen in my case).

I tried a naive approach first: if, after the initial four samples the occlusion is still zero, we exit. This results in a significant speedup, but the quality deteriorates badly: the occluded portions become very noisy.

I was wondering if anyone else has attempted a similar optimization. Is there a better way to approach it?


  • $\begingroup$ The only thing I can think of is to mipmap the data you are ray marching through. Try it at a lower mip to find a collision, then try a higher mip to find a more detailed answer. $\endgroup$
    – Alan Wolfe
    Dec 1, 2016 at 4:49


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.