Ambient occlusion in combination with real-time lights

Hi! First of all, I must note that I feel like I have a very limited understanding of the lighting system in Unity, I’m more experienced in Blender. I’ve read a lot of documentation but it just seems like I’m missing something essential and that Unity is constantly working against me in anything I try. So any help or explanation is really welcome!

So I would like to have ambient occlusion in my game scene, but not the real-time image effect one since that doesn’t look very good to me and slows down my game. In the Scene Lighting Settings, there’s an option for ambient occlusion under “Baked GI” which I’d like to use. But I would also like to be able to change the intensity of my main light object in-game, so that I can create day and night. But for that, the light needs to be in real-time, which makes the ambient occlusion not possible.

Does this really mean I have to choose between ambient occlusion or a real-time light in my game? Or am I missing something? If you need more information about my set-up to answer this, please let me know. Thanks in advance!

Your best bet here are the unity cinematic effects. The AO included in it is a deferred AO, which will also react correctly to light, so it sounds like just the ticket. These are an ongoing WIP and well worth using / updating regularly. Find it on asset store for free, or here: https://bitbucket.org/Unity-Technologies/cinematic-image-effects

For best results use Linear lighting, HDR on camera and Deferred.

I would steer quite clear from baked or mixed lighting before 5.4 is out tbh. It’s not very good, period. By contrast, Unity’s realtime lighting + enlighten is very good indeed. This is IMHO and not representative of Unity’s views (moderators are not Unity staff).

2 Likes

Hi! Sorry for the late reply.
I have tried the ambient occlusion in Unity’s standard assets before (it seems like tthat’s the effect you’re talking about), and I didn’t really like it. The quality isn’t that good and the game stutters sometimes. It would be nice to have ambient occlusion pre-calculated.

When I use real-time lights, I get weird lines inside shadows that do receive light, while that obviously shouldn’t be the case (I have added two screenshots). What might be causing this?
Thanks for answering!


He’s talking about the new SSAO effect he linked to, not the old Unity one which does suck in most cases. I haven’t found any downsides to the new one.

I don’t think you can have a dynamic light interact with baked light/ao yet, but Mixed mode might fix that when it works properly.

To fix the shadows, reduce the light’s Bias/Normal Bias and see what happens, and make sure models are welded.

For stuttering, make sure you are using one of the Unity 5.4 beta versions which are more stable.

1 Like

Thanks for the answer! It fixed the issue I had with lines in the shadows.
hippocoder mentioned I could find the cinematic image effects on the Asset Store, but there it seemed like they were the same as the image effects in the standard assets in Unity. But I’ll try the one on bitbucket he linked and see if it gives me different results.

5.4 has best results with it ie you want motion blur and temporal AA.