RPCS3 / rpcs3

PlayStation 3 emulator and debugger
https://rpcs3.net/
GNU General Public License v2.0
15.43k stars 1.92k forks source link

SSAO bug with resolution scaling in NaughtyDog games #10316

Closed Linear524 closed 3 years ago

Linear524 commented 3 years ago

Any version if RPCS3 on any hardware shows some SSAO scaling bug in Last of Us. It looks like black half-transparent lines on any geometry if resolution scaling is used above native 720p. But - there is some funny part of this issue = if you will set resolution scaling to 4K - this bug will disappear and overall image will looks just as intended. So this bug doesn't appear if you use native resolution or scaling 300% (4K). Otherwise - 4K mode not playable because of massive slowdown and unstable backend behavior due to overload...

I think there is some error in scaling coefficients for SSAO function and it can be fixed without heavy surgery in RSX emulation. screenshot-2021_05_19_22_59_51 screenshot-2021_05_19_22_59_06

Linear524 commented 3 years ago

P.S. - I know that there is a special patch for removing SSAO from TLoU, but I don't like to disable important features in games, and I think accurate emulation of all RSX features are more important for RPCS3, rather than temporary speed gain with improper rendered graphics output...

kd-11 commented 3 years ago

Try 1440p (2x scaling) If it works with integer scaling modes its likely because dividing some values with fractions does not work cleanly. This would be a game quirk by the way, not so much an emulation issue. The math done by the game thinks everything is 720p.

Linear524 commented 3 years ago

Tried 2x and every possible combination - only native and 4K works correctly :P P.S. - on real PS3 hardware 720p looks pretty good because its overall picture is antialiased by MLAA... But current RPCS3 condition have some error of reproducing correct MLAA in TLoU and everything looks horrible in 720p. Is there any chance of fixing this MLAA for TLoU ? (every other game I tested have correct working MLAA on RPCS3, even Uncharted series)

maz-1 commented 3 years ago

Same thing happens with uncharted 2 & 3

Tried 2x and every possible combination - only native and 4K works correctly :P P.S. - on real PS3 hardware 720p looks pretty good because its overall picture is antialiased by MLAA... But current RPCS3 condition have some error of reproducing correct MLAA in TLoU and everything looks horrible in 720p. Is there any chance of fixing this MLAA for TLoU ? (every other game I tested have correct working MLAA on RPCS3, even Uncharted series)

Try to install reshade and enable fxaa/smaa (or vkbasalt under linux). I get really good anti-aliazing with vkbasalt.

Xcedf commented 3 years ago

SSAO in TLoU actually important, it generates some data that required for blizzard-fog effect during winter levels, prevents it from crashing.

Linear524 commented 3 years ago

A bit unrelated, but I've discovered an interesting thing with latest builds: Usually I using combination of WCB + RCB for TLoU, because it helps to render some tricky effects like cone lights with flies or distant objects shading... But recently I tried to add Write Depth Buffers + Read Depth Buffers activated and suddenly - it is not slowed down overall gameplay, but actually adds some 1~2 fps ! Also current combination of WCB+RCB+WDB+RDB helps to render some mirror images with correct geometry and produces correct data for DoF effect ! So now, moving further, if we use that combination and NOT using MLAA-disabling patch, (only GPU-path patch is needed, and nothing more in whole patch list), = we will get a lot of disabled effects working ! Overall, it produces:

So if someone interested in emulation TLoU with more correctly rendered graphics, try this settings: | CPU settings at default but without Idle loop detection. | GPU settings with activated WCB+RCB+WDB+RDB on Vulkan API and Native resolution. Framelimit and Antialiasing = Auto Use FSR with 50% sharpening in order to compensate Native resolution scaling to bigger screen size. | Advanced and Debug settings are at Defaults too. (Accurate RSX reservation is needed if TSX is disabled) | Patches - disable all patches, except GPU path patch. Only this one is needed.

I know it will slow down emulation speed, but it will give more PS3 effects back to life :) Accuracy is more important right now than speed optimization.

Xcedf commented 3 years ago

@Linear524, confirm, that's a major progress actually, now WCB+RCB+WDB+RDB are able to handle depth effects even with Depth behind Alpha (Depth viewport) and even with Motion Blur, I remember on older builds that wasn't possible. Can you please send a screen of godrays half rendered, I have smth in mind about Xfloat

Linear524 commented 3 years ago

Hi Xcedf ! Sure, here is the screenshots of Sun's volumetric lighting and Xfloat issue: screenshot-2021_08_16_22_08_17 screenshot-2021_08_16_22_08_29 Accurate-Xfloat-4 Accurate-Xfloat-2 Accurate-Xfloat-1 Accurate-Xfloat-5

Linear524 commented 3 years ago

And here is original screenshots: Xfloat.zip

Xcedf commented 3 years ago

@Linear524 did you try Resolution Scale Threshold for SSAO scale, for example Bloom's are 160x160, perhaps some will work for SSAO

Xcedf commented 3 years ago

@Linear524 Ok found that godrays require SPU FCEQ instrution to be accurate, you can use Illusion's build to activate it separately without the rest of Xfloat, and avoid major slowdown and artefacts. https://github.com/RPCS3/rpcs3/pull/8729 - fixes it for Approximate Xfloat

Linear524 commented 3 years ago

@Xcedf Thanks ! Is it possible to merge #8729 to master build ? (I don't know where to get latest illusion builds :P ) And about SSAO scaling - I don't use any IR scaling functions anymore. Even if we will find suitable resolution scale threshold for SSAO = it will break lens flares and other important things. Actually, I have my own crazy theory about scaling in PS3 games:

Xcedf commented 3 years ago

If you want to try here's Illusion build with https://github.com/RPCS3/rpcs3/pull/8729 included https://mega.nz/file/aFpinIhY#L7DwAGMwdkjIssyU9Sev5XNYJvlq1PSF7K2VZH8UYP4 Also resolution scaling no longer breaks lens flares, kd fixed it long ago. Accurate emulation of native console functions is important of course, but emulation itself is always about to step out of the box, so I prefer scaled image over native one for sure.

Linear524 commented 3 years ago

@Xcedf Thanks ! Will try that build tonight. By the way, do you have any idea how to fix floating grass bushes in Uncharted series ? It looks like a vertex shader translation bug, but it affects Naughty Dog's games in this weird way. Maybe some SPU instruction need more precise calculation ? (like FCEQ)

Xcedf commented 3 years ago

@Linear524 tried all possible accurate options, nothing seems to affect floating grass in Uncharted.

mjd180 commented 3 years ago

This discussion is all over the map! Can we please stick with the original, titled issue (which, btw, I can't replicate), & save the rest for the forums? If this has been fixed, it should be closed.

Linear524 commented 3 years ago

Well... A lot of things were changed since I've created this issue ticket. And now we have nice FSR upscaling which is greatly helps with "720p-only" games ! So I'm closing this issue because 720p is really enough for any PS3 game with combination of 16x anisotropic filtering + properly emulated antialiasing (MSAA or MLAA) and with FSR upscaling applied... The only thing needed to be fixed up in TLoU is: