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
User avatar
ivand
Posts: 134
Joined: 27 Jun 2007, 17:05

Screen Space Ambient Occlusion (SSAO) widget

Post by ivand » 28 Apr 2019, 13:09

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
11 x

Google_Frog
Moderator
Posts: 2434
Joined: 12 Oct 2007, 09:24

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by Google_Frog » 04 May 2019, 16:50

It's cool that this sort of stuff can be done in screen space.
2 x

raaar
Metal Factions Developer
Posts: 813
Joined: 20 Feb 2010, 12:17

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by raaar » 08 May 2019, 21:57

what's the performance impact of that?
1 x

User avatar
ivand
Posts: 134
Joined: 27 Jun 2007, 17:05

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by ivand » 09 May 2019, 02:32

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.
1 x

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14585
Joined: 17 Nov 2005, 02:43

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by Forboding Angel » 10 May 2019, 01:00

1 x

User avatar
ivand
Posts: 134
Joined: 27 Jun 2007, 17:05

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by ivand » 10 May 2019, 07:48

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.
0 x

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14585
Joined: 17 Nov 2005, 02:43

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by Forboding Angel » 10 May 2019, 09:20

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?)
1 x

User avatar
ivand
Posts: 134
Joined: 27 Jun 2007, 17:05

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by ivand » 10 May 2019, 09:30

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.
0 x

User avatar
very_bad_soldier
Posts: 1371
Joined: 20 Feb 2007, 01:10

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by very_bad_soldier » 12 May 2019, 12:30

Has someone screenshots at hand that show how this looks in a regular game (in a regular distance)?
0 x

User avatar
ivand
Posts: 134
Joined: 27 Jun 2007, 17:05

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by ivand » 12 May 2019, 19:11

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.
0 x

User avatar
very_bad_soldier
Posts: 1371
Joined: 20 Feb 2007, 01:10

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by very_bad_soldier » 15 May 2019, 18:17

Ok, I understand, thanks anyway.
0 x

User avatar
ivand
Posts: 134
Joined: 27 Jun 2007, 17:05

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by ivand » 15 May 2019, 19:19

I'll also post some pics here when I'm back from vacation.
0 x

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14585
Joined: 17 Nov 2005, 02:43

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by Forboding Angel » 21 May 2019, 03:38

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?
0 x

User avatar
ivand
Posts: 134
Joined: 27 Jun 2007, 17:05

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by ivand » 21 May 2019, 07:31

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.
2 x

User avatar
ivand
Posts: 134
Joined: 27 Jun 2007, 17:05

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by ivand » 21 May 2019, 17:02

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
1 x

User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10223
Joined: 24 Jan 2006, 21:12

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by PicassoCT » 25 May 2019, 16:50

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
0 x

User avatar
ivand
Posts: 134
Joined: 27 Jun 2007, 17:05

Re: Screen Space Ambient Occlusion (SSAO) widget

Post by ivand » 26 May 2019, 11:08

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
0 x

Post Reply

Return to “Lua Scripts”