Post news Report RSS Lighting Wishes

You wished for it, so the Drag[en]gine delivers it!

Posted by on

In the last news post AniCator asked for ambient occlusion for the cloudy day system. First things first the Drag[en]gine knows already texture defined ambient occlusion using the ambient.occlusion texture property. You can generate these using Blender3D for example. Since he asked though if dynamic ambient occlusion would be possible I took a little side-step to plug this into the engine.

Dynamic Ambient Occlusion

Dynamic ambient occlusion is something game developers like to use since some time. You can plug those in as a post-processing effect and get done with it. Unfortunately most implementations found so far in games are crappy. I do not wanted to have crappy SSAO in the game. Better no SSAO than crappy one. So I dug around recent implementations evaluating their usefullness (and/or crapiness) with my own modification idea in mind. As it turns out somebody else had a similar idea just recently which is usually a good sign if two minds come up with the same idea. The implementation sails under the name of Scalable Ambient Occlusion or SAO for short. The basic implementation is nice and is screen resolution and depth resistent with constant cost but suffers from some math which likes to produce the dark halos as mentioned in the article above. Altering the math a bit though with a more "sane" mathematical background helps to reduce the problem. Removing black halos though tends to introduce white halos but these should be less problematic.

Cheap implementations plug SSAO in as a post-processing effect messing with all lighting. This is utterly wrong and is another source of bad results. In the Drag[en]gine the ambient occlusion (both texture and dynamic) affects only the ambient lighting. The direct lighting is not "directly" affected but more about this later.

So here first some images of the SAO in action. The shadow areas receive subtle occlusion effects. Over-done SSAO looks crap so the goal has been to have physically plausible ambient oclcusion instead.

Dynamic Ambient Occlusion Dynamic Ambient Occlusion

Dynamic Ambient Occlusion

And here a test video showing first the pure ambient occlusion texture and then some sample location s with SSAO enbled and disabled. At the end you can also see how the effect does not affect geometry in plain sun light but only in shadows.

AO Self-Shadowing

With a little extra line of code in the shader the ambient occlusion can be used also to provide a form of limited self-shadow casting. The Drag[en]gine limits this to texture ambient occlusion only since this AO is of higher quality and of smaller scale. This shows the result.

AO Self-Shadowing

AO Self-Shadowing

And here a video with a turning light source. The self-shadowed version is a subtle enhancement of the shape perception with the advantage of having no additional cost (no cone-stepping required). As such though the method has it's limits.

Outlook

There's room for improvements with this entire SSAO stuff but right now it is more important to work off more of the remaining tickets for the first release.

Post comment Comments
HeadClot
HeadClot - - 461 comments

Really looking forward to the first release of this engine :)

Reply Good karma Bad karma+4 votes
SinKing
SinKing - - 3,119 comments

So much hard work went into this engine through a period of what: 5-6 years or more now? I don't know how long I have been following, but making this engine is the most impressive one man project, I know.

Reply Good karma Bad karma+4 votes
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: