PCSX2 / pcsx2

PCSX2 - The Playstation 2 Emulator
https://pcsx2.net
GNU General Public License v3.0
11.53k stars 1.6k forks source link

Parappa the Rapper 2 depth issues #1610

Closed oddMLan closed 3 years ago

oddMLan commented 7 years ago

Virtually all versions suffer from this, even the current master

Default settings and plugins. OGL + HW Depth fixes some issues but not completely, as it also creates other issues such as black noodles appearing in the top left corner

-Objects tend to get in front of the tap bar where a player must press the buttons to rap. This doesn't happen in real hardware. -The colorful noodle effect when a player goes down to BAD or AWFUL is not emulated correctly. In OGL + HW the noodles are flat instead of wavy. This effect is only correctly emulated in software mode, but it's not perfect either, since black noodles tend to appear in the top left corner, same as in HW OGL + HW Depth. This is especially BAD near the end of the third stage, practically impassable without using SW mode or OGL with HW Depth not disabled (see youtube link for example)

To reproduce: play any level using Hardware mode. Software mode isn't perfect either. Play badly if you want to see the missing noodle effect/semi working in SW mode.

Video showcasing the issues: https://www.youtube.com/watch?v=WrxrKT2COmQ PC Specs: Windows 10 Pro x64, Intel Pentium G3258, AMD Radeon R7 200 Graphics, 8GB RAM

FlatOutPS2 commented 7 years ago

Virtually all versions suffer from this, even the current master

So there are versions where it's (partially) fixed?

And can you make a GS dump showing the hardware mode issue? http://forums.pcsx2.net/Thread-How-to-create-a-proper-GS-dump

oddMLan commented 7 years ago

~~Detailed GS dumps across OGL, D3D11 and SW mode. https://www.mediafire.com/?1qj9175xffzws1n~~ don't use these ones use the ones in my last comment here

Note: D3D11 gets the same results as D3D9 and OGL with HW Depth disabled

Also to answer your question, I remember a very specific version in which the noodles were fixed in D3D, but then I downloaded a newer build and it broke them again. That was almost like a year ago so I don't remember the specific revision, it was around the time you started making monthly reports I think.

Ramirez57 commented 7 years ago

Many depth issues with PaRappa the Rapper 2 are fixed in the latest developer build(*) of GSdx using OpenGL (Hardware) with "Disable Depth Emulation". However, the performance is very poor on AMD cards; I got better performance using the Software mode, but the depth issues are present.

I am also using an AMD R7 250 card. It would be nice if we could get this fix ported to Direct3D and Software mode. The noodle effects are not perfect, but it's less distracting than before. I did not witness depth issues previously present in the opening sequence, title screen, Stage 2, Stage 3, and Stage 5.

Specifically, I think this is a texture cache issue.

oddMLan commented 7 years ago

Wow, you're right. I tried out the latest master and everything works correctly with no depth issues anymore (only in OGL). And with PS2 Depth Emulation disabled! Go figure. Which commit fixed it? I assume this one? https://github.com/PCSX2/pcsx2/commit/c284459382d821e4177b99cb8f3f0484d0d27828 It's the only one with "depth" in the name so

Depth issues are fixed, but the noodles are still stiff as if they were uncooked. Noodles are supposed to be wavy, but that's another issue not related to depth. You can see this effect working correctly in SW mode, but SW mode has the black box in the top left corner (which has to do something with the noodles that don't work correctly in HW mode... hm... maybe this will lead to the root of the problem).

Also yeah, you're right about the OGL backend being slow as molasses, at least on this particular AMD card. I guess the Depth compare are too complex to emulate efficiently in hardware mode, because SW mode works alright even though still incorrect (shouldn't SW always be more accurate though?).

gregory38 commented 7 years ago
Many depth issues with PaRappa the Rapper 2 are fixed in the latest developer build(*) of GSdx using OpenGL (Hardware) with "Disable Depth Emulation"

Disable depth emulation removes depth handling. So it isn't possible to have correct depth effect. Or I miss understand you. So potentially you have a broken rendering that miss various effects.

However, the performance is very poor on AMD cards; I got better performance using the Software mode, but the depth issues are present. 
...
Also yeah, you're right about the OGL backend being slow as molasses, 

AMD issues is with accurate blending. Depth emulation is quite expensive for the GPU. Because depth is written as float and must be read back as RGBA8 color (or the reverse). It is illegal on modern GPU so you need to convert the texture format. Because it is a limitation of GPU, all API (even vulkan/dx12) will suck. On the SW renderer it is a nop so yes it is faster. Some speed optimizations are possible. For example we could limit the conversion to a subset of the texture instead to convert the full texture. Until then, I will advise you to disable large frame buffer support.

Ramirez57 commented 7 years ago

@gregory38 "Disable Depth Emulation" removes an obstructive box in the upper left corner with no visual side effects as far as I can tell.

I don't know if this is a portable solution since we both use similar AMD cards. I thought most of this game's rendering issues come from the texture cache since that is affected by the "Disable Depth Emulation" option.

And as we said, for some reason Hardware Depth for OGL on AMD is really slow. I have blending unit set to "None" and the performance impact is still there. The software solution performs way better, but it's imperfect with some rendering glitches.

gregory38 commented 7 years ago

It is hard to explain but the fact that you have a correct rendering with missing emulation layer is pure luck. By default, OpenGL will convert depth buffer as expected by the GS to emulate the various depth effect. On Dx, depth emulation is always disabled.

And as we said, for some reason Hardware Depth for OGL on AMD is really slow. I have blending unit set to "None" and the performance impact is still there. The software solution performs way better, but it's imperfect with some rendering glitches.

Yes but it isn't free on Nvidia's GPU neither.

Ramirez57 commented 7 years ago

It just seems strange that the software solution is faster, but doesn't fix this box. It appears several times, but disappears when the noodle effect occurs. Looks like this http://oi67.tinypic.com/14tn1fq.jpg

gregory38 commented 7 years ago
It just seems strange that the software solution is faster

What is faster the light to travel a cm or an human to stay in place. Doing nothing for the SW renderer is faster than to convert all pixels (every draw call) for the HW renderer.

Anyway, it could be a VU bug too.

oddMLan commented 7 years ago

@gregory38 "Disable Depth Emulation" removes an obstructive box in the upper left corner with no visual side effects as far as I can tell.

Not just that, it also fixes the intro and prevents objects getting in the way of the lyrics/tab bar I thought that by itself proved it was a depth issue

The only way to fix before was to use OGL + Depth Compare not disabled, but that still caused other glitches such as the black box in the top left corner. How does disabling it actually helps more now?

gregory38 commented 7 years ago
 How does disabling it actually helps more now?

Because it removes 50% of the draw calls and 95% of the processing effects. So yes the image is cleaned

oddMLan commented 7 years ago

Then why does it work fine with OGL (with depth emulation disabled) now and it still doesn't with Direct3D, if both have depth emulation disabled?

What commit fixed this game for OGL without depth emulation, when the last version I used at the time I made this bug report, playing this game in OGL without depth emulation gave the exact same result as playing this game with Direct3D which doesn't emulate any of the depth effects?

oddMLan commented 7 years ago

Hm. The latest version I tested with HW OGL + Disable Depth Emulation regresses to the old behavior (objects get in front of the commands/tap/music bar) and Stage 2 & 3 depth effects of the characters is wrong. I'll see if I can bisect the commit that was the magic bullet for this game by disabling depth handling. This game has really weird stuff going on.

oddMLan commented 7 years ago

How it should look gsdx_20170317015646 How it looks now gsdx_20170317020726

How it should look gsdx_20170317021513 How it looks now gsdx_20170317021149

Gs dumps http://www.mediafire.com/file/vcdprd9ri0crns7/Parappa2_gsdumps.zip

oddMLan commented 5 years ago

A recent update seems to have fixed the noodles effect in HW, observable at the intro. They're wavy now (as they should) instead of stiff as before

imagen

The black box with Depth Emulation enabled during some stages is still present in all of the renderers, including SW. The mipmapping issues still remain across all renders as well. imagen imagen

This hack introduced f77c1900faf2baa3ffd1ca538f3b444c743b2444 fixed all the depth issues including the black box, that is until it got reverted. Could it be made a game specific hack? It even works without enabling depth emulation, so you get no speed penalty.

lightningterror commented 5 years ago

Maybe https://github.com/PCSX2/pcsx2/pull/2855 did it.

gregory38 commented 5 years ago

It wasn't really a hack. Well it is complex stuff.

If you only need a clear of depth buffer, we can add a crc check for this game.

Does it work with depth emulation too ? Or do you need to disable it ?

oddMLan commented 5 years ago

AFAIK this game was programmed closely with Sony, so it's extremely adapted to the PS2 hardware. It uses a lot of advanced features with depth, paletted textures, mipmapping, etc. The textures in the game are stored in a special format tm0, which is Combined Texture and CLUT data (preswizzled into a 32-bit buffer) for an optimized VRAM state, greatly reducing loading times. The game also does other weird things such as storing the cutscene data interleaving stereo audio, models and textures into a single archive (XTR). I've never seen other game optimizing as extremely as this one.

Even Sony themselves couldn't emulate 100% on their own emulated PS4 re-release. (Specifically the mipmapping one, they just use the higher detailed texture instead of the white gradient). I bet fixing the issues with this game would have a snowball effect on the others.

Does it work with depth emulation too ? Or do you need to disable it ?

Not sure, I'll go ahead and check again.

oddMLan commented 5 years ago

@gregory38 I compiled my own version with the fix but it doesn't seem to be working anymore. So I downloaded the old build from that commit, and the fix seems to work with or without depth emulation enabled. Except that depth emulation already fixes those in the first place, but it also introduces the black noodle artifacts, which doesn't happen with the fix + depth emulation disabled.

imagen

In this version the fix only works in the OGL HW backend. GSdx32-SSE4-lg.zip

MrCK1 commented 5 years ago

Are you on Linux or Windows?

Edit: Nevermind

oddMLan commented 5 years ago

Right now I'm using Windows 10 LTSC build 17763.316. AMD Radeon R7 250 with Adrenalin drivers 19.1.1, OpenGL® Version 25.20.15000.13544. Direct3D® Version 9.14.10.01377.

Thevoododoctor commented 5 years ago

@oddMLan That trick worked with using the old build + using your Video plugin. Thanks,

thekaio123 commented 4 years ago

you think that's someway there's something to add or fix to have the game "exactly" like the ps2/ps4 game like not with the black box(or black noodles), no lag when you get bad, noodle effects for bad and awful,no bugged shadows,no objects in front of the lyrics, food court sprites correctly (without the green around then),and the level 2 with the invisible rap text there's a LOT of problems while running PTR2 on the PSCX2 if isnt a way to play it exactly like the ps2/ps4 remaster at least a version to play with least bugs possible, at least 1 or 2 bugs that dont fuck the gameplay

ghost commented 4 years ago

@thekaio123 PTR2 on ps4 have only following fixes applied:

I don't think that any of those fixes apply here.

tadanokojin commented 4 years ago

@kozarovv idk why you would think a GIF/XGKICK wouldn't cause rendering problems. Regardless, it looks like a core issue. Game is rendering into the zbuffer after the clear. Can't help but think it's not intended.

Here's DobieStation: 004210 004211

Here's the same level in PCSX2 with sw rendering: 004212 004213

oddMLan commented 4 years ago

Like I said earlier this game is deceivingly uncomplex. Seems graphically simple on the surface but it actually does a lot tricky things behind the hood. Almost seems like a accuracy benchmark on its own. It was coded closely with Sony who has intimate knowledge on their own hardware, so I guess that's to be expected. If you focused on fixing this 'simple' game, I wonder - no, I bet it would benefit the whole PS2 library too.

EDIT: Tag GSdx-software should be added to this issue as well.

tadanokojin commented 4 years ago

I don't really think it's a GSdx problem.

thekaio123 commented 4 years ago

well, i play parappa a lot and i hate those glitches, do you know if there's a configuration that have none glitch, or less glitches possible?

tadanokojin commented 4 years ago

This is likely not going to get fixed without a hack/patch or changes to core.

tadanokojin commented 4 years ago

I forgot to update this.

This game sends draws for noodles and other stuff over PATH1 but the clears for depth come PATH3. Dobie gets both clears but GSdx only gets the clear before the noodles. I think it's a core issue as I don't see any reason for the clear to be missing. It's just a normal sprite.

refractionpcsx2 commented 4 years ago

Okay the issue is this

The game starts a VIF1 and GIF transfer at the same time, the idea is that PATH3 (GIF) will transfer the depth clear before VU1 (which is started from VIF1) sends the rendered noodles.

The problem is on PCSX2, VU1 is instant because of how it was fundamentally designed, as is the PATH1 transfer, so these happen before the PATH3 transfer has had chance to happen., so the rendered noodles get sent, then PATH3 clears them leaving the blank box in the corner.

Unfortunately the only solution to this (besides a nasty hack) is to rewrite the VU's to not be instant, which is kinda needed to fix some other problems also. This would be a MASSIVE task and requires also altering the EE Recompiler, and I don't think anybody wants to do it. Plus it will probably negatively affect the performance in such a way people won't be happy with it and then we get tons of people moaning that it's too slow.

ghost commented 4 years ago

Maybe is possible to fix it PS4 way as a game hack.

When EE PC is 0x15A008 (US release), and s0 == Vif1 CHCR CHCR = v0 CHCR & 0x05 == 0x05 and Vif1 TADR == 0x01C76AA0

then delay vif1 dma transfer (0x6500 on Ps4, not sure those are cycles or some time value).

I think this is the same issue like on ps4, since your description fit what i said few comments above. But i don't fully understand how much VU is before that GIF transfer happen on pcsx2, maybe this is not doable that way due to way pcsx2 VU work.

refractionpcsx2 commented 4 years ago

No, we don't handle dma's even remotely like the PS4. But yes the issue is the same

well, okay we could delay the transfer, but that would be for any game that uses that address. We can't do per-game DMA fixes, we would need to add a new hack, which I'd rather not do.

refractionpcsx2 commented 4 years ago

Here's a build with the PS4 hack in it, but I would suggest only using it on that game, nothing else.

Note: US version only

pcsx2-parappa.zip

oddMLan commented 4 years ago

Here's a build with the PS4 hack in it, but I would suggest only using it on that game, nothing else.

Note: US version only

pcsx2-parappa.zip

Confirmed. Works perfectly. Except for the mipmapping issue in VS mode, but that's a different core issue.

megamanzerobasslink commented 4 years ago

Here's a build with the PS4 hack in it, but I would suggest only using it on that game, nothing else. Note: US version only pcsx2-parappa.zip

Confirmed. Works perfectly. Except for the mipmapping issue in VS mode, but that's a different core issue.

Thanks so much this works perfect

refractionpcsx2 commented 4 years ago

Here's a build with something that isn't a complete hack, but should work fine on parappa (EU and US). I hope to get these changes in master eventually but it's being a bit of a pain in the ass.

pcsx2-parappa2.zip

thekaio123 commented 4 years ago

thank you all people, give me information if any update comes, im really excited for it

Em sex., 18 de set. de 2020 às 22:55, refractionpcsx2 < notifications@github.com> escreveu:

Here's a build with something that isn't a complete hack, but should work fine on parappa. I hope to get these changes in master eventually but it's being a bit of a pain in the ass.

pcsx2-parappa2.zip https://github.com/PCSX2/pcsx2/files/5248946/pcsx2-parappa2.zip

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PCSX2/pcsx2/issues/1610#issuecomment-695148858, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOR6GJIGEYRP7P5333SKKNTSGQFQTANCNFSM4CR6HDCQ .