Marty McFly's Ambient Obscurance (MXAO) with IL
- Marty McFly
- Topic Author
Smoothed normal maps:
Some bent normal skylighting thingy I have been experimenting with. As it uses the unused RGB components for the AO texture when IL is off, it runs performance-free.
- jas01
- Marty McFly
- Topic Author
- jas01
- Estebanium
I started a game and activated bMXAODebugViewEnable, turning the left side white and the right side black. The same happened if I tried to use MXAO in Battlefield 2.
Any ideas?
- Marty McFly
- Topic Author
By default, the hardware depth buffer is not linear, means that 0 is camera, 0.999 is 1m away, 0.9999 is 100m away and so on, so it's extremely curved. What AO needs is 0 = camera, 1 = sky, 0.5 = halfway from camera to sky so depth buffer value is proportional to distance. MXAO has a function built in that converts the nonlinear buffer to linear, but some games have a differently curved depth buffer and using the standard formula on that does not work.
What you can do:
Civilization V is not in ReShade games list so I don't know which one of the cases it is.
Battlefield 2 is in the list, compatibility says perfect. If you play it online, then ReShade disables depth buffer, nothing to be done about that.
To test if the depth buffer is working for either of those games,, do the following: assuming you use MXAO 1.1r, go to line 381, it should say "res = color;". Right before that line, create some empty space between the #endif and the res=color line. Enter the following:
color = tex2D(SamplerDepth, texcoord.xy).x;
color = pow(color,10.0);
Now start the game again. If the resulting image is plain black or plain white, depth buffer is disabled or does not work, nothing to fix it. If you can see some contours of objects in any way, the linearizing function is wrong and I have to find one that works for you.
- Estebanium
thank you for your reply. I tested it in Battlefield 2 and yes it is working. If I add those two lines, I will see a contour of my rifle, but I fear that even in Singleplayer the depth buffer is offline. So I can only see my weapon, I did another test without those two lines and I will get a similar result with bMXAODebugViewEnable turned on. Does it mean that I will only have AO on my weapon and not on the landscape?
Did the same thing with CIV V and I can see something, but I guess that this game is a bit more complicated. Playing in DX11, I can see a contoure, but this is very precise.. One screenshot with and one without the two lines.
- Marty McFly
- Topic Author
Same goes for Civilization V, what you see there is that only the 3D model for this yellow beam in the sky is visible in the depth buffer, also no AO for you unfortunately
- Marty McFly
- Topic Author
- lowenz
- WSH303
I have tested Reshade 2.0 of MXAO and in general it looks good, but there are some strange artifacts that spoil the effect:
i.imgur.com/D6Ln2gL.jpg
Can you see those lines right to the gun? Those appear only if you get close to any objects and looks like lots of independent.. uh, blurred borders of the gun. I tried to fix this by messing with settings, but with no luck.
- acknowledge
WSH303 wrote: Hi,
I have tested Reshade 2.0 of MXAO and in general it looks good, but there are some strange artifacts that spoil the effect:
i.imgur.com/D6Ln2gL.jpg
Can you see those lines right to the gun? Those appear only if you get close to any objects and looks like lots of independent.. uh, blurred borders of the gun. I tried to fix this by messing with settings, but with no luck.
I can also confirm that. MXAO creats several "ghost" around ingame objects. Enable debug view will make my discription clearer
- genstar
Marty McFly wrote: Some updates on the MXAO, I posted these already in the screenshot thread.
AO + Skylighting:
Off/On comparison (best to open both pics in two tabs and compare)
[/spoiler]
Please, you can share files needed to get the result of the picture "AO + Skylighting". Please share, do not tell me how to do, because I do not understand much English.
- genstar
but Skylighting it will be included in the version MXAO 1.3?Marty McFly wrote: I will soon update MXAO to 1.3 which will feature some improvements such as a beta implementation of the smoothed normals, per pixel normals and most importantly, a brand new AO post blur algorithm that changes its blur directions depending on surface alignment so AO quality does not decrease that much with high blur levels because the usual blurring algorithms drag the AO shading too far from its intended position. Ideal blurred AO looks like unblurred AO with high sampling count.
- Boulotaur2024
I remember trying really hard to get AO based on normal maps instead of flat polygons but always failed to. As far as I can recall the normal map had to be generated by a deferred renderer or something which no injector could provide. But I can barely remember the details now.
Good job anyway. One of the best HBAO implementations for sure
- Marty McFly
- Topic Author
Erm, I have been polishing MXAO a lot since the last release. It now runs a lot faster, looks better, requires no external texture anymore (I generate a 128x128 bayer matrix in code now which smoothens the AO even more). The post blur underwent a lot of changes, it uses something I like to call discrete linear sampling because it uses the same method to use less samples as discrete gaussian blur.
Also I tried deinterleaved texturing which was a bitch to implement only in pixel shader but it works! Except the performance gain is negative, a 2x4 deinterleaved pattern (4x4 reaches sampler limit in reinterleave pass on d3d9) runs with 2 times the technique time than MXAO alone and looks worse, I have no clue why. Only for 500+ samples it is faster than MXAO.
- Sunesha
I still have to revert to Nvidia driver Hbao+ as some games just have non accessible depth buffer.
I really hope the skylighting part makes into the next version of the MXAO. But anyway is very cool to bring a modern occlusion to older games. Really love this effect as it brings out a new depth to the rendering of the games
- Marty McFly
- Topic Author
- Sunesha
I see that it would be more things for the shader to do so the impact performance is not worth the cost.
I look forward to a leaner and better looking MXAO. Which Is welcome, it is always a compromise with my GTX 960. So every frame won is always something else I can throw in. Though I have fairly good results sometimes by lowering samplecount and sizescale
- Marty McFly
- Topic Author
Changelog:
-removed Sample Randomization, performance uncomparably lower because of cache misses
-removed bayer16x16.png dependancy, results in higher quality of AO
-changed blur weight calculation, heavily inspired from GFSDK
-added per pixel normals, this is a test
-various code restructurements for higher performance
-changed AO blur for better visuals and sharper AO result
-a lot more I probably forgot