xemu icon indicating copy to clipboard operation
xemu copied to clipboard

Ninja Gaiden Black experiencing water texture issues.

Open vanderleivieirainacio opened this issue 3 years ago • 20 comments

Bug Description

Water has what appears to be texture issues in the latest version of the Xemu emulator:

Captura de tela 2022-04-09 034519 .

Expected Behavior

The water should look smooth and crystal clear like in this previous version of Xemu:

Captura de tela 2022-04-09 075229

xemu Version

Xemu 0.6.2-90-g6f507c80af

Last working in: Xemu 0.6.2-84-gcd5d3df626

System Information

OS:Windows 11 Pro 64bits CPU:AMD Ryzen 7 1700 GPU:AMD Radeon RX 570 4GB GPU Driver: AMD Adrenalin Edition 22.4.1

Additional Context

No response

vanderleivieirainacio avatar Apr 09 '22 10:04 vanderleivieirainacio

Can you test with 0.6.2-85-gf0abe3c4fc and confirm that it breaks in that specific build (since it was the first one following the last working tag)? If it still works there, can you try the handful of subsequent builds and pin down which one causes it to stop working correctly?

abaire avatar Apr 09 '22 14:04 abaire

It breaks exactly on build 0.6.2-85-gf0abe3c4fc as the image below shows:

Captura de tela 2022-04-09 120902

vanderleivieirainacio avatar Apr 09 '22 15:04 vanderleivieirainacio

Thanks! And just to double check, your screenshot with build 84 was made today with the same exact hardware?

Checking because the only change in build 85 matches hardware behavior for a minimal test case and we need to rule out other variables as much as possible.

Also, are you able to build xemu? It'd be helpful to partially revert https://github.com/mborgerson/xemu/commit/f0abe3c4fc3e0b3395b80ebe7d6be2190fb15125 by changing the two GL_UNSIGNED_BYTE values back to GL_BYTE to just verify that that does not trigger the issue.

abaire avatar Apr 09 '22 15:04 abaire

Also to double check, what is your render scale at, and can this be reproduced near the chapter 10 "Ancient Aquaduct" save point?

I happen to have a save there and tried to repro with an 85 build but the water looks correct to me (only tested at 1x scale)

Also tested with a clean build at 6e196900 (version 88) and it still looks correct near that save point: Screenshot_20220409_084814

abaire avatar Apr 09 '22 15:04 abaire

Yes, the screenshots were taken on the same hardware. Unfortunately I'm not able to build xemu as I don't have the knowledge for that, sorry.

I checked with the rendering scale at 1x and 6x in the "Ancient Aquaduct" area from chapter 15 on "The Core" (I don't know if there would be a problem?) in version 85 of xemu and the water is correct. Remembering that the broken water problem happens in chapter 7 "Hidden Underground":

Captura de tela 2022-04-09 125952

Captura de tela 2022-04-09 130133

vanderleivieirainacio avatar Apr 09 '22 16:04 vanderleivieirainacio

Thanks for checking!

Any chance you could try to explain how to get to the area where the bug shows up starting at the Chapter 7 "Suspension Bridge Room" save point, the "Giant Statue Area" save point, or the "Junction Chamber" save point? I have all of those and just need to know how to get to that pool so I can try to reproduce the issue.

abaire avatar Apr 09 '22 16:04 abaire

The area where the bug is present is from the "Junction Chamber" save point just before facing the boss:

Captura de tela 2022-04-09 133757

vanderleivieirainacio avatar Apr 09 '22 16:04 vanderleivieirainacio

Thanks, confirmed that I can repro and also that doing a partial revert seems to at least mostly resolve the problem. There is still some odd looking rendering going on that I'll need to look into and I'll need to update the test to differentiate between the apparently signed and erroneously assumed/documented unsigned behavior.

Texture format is NV097_SET_TEXTURE_FORMAT_COLOR_SZ_G8B8

UPDATE: Doing a partial revert (making the value signed, but keeping the fixed paired handling of components) fixes NGB water, but causes the pgraph test to diverge from HW behavior. As far as I can tell, HW treats the value as unsigned (0 is black, 0x7F is half brightness, 0xFF is full) so more investigation is needed to work out what's going wrong here.

abaire avatar Apr 11 '22 03:04 abaire

I believe the problem is that xemu does not support the R/G/B signed texture filters:

...
nv2a: Warning unimplemented feature: NV_PGRAPH_TEXFILTER0_RSIGNED
nv2a: Warning unimplemented feature: NV_PGRAPH_TEXFILTER0_GSIGNED
nv2a: Warning unimplemented feature: NV_PGRAPH_TEXFILTER0_BSIGNED
nv2a: Warning unimplemented feature: NV_PGRAPH_TEXFILTER0_RSIGNED
nv2a: Warning unimplemented feature: NV_PGRAPH_TEXFILTER0_GSIGNED
...

which neatly explains why incorrectly making the texture signed fixes NGB and breaks the tests. This problem is almost certainly a dup of #587

abaire avatar Apr 11 '22 04:04 abaire

Thank you so much for the hard work man, I know how complicated it is to solve these problems even though they seem small.

vanderleivieirainacio avatar Apr 12 '22 15:04 vanderleivieirainacio

sorry if i'm bringing up an old case here, but is there something I can do on my end to rectify this? I'm seeing this issue in the 7.2.8 build. (Image from From "Chapter 2. Hayabusa Village). Appreciate any help

OS:Windows 10 Pro 64bits CPU:AMD Ryzen 9 5900X 12-Core Processor GPU:NVIDIA GeForce RTX 3080/PCIe/SSE2 GPU Driver: 4.0.0 NVIDIA 512.95

image

Machina74 avatar Jun 05 '22 20:06 Machina74

sorry if i'm bringing up an old case here, but is there something I can do on my end to rectify this? I'm seeing this issue in the 7.2.8 build. (Image from From "Chapter 2. Hayabusa Village). Appreciate any help

If you know how to, you could revert f0abe3c4fc3e0b3395b80ebe7d6be2190fb15125 as mentioned in my comment above. Keep in mind that this will break other games, and that you should not report any issues or file compatibility reports with a custom build.

If you don't know how to build from source and revert commits, then there's nothing you can really do apart from wait until this gets fixed. The problem is fully identified and understood, but implementing support for signed textures is non-trivial work, particularly since the xbox supports per-channel signed-ness so it may be a long time before this is resolved.

abaire avatar Jun 05 '22 21:06 abaire

sorry if i'm bringing up an old case here, but is there something I can do on my end to rectify this? I'm seeing this issue in the 7.2.8 build. (Image from From "Chapter 2. Hayabusa Village). Appreciate any help

If you know how to, you could revert f0abe3c as mentioned in my comment above. Keep in mind that this will break other games, and that you should not report any issues or file compatibility reports with a custom build.

If you don't know how to build from source and revert commits, then there's nothing you can really do apart from wait until this gets fixed. The problem is fully identified and understood, but implementing support for signed textures is non-trivial work, particularly since the xbox supports per-channel signed-ness so it may be a long time before this is resolved.

Thanks for the reply. Given your answer, I'll just keep the old Xemu launcher I had (V0.5.1.5-g072e3024d0), as water textures worked fine there, although this was the one with the "eye" problem. image

Machina74 avatar Jun 05 '22 22:06 Machina74

Also affects Bass Trophy Fishing 2007

Triticum0 avatar Jun 06 '22 17:06 Triticum0

Also affects Bass Trophy Fishing 2007 @Triticum0 I believe that is already tracked as part of #587. Can you add NGB to that bug? @vanderleivieirainacio can you close this bug as it's a duplicate of #587? Thanks!

abaire avatar Jun 06 '22 20:06 abaire

totally forgot

Triticum0 avatar Jun 06 '22 20:06 Triticum0

https://github.com/mborgerson/xemu/pull/785

ko81e24wy avatar Jun 12 '22 15:06 ko81e24wy

#785

Not entirely sure what this was in reference to, but I am pretty confident the problem here is the lack of signed texture support, not the two channel textures in 785 (which were fixed when it was merged back in March).

abaire avatar Jun 13 '22 00:06 abaire

#785

Not entirely sure what this was in reference to, but I am pretty confident the problem here is the lack of signed texture support, not the two channel textures in 785 (which were fixed when it was merged back in March).

Yes,change the code back will fix the water glitch of NGB and Spike out,but it will cause performance lag in Forza on windows build of xemu.

ko81e24wy avatar Jun 13 '22 14:06 ko81e24wy

I'm clueless as to how to build from source and do reverts, so if anyone does make a current build of Xemu to address this problem for Ninja Gaiden Black, it would be awesome if they'd consider sharing it here or on youtube.

TheMiguelSanchez avatar Jul 19 '22 17:07 TheMiguelSanchez

I only play NGB via Xemu, so I rebuilt the latest master with f0abe3c reverted. Here's the exe: xemu-NGB-waterfix-021923.zip

image

pas-de-2 avatar Feb 19 '23 13:02 pas-de-2

You are a true ninja!! Thank you!!!

TheMiguelSanchez avatar Mar 07 '23 16:03 TheMiguelSanchez

Yeah, I've been meaning to thank you for this build too @pas-de-2. Interestingly it runs NGB much better than the native port on Steam Deck, where certain transparency effects can cause the frame rate to drop to single digits or even hang the console. With this version the game seems to be full speed most of the time. 👍

OutRunner avatar Mar 07 '23 16:03 OutRunner

I only play NGB via Xemu, so I rebuilt the latest master with f0abe3c reverted. Here's the exe: xemu-NGB-waterfix-021923.zip

image

Thank you very much. I always thought with finally fixing of Ryus blue face / skin back in the day the water bug was introduced and still in. Now I see both graphic errors are possible to wipe out. Face and Water. Why this isnt already merged into master or at least suggested to merge?

Steff833 avatar Jul 09 '23 22:07 Steff833

Thank you very much. I always thought with finally fixing of Ryus blue face / skin back in the day the water bug was introduced and still in. Now I see both graphic errors are possible to wipe out. Face and Water. Why this isnt already merged into master or at least suggested to merge?

Because it undoes work that fixes other games and allows xemu to more faithfully emulate the actual hardware. Eventually somebody will get individual signed color channel textures implemented and this will be fixed again as well. Another alternative would be to add a hack flag to xemu to allow the fix to be turned off just for this game, but I don't personally think that's a good idea and goes against my understanding of the goals of the project.

abaire avatar Jul 09 '23 23:07 abaire

We will fix it properly, eventually. In the mean time, if the issue is too bothersome, I recommend just using the 'custom' version of xemu. I'll close this issue and mention the title in #587. Thanks

mborgerson avatar Jul 09 '23 23:07 mborgerson