2D Ambient Shadows

I had the crazy idea of adapting the SSAO technique to work in 2d, and after a few days of tinkering I’ve actually got some nice results:

http://www.triangularpixels.com/DreamCascade/Screenshots/AmbientShader_FinalComposite.png

Since I figured other people might be interested, I’ve done a proper write up, with more screenshots and shader code for people to pinch. Enjoy.

Hey, this is pretty neat! Never occured to me that this effect could be applied to 2d as well! :smiley: Thanks for sharing this, I’m planning to do some shader stuff in my next game, so this’ll be useful later. :slight_smile:

Good job, awesome result. :slight_smile:

Looks really good, great idea.

Could it be done in java2D? It probably wouldn’t be fast enough since as soon as you touch the individual pixels in an Image it makes the image un-accelerated. What a pity.

[quote=“CommanderKeith,post:4,topic:32130”]
As a preprocessing step, why not. In real time, no. :slight_smile:

Not in realtime, you need a pixel shader to calculate the ambient map - you can’t emulate it with some java2d composite modes. And even if you could i suspect it’d be far too slow anyway.

(source code tweeked to properly show < > etc, thanks Riven).