mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-04-25 14:16:10 +03:00
[GH-ISSUE #4928] In-shader depth testing #2054
Labels
No labels
Atrac3+
Audio
CPU emulation
D3D11
D3D9 (removed)
Depth / Z
Feature Request
Font Atlas
GE emulation
Guardband / Range Culling
HLE/Kernel
I/O
Input/Controller
MP3
Multithreading
Needs hardware testing
Networking/adhoc/infrastructure
No Feedback / Outdated?
OpenGL
PGF / sceFont
PSMF / MPEG
Platform-specific (Android)
Platform-specific (Windows)
Platform-specific (iOS)
PowerVR GPU
SDL2
Saving issue
User Interface
Vulkan
arm64jit
armjit
armv6
x86jit
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ppsspp#2054
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dbz400 on GitHub (Dec 28, 2013).
Original GitHub issue: https://github.com/hrydgard/ppsspp/issues/4928
@dbz400 commented on GitHub (Dec 29, 2013):
I think i made it partially working now . The lava and special fire effect rendered all correctly now .
However , it is NOT clearing correctly so ........
@mr-chya commented on GitHub (Dec 29, 2013):
Please forgive me for asking some things that aren't exactly relevant to the problem here but there are two things I just HAVE to know! 1rst: What the heck is this awesome looking game!? 2nd: Is there an official English release or English patch for it? AND... that's about it, again sorry for the rather rather off topic questions.
@unknownbrackets commented on GitHub (Dec 29, 2013):
Looks like Ys Seven to me, which was released in the US and Europe if I'm correct.
The Ys games can be quite fun.
-[Unknown]
@dbz400 commented on GitHub (Dec 29, 2013):
Yep , it is Ys 7 .Forget to mention previously .
@dbz400 commented on GitHub (Dec 29, 2013):
Btw , Jennnac Arc seems to be rendered better now :)
@mr-chya commented on GitHub (Dec 29, 2013):
Oh! Looks like I need to take another look at the Ys series then. I kind of developed a mental block for the series after Ys III left my eight year old self a broken shell of a boy. That's probably a bit of an exaggeration but that's still the last time I played a Ys game. Anyway thanks for answering I'm definitely going to take another look at the series now.
@dbz400 commented on GitHub (Dec 29, 2013):
@szdarkhack , i think it somehow rendered correct now .I'm not sure if those overlapped artifact is caused by lack of clearing depth textures .
Where are those codes in your provided example do the "full screen quad and an appropriate fragment shader" ?
@hrydgard commented on GitHub (Dec 29, 2013):
I'm wondering, why would we want to do our own depth testing? OpenGL's built-in depth testing is fast and good enough - or are we missing some feature?
@dbz400 commented on GitHub (Dec 29, 2013):
Yes, OpenGL one is fast/good and should be most compatible for all platforms however until i tried this in-shader depth testing and it renders some scenes 100% correct that we never done this before.Looks like we have some cases in the OpenGL built-in depth testing somehow get wrong.
@unknownbrackets commented on GitHub (Dec 29, 2013):
I think your depth testing it just not properly testing. For example the characters are inside out-ish. I know how to make OpenGL render that way, I've already done it for that game. It looked the same, but it was wrong.
-[Unknown]
@dbz400 commented on GitHub (Dec 29, 2013):
Ys 7 is definitely the correct one using this in-shader depth testing. I did compare it with real PSP one
@unknownbrackets , I think the characters rendered close to PSP ?
-in-shader depth testing

-real PSP

@szdarkhack commented on GitHub (Dec 29, 2013):
@hrydgard We need in-shader depth testing whenever we do in-shader stencil tests, they go together. You can do depth testing (without stencil) in the shader but I don't think it will be very useful unless the PSP has some depth operation that's not supported by OpenGL.
@raven02 Instead of clearing the screen via glClear, you're going to have to use something like what I showed in the example. That shader clears the screen, but also clears the color/depth/stencil textures. If these textures aren't cleared properly you won't get the correct result. You should be able to pretty much copy paste the shaders from my example, just remember to set the uniforms correctly based on state, and replace any glClear()s with a full-screen quad using the clear program. (Also remember the glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT) between draw calls, otherwise you might see glitchy images).
Also, I'll be traveling a bit for a couple of weeks and won't have any more access to OpenGL 4.2 capable hardware, so any help I can offer will have to be limited to advice only. My apologies, but I'm very happy that these techniques are getting some use already. Hopefully they can improve the quality of the emulation (and perhaps earn me a place in the credits? :P just kidding of course)
@unknownbrackets commented on GitHub (Dec 29, 2013):
@raven02, find:
glstate.depthFunc.set(ztests[gstate.getDepthTestFunction()]);
glstate.depthFunc.set(GL_ALWAYS);
Checking it now, it doesn't look exactly the same, so probably your depth testing is aborting a couple draws, but it definitely looks very close.
I'm not really super excited by any of this myself since I don't have OpenGL 4.2 capable hardware.
-[Unknown]
@dbz400 commented on GitHub (Dec 29, 2013):
@unknownbrackets I think it should be this small difference between built in and in-shader depth testing that renders those scenes incorrect.(ys7,saint seiya ,phantom braver , jennac d arc etc)
@dbz400 commented on GitHub (Dec 29, 2013):
@szdarkhack I did try those clearing codes in ppsspp however it seems to be unable to remove those glitch images unfortunately.
@unknownbrackets commented on GitHub (Dec 29, 2013):
@raven02 it's not rendering it correctly. The woman in brown on the far left is inside out.
This game's problem isn't a depth testing issue, it's a depth buffer reuse issue afaict. A hack here might be to clear the buffer to a better initial value or something. But your thing isn't even properly testing between draws to the same buffer.
-[Unknown]
@dbz400 commented on GitHub (Dec 30, 2013):
Humm i see. Hopefully we can get a better buffer clear later .
@dbz400 commented on GitHub (Jan 5, 2014):
I'm closing this .A better approach to use glblitframebuffer has been used to clear depth.