Layering depth buffers

More
1 month 3 weeks ago #1 by Niko of Death
Layering depth buffers was created by Niko of Death
I realize this is a fringe case in terms of games where it would be useful (due to the low amount of games where it is necessary/feasible), and may not even be possible on a technical level. The idea I had was to have a way to layer separate depth buffers on top of one another, for games where different elements are in different depth buffers. The specific use case I have in mind is The Great Ace Attorney Chronicles, where (when using copy before clear) clear 2 has the background elements, and clear 3 has the character models.
Here's examples of what I mean:
Normal view: files.catbox.moe/bi05xy.png
Clear 2: files.catbox.moe/ir8drf.png
Clear 3: files.catbox.moe/ffq7o0.png
Ideal outcome with layering Clear 2 and Clear 3: files.catbox.moe/fggyde.png
If it's even possible for reshade to access both at the same time, the idea would be to have 1.0/infinite depth values by default on the top depth buffer be cut out, with the secondary depth buffer being visible instead, and have a user setting to change the threshold for what depth values are cut out.

Please Log in or Create an account to join the conversation.

More
1 month 3 weeks ago #2 by lordbean
Replied by lordbean on topic Layering depth buffers
ReShade doesn't create the depth buffers, the game does. ReShade just hooks in and accesses them. Most shaders that use the depth buffer already offer some sort of control over min and max depth ranges to apply in.

Please Log in or Create an account to join the conversation.

More
1 month 3 weeks ago #3 by Niko of Death
Replied by Niko of Death on topic Layering depth buffers
I know it doesn't create them, my idea is for reshade to modify what shaders get (in the same sense as the upside down, x/y scale/offset, reversed etc. options) by adding info from another depth buffer.

Please Log in or Create an account to join the conversation.

More
1 month 3 weeks ago #4 by lordbean
Replied by lordbean on topic Layering depth buffers
I still don't think I'm following. The built-in functions for scaling or flipping the depth buffer are only there in order to cover weird engines whose depth buffers don't necessarily line up with the screen space as expected (when compared to other engines) and so are really only there for compatibility purposes, not because they allow shaders to do anything new with the information. What you're proposing still doesn't seem any different to me than running two passes with one set to depth 0 to 0.5, and the other 0.5 to 1.0. Someone please correct me if I'm wrong here.

Please Log in or Create an account to join the conversation.

More
1 month 3 weeks ago #5 by Niko of Death
Replied by Niko of Death on topic Layering depth buffers
No, I'm talking about having a second depth buffer used for games where different depth buffers have different elements of the game (e.g. one depth buffer has the world, one has the player's gun)

Please Log in or Create an account to join the conversation.

More
1 month 2 weeks ago #6 by lordbean
Replied by lordbean on topic Layering depth buffers
Ah, I see where my confusion is stemming from. You're talking about games that inherently use multiple back buffers (the depth buffer is a specific part of a back buffer, which is why I was mixed up). I could see the potential value in being able to assign specific back buffer selections from the API tab to specific shaders, yes.

Please Log in or Create an account to join the conversation.