hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.36k stars 2.18k forks source link

Daxter: Sudden loss of depth buffer (as seen by ReShade) #17454

Open Levan7 opened 1 year ago

Levan7 commented 1 year ago

Game or games this happens in

NPUG80329

What area of the game / PPSSPP

Well i noticed in ppsspp version ppsspp-v1.15.2-13-gfea78f93b-windows-amd64 you get depth buffer access so i tried Daxter. I noticed very strange behaviour with this Depth buffer access. Randomly you loss depth buffer data and to get it back either you should re download ppsspp and replace the files or change the api for vulkan to dx11 few times and you get depth buffer access back.

Very strange behaviour

https://imgur.com/a/ez9wnb7

What should happen

Ideally i don't think depth buffer data should disappear if you are getting it

Logs

No response

Platform

Windows

Mobile phone model or graphics card

nvidia 1050ti

PPSSPP version affected

ppsspp-v1.15.3-26-g55c1c48d6-windows-amd64

Last working version

ppsspp-v1.15.3-26-g55c1c48d6-windows-amd64

Graphics backend (3D API)

Vulkan

Checklist

unknownbrackets commented 1 year ago

I'm not sure how you're accessing the depth buffer, but this may be a timing issue. PSP games often clear the depth buffer at the beginning of the frame, and sometimes also mid-frame or before drawing the HUD. Generally, the depth buffer is just used as a scratch space to organize drawing.

I'm not sure why reinstalling helps, might be some interesting interaction with your graphics driver.

How are you accessing the depth?

-[Unknown]

iota97 commented 1 year ago

Watching the video he posted it seems like it's just drawing the vertex color. I don't really see what this have to do with depth buffer.

Levan7 commented 1 year ago

@unknownbrackets Well what i did and this is just what they call it in reshade forums not sure if it is actually depth buffer or not. I used reshade 5.8 and used mxao and rtgi shaders both rely on depth buffer. Only thing that i tweaked in ppsspp is disable anti aliasing. I must add that other games like star wars elite squadron don't lose "depth buffer" signal.

hrydgard commented 1 year ago

As for the video, it shows an ambient occlusion-type effect, which can be computed from depth buffers, not flat shading.

The game uses a lot of wacky depth buffer trickery in some levels, it even downsamples its own depth buffer to then test particles against it when it renders them to a low-resolution framebuffer. I'm not sure we can reliably preserve it in a way that ReShade can use.

Either way, ReShade is not part of PPSSPP's functionality and spending a lot of time to ensure the arrangment of buffers is compatible with it is not very high priority. So enjoy the games that the effect happens to work in, and skip this one for now.

iota97 commented 1 year ago

I was wondering if it could be some SSAO, but them colored light remind me of me trying to remove all fragments color processing from MHFU just for fun.

Also some geometry have a really "interpolated from vertex" looking gradient.

It could be that fragment fail in some way and just return the same color that get multiplied by vertex color... Quite weird if that's the case tho'.

Not that it matters much, just random thinking and me feeling something is off when one see colors in a scalar buffer :)

hrydgard commented 1 year ago

I think the colored light stuff is from a different pass rendered on top, at least there's a pass like that (although not very colorful) in the first level.

Levan7 commented 1 year ago

@hrydgard The strange part is that other games for example SW elite squadron you can go full game without that pass getting disabled however in daxter it acts really unusual for example clearing vulkan cache helps or changing to dx11 helps re enable it. Something that i found odd This is the shader you are seeing https://reshade.me/forum/shader-discussion/5450-guide-to-ray-tracing-with-reshade

hrydgard commented 1 year ago

Due to the strange stuff the game is doing, we end up doing some rather tricky copying around of depth buffers, and I think depending on creation order this leads to ReShade only sometimes managing to correctly associate the right depth buffer with the right color buffer, using whatever heuristics it uses.

Since the actual visible graphical output directly from PPSSPP is correct I can't really see this is as a bug, more as an unfortunate interaction with an app that grabs at data that is usually "private". PPSSPP has no obligation to output a "correct" depth buffer and it's not always even possible.

That said, it could be interesting to look into and understand exactly why it happens, so tagging this for future, but don't count on this getting prioritized anytime soon, due to the myriads of more impactful things I can work on ... This is quite the edge case and I need to manage my time. Maybe someone else will take a look.

Levan7 commented 1 year ago

Due to the strange stuff the game is doing, we end up doing some rather tricky copying around of depth buffers

This explains it thank you for the information