Any way to stop SSAO appearing on certain surfaces?

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Any way to stop SSAO appearing on certain surfaces?

Postby Enjay » Tue Oct 23, 2018 6:30 pm

Can anyone suggest a way of combatting this?

I have noticed that, sometimes, SSAO will draw shadows in areas where I would rather it wouldn't. For example, here's a picture that I posted before:

Image

The texture in the alcoves is pure white and the light level is 255 yet there are still shadows in the corners. While this particular example is just that, an example, it's common to use textures such as LITE5 in bright alcoves for computers or whatever and this effect makes the LITE textures look far duller than they should. I've tried brightmaps and dynamic lights to try and counter the effect but not really had any success.

Speaking of lights, here's another situation with the same basic problem.

This model lamp, when it's out in the open is nice and bright. It has a dynamic light attached and a brightmap makes the dome nice and bright too. The dome looks like it's meant to - like a bright light source.

Image

However, place it near a wall and the bright domed light source gets a shadow on it. That's definintely not required and makes the light look odd.

Image

Of course, in this particular case, I'd like the dome to be bright but other parts could legitimately be affected by shadows.

So, is there any way to combat this? Or is it just, as Graf would put it...

Graf Zahl wrote:Making SSAO not glitch is virtually impossible. I already disabled that feature entirely for playing because I found far too many maps with high detail geometry where the drawbacks far outweighed the benefits


[BTW, I put this in assets rather than mapping because it is to do with both models and mapping and I suspect that, if there is any solution, it my come from making particular assets (textures or parts of a model skin) immune to SSAO - however, I suspect there simply won't be a solution.]
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: Any way to stop SSAO appearing on certain surfaces?

Postby Rachael » Tue Oct 23, 2018 8:14 pm

The most effective way I really know of is to do a pseudo- high-dynamic range on the textures.

For instance, you can put shaders on the textures (if your mod is intended to be GZDoom-only) like this:

FakeHDR.glsl:
Code: Select allExpand view
vec4 Process(vec4 color)
{
   vec2 texCoord = gl_TexCoord[0].st;
   return vec4(getTexel(texCoord).rgb * 1.33333, getTexel(texCoord).a);
}


gldefs.txt:
Code: Select allExpand view
hardwareshader texture BRIGHTEX { Shader "FakeHDR.glsl" }


Then - your effective colour range is from 0-192 (where 192 is full white, but with SSAO) - and everything brighter is actually brighter. The colour actual values when rendered is, in fact, stored in floats, so overbrighting it will actually work.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

Re: Any way to stop SSAO appearing on certain surfaces?

Postby dpJudas » Tue Oct 23, 2018 9:39 pm

The short answer is that currently there is no way. While what Rachael suggests will reduce the effect slightly, it will also tell the bloom pass that woah this pixel is really bright (it will most certainly bloom).

The SSAO pass itself does actually support excluding pixels from SSAO. It is used by portal entrances to reduce the visual transition between each side. I could add a nossao property to the textures in gldefs that would do what you're requesting.
dpJudas
 
 
 
Joined: 28 May 2016

Re: Any way to stop SSAO appearing on certain surfaces?

Postby Nash » Wed Oct 24, 2018 12:48 am

Which is a better solution - nossao property, or have the SSAO pass automatically reduce SSAO intensity with brightmaps? The latter makes more sense physically, and would give more control to the artist.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Any way to stop SSAO appearing on certain surfaces?

Postby Chris » Wed Oct 24, 2018 12:58 am

Doesn't PBR include an AO map, defining where AO can be applied and the strength of it?
User avatar
Chris
 
Joined: 17 Jul 2003

Re: Any way to stop SSAO appearing on certain surfaces?

Postby Nash » Wed Oct 24, 2018 1:14 am

Yeah, for PBR, the AO map could be used to define where SSAO is "allowed" to appear (so a fully white pixel means absolutely no AO drawn), but for diffuse/spec/norm, I was wondering if it's a good idea to derive from the brightmap.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Any way to stop SSAO appearing on certain surfaces?

Postby Enjay » Wed Oct 24, 2018 3:43 am

I do like the idea of being able to derive from the brightmap. That way examples like the model lamp could have a nice bright dome but SSAO shadows could be applied to the non-bright areas of the model.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: Any way to stop SSAO appearing on certain surfaces?

Postby dpJudas » Wed Oct 24, 2018 4:12 am

Using the brightmap can also be done, but that would mean it doesn't work on traditional Doom light textures where they can be on and off using sector light.

Perhaps the best solution is to do both - if there is a brightmap and the color is above some threshold (let's say 0.1) then it won't be subject to SSAO. And if there's a nossao specified in the gldefs file the entire texture is excluded.
dpJudas
 
 
 
Joined: 28 May 2016

Re: Any way to stop SSAO appearing on certain surfaces?

Postby Graf Zahl » Wed Oct 24, 2018 4:24 am

Can we please wait with any changes here until I am done refactoring the renderer for the Vulkan backend? Any change here right now would create some inconvenience because I shuffled around a lot of code in the last few days.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Any way to stop SSAO appearing on certain surfaces?

Postby Enjay » Wed Oct 24, 2018 4:58 am

dpJudas wrote:Perhaps the best solution is to do both - if there is a brightmap and the color is above some threshold (let's say 0.1) then it won't be subject to SSAO. And if there's a nossao specified in the gldefs file the entire texture is excluded.

That sounds a very user friendly way to do it (noting Graf's comment, of course).
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland


Return to Assets (and other stuff)

Who is online

Users browsing this forum: TweetMeme [Bot] and 0 guests