SSAO discussion

Advanced OpenGL source port fork from ZDoom, picking up where ZDoomGL left off.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Wiki] [Repo] [Bugs&Suggestions]

Moderator: Graf Zahl

User avatar
Tormentor667
Mr. Impatience
Stronghold Team
Posts: 3555
Joined: Sun Nov 13, 2005 23:15
Location: Germany
Contact:

Re: SSAO discussion

Post by Tormentor667 » Thu Sep 15, 2016 15:58

dpJudas wrote:For the bloom, the problem here is how it calculates camera exposure. I cheated and used the sector brightness level as the indicator instead of what pixels are on the screen. I can probably fix this by calculating the real exposure, but it won't make it into the upcoming release I'm afraid.
Thanks for the reply. I think it's not bad if it doesn't make it into the upcoming release as long as it is being adressed somewhere in the future. As of now, the bloom shader isn't of any use in winter-themed maps to be honest :-/

dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: SSAO discussion

Post by dpJudas » Sun Sep 18, 2016 3:59

Tormentor667, how do I get to that winter map you showed a screenshot of? I've implemented an automatic exposure calculation pass for the bloom that I want to test on it.

AFADoomer
Posts: 43
Joined: Fri Sep 02, 2005 3:23

Re: SSAO discussion

Post by AFADoomer » Sun Sep 18, 2016 16:20

dpJudas wrote:Tormentor667, how do I get to that winter map you showed a screenshot of? I've implemented an automatic exposure calculation pass for the bloom that I want to test on it.
It's in WolfenDoom: Blade of Agony. Your best bet is probably to pull the current version of the mod from its git repository here.

That image was taken on map c2m6_a at around coordinates 1500, 4000.

dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: SSAO discussion

Post by dpJudas » Sun Sep 18, 2016 18:42

Thanks AFADoomer, that's exactly what I needed.

dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: SSAO discussion

Post by dpJudas » Wed Sep 21, 2016 1:01

Managed to get fog applied to the SSAO pass. This is how it looks like with the new automatic exposure adjustment and ambient occlusion:

Image

Not that easy to spot at this location, but it is there! Also, it is the first screenshot of gzdoom with gbuffers! :D

User avatar
Gez
Developer
Developer
Posts: 1396
Joined: Mon Oct 22, 2007 16:47

Re: SSAO discussion

Post by Gez » Wed Sep 21, 2016 20:54

So SSAO fog makes the corners foggier?

dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: SSAO discussion

Post by dpJudas » Wed Sep 21, 2016 21:07

Pretty much. The normal scene pass outputs the color SSAO should attenuate towards in a second color buffer. The SSAO combine shader then grabs that color for the fragment and blends it back to the scene's primary color buffer.

The code picking the color looks like this right now:

Code: Select all

vec3 AmbientOcclusionColor()
{
	float fogdist;
	float fogfactor;
			
	//
	// calculate fog factor
	//
	if (uFogEnabled == -1) 
	{
		fogdist = pixelpos.w;
	}
	else 
	{
		fogdist = max(16.0, length(pixelpos.xyz));
	}
	fogfactor = exp2 (uFogDensity * fogdist);
			
	return mix(uFogColor.rgb, vec3(0.0), fogfactor);
}

User avatar
Nash
Developer
Developer
Posts: 1226
Joined: Sun Sep 25, 2005 1:49
Location: Kuala Lumpur, Malaysia
Contact:

Re: SSAO discussion

Post by Nash » Thu Sep 22, 2016 3:57

Oh so that's how it works? One would think that the "correct" image would be: still darkened shadows (black) in corners, except the fog is drawn on top of the shadows, so that the fog's translucency will cover both the level and the shadow...

This was a similar issue when mapping in ZDoom/GZDoom with fog: Let's say you make a 3D ceiling that's at the exterior. You'd want to make the area below the ceiling cast a "shadow" therefore you'd think to darken the sector brightness. Except what actually happens when you do this is that the fog under that ceiling just looks thicker because of how the fogging works in Doom. It doesn't look like a shadow is being cast. :S Fortunately this can be worked around by making the SECTOR COLOR darker/more black instead (and leave the brightness alone so that the fog density will remain consistent in and outside of that ceiling area).

But, well, your latest image is much better than the Hexen ones I posted back there where there's just this black stuff sticking out of the thick fog. :P

Nice job with the fixes, and the improved exposure system too!

dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: SSAO discussion

Post by dpJudas » Thu Sep 22, 2016 5:37

The AmbientOcclusionColor function should be returning the color that a fully darkened shadow (black) should have for that fragment. It uses this color with the occlusion amount/attenuation as the alpha value to calculate the final pixel color as follows:

output.rgb = occlusionColor.rgb * occlusionAmount + level.rgb * (1 - occlusionAmount)

For a normal non-fogged pixel occlusionColor is black. For a white scene, like on the screenshot, it is black at the viewer and then increasingly more white as the distance to the eye increases for the pixel. I believe this is mathematically correct within the behavior of how all other fog in GZDoom works. It just happens to look like it fades towards the fog color because a solid black is a more dominant color than the variations in a texture.

User avatar
Tormentor667
Mr. Impatience
Stronghold Team
Posts: 3555
Joined: Sun Nov 13, 2005 23:15
Location: Germany
Contact:

Re: SSAO discussion

Post by Tormentor667 » Sat Oct 01, 2016 14:51

dpJudas wrote:Managed to get fog applied to the SSAO pass. This is how it looks like with the new automatic exposure adjustment and ambient occlusion:

Image

Not that easy to spot at this location, but it is there! Also, it is the first screenshot of gzdoom with gbuffers! :D
Awesome :) Much better now!

Locked

Return to “GZDoom”