Welcome, Guest.
Username: Password: Remember me

TOPIC: Marty McFly's Ambient Obscurance (MXAO) with IL

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 1 week ago #1

  • Marty McFly
  • Marty McFly's Avatar
  • Offline
  • We've tried nothing and we're all out of ideas!
  • Posts: 609
  • Thank you received: 716
Overview

MXAO is a SSAO algorithm designed to be the perfect replacement for faulty AO implementations in modern games. To spice things up, it can also calculate Indirect Lighting. The performance and scalability allows almost GI-like scenes in some cases. Most noteable features are:

1. Scalability. It can both apply little shading almost for free or heavy shading for screenshots to completely change the look of the scenery. At low settings, its fps drop is not noticeable on GPU's like GTX 970 where HBAO+ or similiar algorithms dip the fps quite a bit. I managed to get 60 fps on a GT920.
2. To reduce the amount of needed post-blur, MXAO uses a non-random sampling distribution. Instead, it uses a 16x16 bayer matrix as distribution lookup combined with a fine-tuned algorithm to improve variance.
A lot of AO implementations reduce their effective sample count because many samples land on the same positions so the result is way more noisy than on other implementations with the same sample count. Due to the nature of the bayer matrix, the resulting pattern needs a lot less blur for completely smooth shades. (64 samples: 3 pixels radius for bayer, 8+ pixels radius for randomized samples).
3. The robust implementation allows for very wide-range AO with little decrease in performance due to minimum cache trashing. Again, a lot of AO shaders perform fairly fast for moderate sampling ranges but kill the performance for wide-range sampling. This is one of the most noteable features of the ENBSeries AO.
4. Reliable even with bad input data. Alchemy SAO for example needs very accurate linearizing function to function properly, while algorithms such as the Crysis SSAO run on almost everything. MXAO performs likewise.

Parameters

AmbientOcclusionAmount
Pretty straighforward, increases AO intensity.

IndirectLightingEnable
Enables Indirect Lighting calculation. This will drop performance by a margin.

IndirectLightingAmount
Amount of Indirect Lighting. Tweak it along with AO Amount as high AO amount dims IL.

IndirectLightingSaturation
Tweak saturation of Indirect Lighting. Low values can be used in colorful games where plain brightness propagation looks best.

SampleRadius
Linearly increases screen space dimensions of shading. Higher radii focus more on low frequency geometry. Ranges of this parameter might fluctuate from game to game, where a sampling radius >20 in GTASA is almost too high to be useful, radii of 30+ look moderate on GTA V. High sample radii and low sample count might cause some "halos" around shaded objects, see Sample Randomization section for more info.


SampleCount
Higher samples mean more accurate detection of surrounding geometry and as a result less noise and less needed blur. Higher sample radii need more samples to keep the quality up. High sample radii and low sample count might cause some "halos" around shaded objects, see Sample Randomization section for more info. All images in this post have been made with 96 samples.

SmartSamplingEnable
Scales sample count with screen space radius so distant areas where the radius is relatively small take less samples because difference is very little anyways. Shorter AO fade end distance increases sample falloff because it would be senseless to decrease up to the horizon if AO fades out at 30 metres. Bears almost no visible difference, best is to leave it on and ignore it.

SampleRandomization(legacy)
High sample radii and/or low sample counts tend to cause certain halos with more occlusion in specific distances around shaded geometry. This is a side effect of the bayer matrix used in the sample distribution. If you raise this parameter, it breaks up the ordered pattern a bit so the halos go away. Keep it as low as possible because randomized patterns need more blurring so it's sometimes better to raise sample count instead.


NormalBias
Helps to decrease low-tesselation artifacts as the normals used in MXAO are derived from depth buffer and ignore smoothing groups so the polygons of curved surfaces might be visible.


BackfaceCheckEnable
For IL only! If enabled, the IL generation also checks how the occluder surface is aligned. This is irrelevant for the AO because for light blocking, it's not important how the occluder is aligned but of IL it is from great importance as sometimes colors spread through the object to the other side. Dips fps as the AO needs to sample the normals at the sample point additionally.

BoundaryCheckEnable
High radius sampling/objects very close to player can cause sudden pop-ins or flickering because the depth data is continued beyond the screen boundaries depending on the texture sampler. There is simply no option (mirroring, repeating border pixel etc) that won't produce false occlusion so this checks if sample coordinates are inside the screen boundaries. Might increase compilation time a slight bit.

LowPrecisionEnable
Enables half precision depth texture. This may cause some z-fighting artifacts in far areas or on logarithmic depth buffer. Enable for a performance boost but make sure to check the debug output for any occuring artifacts and hide those with AO fade option, if possible.

BlurSharpness
The post blur needs to compare the sample depth with the original depth of the center pixel, otherwise AO blurs over object edges. This parameter adjusts the range for accepted depth differences.


BlurSteps
Radius of post blur. 3 should be fine for most cases, raise of you see some noise or make use of sample randomization parameter.



SizeScale (legacy)
Governs render target size of AO calculation. This directly affects performance as AO performance is proportional to processed pixel count. 0.5 means half width and size = 1/4 of the pixels. A config of 0.707 means half the amount of fullscreen pixels while maintaining a relatively high quality. Lower this value only for heavier performance issues as quality suffers a lot.

MipLevelIL
Size of the texture used for IL input. 0 means fullscreen, 1 means 1/2 width and height, 2 means 1/4 width and height and so on. There is little to no difference from 0 and 2 but quite some performance difference. Best results are AO Miplevel +2.

MipLevelAO
Size of the texture used for AO input. 0 means fullscreen, 1 means 1/2 width and height, 2 means 1/4 width and height and so on. Do not confuse with Size Scale as size scale controls the size of the rendered AO output texture while this is the size of the input texture. Setting this parameter to 1 doesn't decrease quality that much but also doens't improve performance that much so only set to something else than 0 if you really need to.

DebugViewEnable
Enables raw output of AO. All the pictures in this post are done with this parameter. Once IL is activated, the right half of the screen shows the IL output (mostly dark with a few colorful spots). Should you only see a black right half, something went wrong.

Download

1.0r (mediafire)
1.1r (mediafire)
1.5.7r (pastebin)
Last Edit: 1 month 3 weeks ago by Marty McFly.
The administrator has disabled public write access.
The following user(s) said Thank You: crosire, aufkrawall, matsilagi, CeeJay.dk, NattyDread, robgrab, MaxG3D, SpinelessJelly, Ganossa, jas01 and this user have 20 others thankyou

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 1 week ago #2

  • Marty McFly
  • Marty McFly's Avatar
  • Offline
  • We've tried nothing and we're all out of ideas!
  • Posts: 609
  • Thank you received: 716
Feedback?
The administrator has disabled public write access.

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 1 week ago #3

  • robgrab
  • robgrab's Avatar
  • Offline
  • Posts: 122
  • Thank you received: 21
Just downloaded it. How do I install it? Do I use one of the older Reshade dlls or does it work with Reshade 2.0?
Last Edit: 8 months 1 week ago by robgrab.
The administrator has disabled public write access.

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 1 week ago #4

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2437
  • Thank you received: 1384
robgrab wrote:
Just downloaded it. How do I install it? Do I use one of the older Reshade dlls or does it work with Reshade 2.0?
Remove all shader files and install this one instead. Does not matter which ReShade version you are using.
Cheers, crosire =)
The administrator has disabled public write access.
The following user(s) said Thank You: robgrab, Marty McFly

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 1 week ago #5

  • aufkrawall
  • aufkrawall's Avatar
  • Offline
  • Posts: 74
  • Thank you received: 8
Fantastic job, Marty!
The AO looks very believable and is very clean in both still image and in motion.

Tested it in BF4:


Performance is totally ok as well.

Only thing I had to change was to set #define fMXAONormalBias to 0.4 to avoid some stripe pattern shimmering for some areas in motion.

I hope some game developers will notice this and maybe help them to implement better SSAO solutions by themselves.
The administrator has disabled public write access.
The following user(s) said Thank You: Marty McFly

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 1 week ago #6

Thanks for your work!
I'm just amazed how flexible config that helps to tweak a shader.
Have some questions:
Warning: Spoiler! [ Click to expand ]


There are tweaked version of MXAO. I have stable >30 FPS in Warframe.
My PC: 2.3ghz + geforce 525m
Screenshoots:
Warning: Spoiler! [ Click to expand ]

Config:
Warning: Spoiler! [ Click to expand ]
Last Edit: 8 months 1 week ago by Crystrex.
The administrator has disabled public write access.

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 1 week ago #7

  • Marty McFly
  • Marty McFly's Avatar
  • Offline
  • We've tried nothing and we're all out of ideas!
  • Posts: 609
  • Thank you received: 716
I kicked that out, didn't look good in all cases.
And why on earth did you set blur sharpness to 0.0? That defeats the whole idea of depth aware blur. Also, why setting the normal bias to 0? That is exactly there to cover artifacts like those I see in your screenshot. If you want stronger AO, raise the AO amount but don't lower normal bias to below 0.2.
The administrator has disabled public write access.
The following user(s) said Thank You: jas01

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 1 week ago #8

  • WLHM15
  • WLHM15's Avatar
  • Offline
  • Everything started from the end
  • Posts: 22
  • Thank you received: 6
There's a way to do it better, find it - Thomas A. Edison

This is really a awesome work,
I just tested it, at Call of Duty : Modern Warfare 2 Game.
With ReShade 2.0 .dll, no color correction and no AA (really sucks :silly: ). Just single shader, tweaked and run..

Here the result.
Warning: Spoiler! [ Click to expand ]


Warning: Spoiler! [ Click to expand ]


The quality is amazing, it do so well, no more blurry screen.
The performance is really great, it run more fps than HBAO or Alchemy SAO in same quality. And IL make the fps drop, but not to much.
The administrator has disabled public write access.

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 1 week ago #9

Thank for answer. The idea was to maximize FPS with any methods. For my eye, without debug mode i cannot see big difference between default sharper AO and 0.00. But fps drop around 5-10.
I'm continue to experimenting and fix this values.
The administrator has disabled public write access.

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 1 week ago #10

  • kanuuna
  • kanuuna's Avatar
  • Offline
  • Posts: 5
  • Thank you received: 2
Pardon the aliasing, but I thought I'd post my results. I felt like downloading Crysis just for this.
Warning: Spoiler! [ Click to expand ]

ON

Warning: Spoiler! [ Click to expand ]

OFF

Really clean work. This is impressive.
The administrator has disabled public write access.
The following user(s) said Thank You: aufkrawall

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 1 week ago #11

Just tested and damn it looks good, but sadly only in still images and when no fog/smoke/windows are around. The problem is severe bleeding, which can be seen in a couple of shots here already. Bleeding makes all of these fancy AO techniques unusable for normal gameplay imo, is there no way to get rid of it completely or even make it far less noticeable?
Last Edit: 8 months 1 week ago by GroinShooter.
The administrator has disabled public write access.

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 1 week ago #12

  • roxahris
  • roxahris's Avatar
  • Offline
  • Refreshing yet disheartening bucket of water
  • Posts: 15
This is incredible! It looks fantastic in almost everything I've tried it in and, thus far, supersedes every other option available for injection.
To follow on with the screenshot parade, here is a shot of the original Final Fantasy XIV. I'm stunned!
Last Edit: 8 months 1 week ago by roxahris.
The administrator has disabled public write access.

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 1 week ago #13

  • aufkrawall
  • aufkrawall's Avatar
  • Offline
  • Posts: 74
  • Thank you received: 8
kanuuna wrote:
Pardon the aliasing, but I thought I'd post my results. I felt like downloading Crysis just for this.
Impressive demonstration!
The administrator has disabled public write access.

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 1 week ago #14

  • Marty McFly
  • Marty McFly's Avatar
  • Offline
  • We've tried nothing and we're all out of ideas!
  • Posts: 609
  • Thank you received: 716
GroinShooter wrote:
Just tested and damn it looks good, but sadly only in still images and when no fog/smoke/windows are around. The problem is severe bleeding, which can be seen in a couple of shots here already. Bleeding makes all of these fancy AO techniques unusable for normal gameplay imo, is there no way to get rid of it completely or even make it far less noticeable?

Absolutely not. In regular engines, this is done by rendering AO etc before transparent objects or particles. As we can't do it and most of the effects don't differ in their color information from the surrounding environment, there is no possibility to separate those. Just because our eyes can distinguish between this doesn't mean an algorithm can. If I could write something on that level of content awareness, I'd sell it to the military and they would buy it. However I proposed some possibility to find out these areas by checking depth and color info. Most area with fog /smoke have largely same colors but their depth info is highly different (because the objects behind it are not flat) but that won't work in all cases.
The administrator has disabled public write access.
The following user(s) said Thank You: GroinShooter

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 1 week ago #15

  • roxahris
  • roxahris's Avatar
  • Offline
  • Refreshing yet disheartening bucket of water
  • Posts: 15
I think GeDoSaTo implemented a function to let the user define a specific stage of the rendering process (i.e. before transparencies and the UI) at which an AO shader would be applied. However, that would require porting the shader over, which is both a fair amount of work (it's probably not as extensible as ReShade), and would have to be allowed by the license.
The administrator has disabled public write access.

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 6 days ago #16

  • NotAgOat
  • NotAgOat's Avatar
  • Offline
  • Posts: 9
  • Thank you received: 4
I replaced the default reshade.fx in the reshade folder with this one. I do not see the effect in the effects panel. Am I installing this incorrectly?

Why is this replacing default files anyway? Why not add new effects to marty's shader folder?
Last Edit: 8 months 6 days ago by NotAgOat.
The administrator has disabled public write access.

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 6 days ago #17

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2437
  • Thank you received: 1384
This is a fully standalone effect currently and cannot be used with the rest together (by default), nor can it be used with the assistant tool.
Cheers, crosire =)
Last Edit: 8 months 6 days ago by crosire.
The administrator has disabled public write access.

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 6 days ago #18

  • Marty McFly
  • Marty McFly's Avatar
  • Offline
  • We've tried nothing and we're all out of ideas!
  • Posts: 609
  • Thank you received: 716
NotAgOat wrote:
I replaced the default reshade.fx in the reshade folder with this one. I do not see the effect in the effects panel. Am I installing this incorrectly?

Why is this replacing default files anyway? Why not add new effects to marty's shader folder?

So people can test it before I integrate it in the Framework. When I do that, I' have to rewrite all the other AO shaders as well so this is a bigger bunch of work as I'm willing to do atm.
Last Edit: 8 months 6 days ago by Marty McFly.
The administrator has disabled public write access.
The following user(s) said Thank You: acknowledge

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 6 days ago #19

  • NotAgOat
  • NotAgOat's Avatar
  • Offline
  • Posts: 9
  • Thank you received: 4
Oh, I see. Thanks.
The administrator has disabled public write access.

Marty McFly's Ambient Obscurance (MXAO) with IL 8 months 6 days ago #20



MXAO : fMXAOSampleRadius = 18, iMXAOSampleCount = 255
abload.de/img/deadislandgame_x86_rw2ypdr.png[

HBAO in GeDoSaTo (Link)
abload.de/img/screenshot_2014-10-28w3po8.png

The brightness difference is irrelevant of course but I think the latter occludes the near objects a bit better than MXAO (see the shadows under close rocks) with less self-occlusion. While MXAO does a slightly better job for distanct objects.
Nothing that couldn't be fixed by tweaking a near plane parameter I guess... If it existed because I don't think you included a way to tweak it. I could only see a farZ one.

Other than that the performance is great !
In that last shot that I took way back in 2014 I remember the fps was crawling in the 10 fps (there was downsampling in the mix but even without it would kill the framerate with HBAO maxed out) while MXAO is performing really nicely even at high settings (the bayer pattern trick I guess)
Last Edit: 8 months 6 days ago by Boulotaur2024.
The administrator has disabled public write access.
The following user(s) said Thank You: Marty McFly