Screen Space Ambient Occlusion (SSAO) widget

Screen Space Ambient Occlusion (SSAO) widget

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
ivand
Posts: 310
Joined: 27 Jun 2007, 17:05

Screen Space Ambient Occlusion (SSAO) widget

Post by ivand »

Hi.

I've decided to make a public release of SSAO widget.

If you don't know what SSAO is, please refer to https://en.wikipedia.org/wiki/Screen_sp ... _occlusion

You can also notice how it works on this side-to-side pic:
Image

The main difference to some other SSAO spring implementations, you can find in the wilds, that it doesn't freak out on the zoom out (due to g-buffer undersampling) and should handle subtle differences between different GPUs and drivers better.

The widget requires:
1) enabled deferred rendering for both models and map (AllowDeferredMapRendering = 1 and AllowDeferredModelRendering = 1)
2) /advmapshading /advmodelshading turned on
3) More or less recent maintenance branch of the engine (aka 104+). It might work on the older engines, but I give no warranty nor give any estimates whether it will or not.

Should you have any questions or encounter bugs, let me know here or open up the issue on github repo:
https://github.com/lhog/spring-ssao
Attachments
SSAO.png
(1.67 MiB) Not downloaded yet
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by Google_Frog »

It's cool that this sort of stuff can be done in screen space.
raaar
Metal Factions Developer
Posts: 1094
Joined: 20 Feb 2010, 12:17

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by raaar »

what's the performance impact of that?
ivand
Posts: 310
Joined: 27 Jun 2007, 17:05

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by ivand »

There are a number of configuration parameters that affect the performance and quality to some degree. The default settings are tunned for quality (although artistic appearance might need some adjustments).

Generally it is certainly not free. Last time I checked the impact was around 10 out of 130 FPS for me. You need to test it yourself though as different resolutions, drivers and GPU might perform vastly different.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by Forboding Angel »

ivand
Posts: 310
Joined: 27 Jun 2007, 17:05

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by ivand »

Hi. Thanks for reporting.

I'll be on vacation for several days. In the meantime can you do me a favor:
1) Can you tell if other deferred widgets like lights, bloom work for you?
2) Did you change anything in my source code?
3) Can you make screenshots on some brighter map and upload them as attachments to the forum? Imgur is hard to use on my smartphone.
4) Can you change BLUR_PASSES to 0 and after SSAO_KERNEL_SIZE to say 8 and report whether these two steps changed anything. If not I'll find you on discord when I'm back.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by Forboding Angel »

So far, this only happened on that specific map. Haven't been able to reproduce on any other map
1. All is working and so is SSAO
2. Nope
3. Sure, but any screenshots I take wouldn't help as it's working on other maps just fine as far as I can tell
4. Will test when i get a chance

I was mainly showing this so that perhaps it might help you find a potential oops that might cause it to mess up on specific maps (dark ones?)
ivand
Posts: 310
Joined: 27 Jun 2007, 17:05

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by ivand »

Makes sense. I never tested on Onyx. Thanks again.

Perhaps the normal maps from DNTS are such that they make already dark maps, look even darker. Maybe I can add additional checks in the SSAO pass so dark areas are not getting even darker or limit the SSAO to models only.
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by very_bad_soldier »

Has someone screenshots at hand that show how this looks in a regular game (in a regular distance)?
ivand
Posts: 310
Joined: 27 Jun 2007, 17:05

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by ivand »

There were several screenshots posted in the BAR discord channel. Unsure if you have an invitation to be there, alternatively you might want to have a look yourself. It usually takes around 5 minutes to set up a widget.
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by very_bad_soldier »

Ok, I understand, thanks anyway.
ivand
Posts: 310
Joined: 27 Jun 2007, 17:05

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by ivand »

I'll also post some pics here when I'm back from vacation.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by Forboding Angel »

I can't tell that this has any effect at all on my s3o units. It definitely effects features:
Off
https://i.imgur.com/R0kE87r.jpg

On
https://i.imgur.com/1lH7cWD.jpg

Am I missing something?
ivand
Posts: 310
Joined: 27 Jun 2007, 17:05

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by ivand »

This is easy to explain.

Looking at your CUS materials I can see, that deferred definitions are missing in https://github.com/EvolutionRTS/Evoluti ... apping.lua , which is responsible for rendering units with normal maps. CUS is structured such, that if you don't specify deferred shader and respective definitions, then deferred rendering path is disabled for such materials. This issue is easy to miss, because deferred is mostly used for dynamic lights system and if model's g-buffer information is missing, then light is effectively calculated based on the terrain g-buffer data.

ZK had similar issue, so I put a small widget that highlights what models have deferred path. You can witness how things look under the hood yourself: https://github.com/ZeroK-RTS/Zero-K/blo ... d_test.lua
The fix is also rather simple, you need to specify deferred shader and definitions, so models are indeed rendered into respective g-buffer. Something like this should work: https://github.com/ZeroK-RTS/Zero-K/com ... d6ab1791b2

P.S. I updated the widget slightly for another game and will put changes to the common repository soon.
ivand
Posts: 310
Joined: 27 Jun 2007, 17:05

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by ivand »

As promised before, here are some pics.

I changed widget such that only bottom part of the screen is SSAO enabled (another words you should compare top part of the screen to the bottom one).

Image
Image
Image
Attachments
screen00741.jpg
(404.22 KiB) Not downloaded yet
screen00740.jpg
(480.65 KiB) Not downloaded yet
screen00739.jpg
(345.23 KiB) Not downloaded yet
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by PicassoCT »

Seems to only affect the chili menue in Journeywar.
Image

Image

PS: Deactivated all the chilli widgetry - even then no Unit-AO. Sad Panda.
Attachments
screen00005.jpg
(555.13 KiB) Not downloaded yet
screen00004.jpg
(549.16 KiB) Not downloaded yet
ivand
Posts: 310
Joined: 27 Jun 2007, 17:05

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by ivand »

Do you have deferred shading enabled ?
AdvMap/AdvModel shading ?

Are you seeing normal map if you use test widget I suggested https://github.com/ZeroK-RTS/Zero-K/blo ... d_test.lua ?

Please follow the check-up steps I described here:
viewtopic.php?f=23&t=39443#p591153
Post Reply

Return to “Lua Scripts”