Marty McFly's Ambient Obscurance (MXAO) with IL
- Martigen
-
Hey Marty,Marty McFly wrote: I'd like to keep SMAA talk outside the MXAO thread.
Sorry to raise this -- the above quote was in response to a discussion on the pages preceding that it turns out the SMAA shader doesn't honor Reshade's depth process flags -- so any buffer that needs to be reversed, logarithmic etc SMAA's depth technique isn't working properly.
At the time you (and maybe Crosire) said you'd take a look to add the appropriate code when you had a chance -- would you be able to do look at that now? As it stands we have a bugged SMAA shader. If I had any shader coding ability I'd fix this myself, but I don't

- Marty McFly
-
Topic Author
- Add a prepass that creates a linearized depth buffer so all intrinsic SMAA calls read that one - just like it was in the ReShade framework. When porting it over to RSFX 3.0, crosire apparently made a mistake. This means 1 new pass and 1 new texture, so we have some more video mem usage but other than that, no big changes. Also very fast, as there's no need to linearize the depth data when sampling (can quickly build up when reading it a lot of times, MXAO does the same to prevent this).
- Track down every place where original depth texture is read and patch it directly there so instead of just reading it, it's linearized directly after being sampled. This means huge code restructurements, as many functions are called with both color and depth texture, so when being called with depth texture, it needs a special treatment and so on. This would also place the linearization functions into SMAA directly as sometimes depth is gathered (4 neighbour pixels read with 1 call) and the ReShade linearize depth function in ReShade.fxh can't do that. Meaning that every future change to the linearization functions would require changing them in SMAA as well. TL;DR: chaotic code changes, hard to do, hard to maintain, 100x depth samples = 100x linearize math (performance costy), easy on video memory as it needs no new pass.
I think you already guessed it, I opted for the first one. I'm writing this so you don't think I was just being lazy - option 2) is very inferior in almost all accounts.
I haven't tested it in-depth but it should work, at first glance:
www.mediafire.com/file/3tbsjt3jcazy13b/SMAAFixedDepth.7z
- WSH303
-
- Marty McFly
-
Topic Author
[strike] pastebin.com/ySKiA6W5 [/strike]
pastebin.com/13NsGwtn
Latest MXAO beta update, requires ReShade 3.2.0 (latest reshade update). [strike]It has a division through 0 somewhere which I CANNOT find so it throws 3 identical warnings, hence "beta". [/strike] Crosire found it, please redownload/update to [strike]3.4.59[/strike] 3.4.60.
Changelog:
- Fix problem with posterized AO by using 2 more textures that are guaranteed to be RGBA8 (instead of RGB10A2 which the backbuffer has on some games...)
- Remove culling mask for being too buggy. I liked the concept but it wasn't 100% accurate (making it 100% accurate would result in 0 perf increase over not using it), plus the performance gain was not good enough to justify this. Could've added a toggle but I like MXAO being easy to configure.
- Group tweakables with new ReShade 3.2.0 ui_category annotation, so MXAO can serve as a reference for this new feature.
- Minor code restructurements for more performance
- Rename each and every variable for better readability, IStartedToHateCamelCaseAndNeedSomeCoherency.
- Relax the blur threshold a bit for smoother AO at large far plane values
- Add 1 more blending mode which is experimental, might be removed or changed
- Modify debug output to view the normals
- Modify UI annotation of quality modifier to view the amount of samples (nerd statistics)
- Marty McFly
-
Topic Author
-it's much slower so it's only viable for screenshots or if you have a beast system, there's no way I'll ever be able to make it remotely as fast as MXAO
-it's much, much more accurate, maybe difference isn't as apparent in regular mode but in debug you see it immediately, older games will benefit from it most likely as it can basically do all shading on its own, unlike regular SSAO which is meant to complement a lighting system
-it'd be an optional preprocessor toggle
- ShoterXX
-
TL;DR: Yes.
By the way, did you ever apply the median filter?
- robgrab
-
- Androll
-
- Uncle Crassius
-
Marty McFly wrote: Hey so I still got this raytraced AO solution and I plan on integrating it into MXAO, but before I do this, I'd like everyone's input on that.
- Tojkar
-
- Marty McFly
-
Topic Author
@Androll: I removed it, ghosting was too severe and it really really wasn't viable. It'd have been cool but without temporal reprojection this is just not working out.
@Tojkar: Well, it is much more demanding than MXAO but it depends on the settings as well. MXAO samples in a 2D pattern so at some point it'll converge to a 100 percent smooth result, you can't see a difference between 64 samples + spatial filter vs 500 samples without filter. The raytraced (actually cone traced) AO on the other hand doesn't converge as fast so even with 32 rays 16 samples each you get noise. At some point you can ridiculously increase the samples without any visual change. 8 rays, 4 samples look good but not as good as full power so yeah, you can configure it to be playable but it'll always be more demanding than MXAO. MXAO lowest setting uses only 4 samples per pixel which is extremely low but still creates some sort of AO, raytraced AO needs many more samples to be coherent.
- conan2k
-
Marty McFly wrote: Hey so I still got this raytraced AO solution and I plan on integrating it into MXAO, but before I do this, I'd like everyone's input on that. Key info:
-it's much slower so it's only viable for screenshots or if you have a beast system, there's no way I'll ever be able to make it remotely as fast as MXAO
-it's much, much more accurate, maybe difference isn't as apparent in regular mode but in debug you see it immediately, older games will benefit from it most likely as it can basically do all shading on its own, unlike regular SSAO which is meant to complement a lighting system
-it'd be an optional preprocessor toggle
The power of hardware is continuously growing. Besides, there are a lot of games and cases where 30 fps are enough for comfortable playback (i.e. where IQ has much higher priority over performance). So, please do add it as a future-proof option

- robgrab
-
- Marty McFly
-
Topic Author
- Tojkar
-
- Marty McFly
-
Topic Author
- jmx777
-
Marty McFly wrote: Hey so I still got this raytraced AO solution and I plan on integrating it into MXAO
Thank you for this, your work is the best.
- Tojkar
-
I'm not. I just tried to compliment your work. Apparently I suck at it.Marty McFly wrote: I get it, you're single.

- lowenz
-

- jmx777
-
Here is a comparison pics:
abload.de/img/19jq6h.jpg (SSAO+IL)
abload.de/img/23tqio.jpg (Raytraced AO + GI)
Huge thanks for your work!