Archive 17/01/2023.

Forest Scene WIP - with SSAO

krstefan42

Here’s a peek at a forest scene I’ve been working on. Right now I only have one tree model (made in Blender), but I plan to add a a lot more stuff. It uses an SSAO shader I wrote, which uses temporal reprojection to blend with the previous frame’s AO result to reduce noise (sadly it only takes into account the camera’s velocity, so fast moving objects will still have noise). I also wrote a higher-quality PCF shadow implementation, and made some other tweaks to the lighting code. I’ll upload the SSAO code when finished (right now the temporal reprojection is using a weird hack involving a magic constant. Since I don’t know why the hack fixes my code, I don’t know if it will work for other scenes with different scale parameters, FOV, etc. If anyone wants to help me figure it out I can show you the code tomorrow).

The tree model might look on the heavy side, but really fill rate is far more likely to be a bottleneck than triangle count on modern hardware, and I used some tricks to make them look more detailed than they really are (plus LOD models). The scene contains 500 trees, but I still get 60FPS thanks to the LODs.

Here’s a shot of the raw AO term:

Here’s some more screenshots, click to open.

yushli

That looks amazing. look forward to your sample project so that I can try it out.

franck22000

Looking forward for the SSAO shader release :slight_smile: Nice work !

zedraken

It is really a very nice work, very impressive !

dragonCASTjosh

awesome work and im happy to help iv been looking to do AO but hadent gotten round to it :slight_smile:

Lumak

This looks great!

codingmonkey

nice! :slight_smile:

sabotage3d

There is already SSAO by reattiva, but it is quite old now. I think it was AngelScript and I ported it to back C++. This is my repo: github.com/sabotage3d/UrhoSSAO

krstefan42

Thanks guys!

Hmm, I didn’t know someone had already done SSAO. I wonder why it hasn’t been merged into master? His implementation seems fairly similar to mine, but he uses a bilateral blur instead of temporal reprojection to reduce noise (reprojection is better and faster in theory, but my implementation is flawed because it doesn’t account for per-object velocity (which is not even possible without changes to the engine)). I figured out why I need the “magic constant” of around 500, and how to calculate the value properly from the FOV, thanks to a comment in his code. I’ll see if I can learn anything else from his implementation.

Bananaft

Looks lovely. Can you tell a bit more about your changes in lighting and shadows?