xemu
xemu copied to clipboard
Ninja Gaiden Black experiencing water texture issues.
Bug Description
Water has what appears to be texture issues in the latest version of the Xemu emulator:
.
Expected Behavior
The water should look smooth and crystal clear like in this previous version of Xemu:

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
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?
It breaks exactly on build 0.6.2-85-gf0abe3c4fc as the image below shows:

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.
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:

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":


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.
The area where the bug is present is from the "Junction Chamber" save point just before facing the boss:

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.
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
Thank you so much for the hard work man, I know how complicated it is to solve these problems even though they seem small.
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

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.
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.

Also affects Bass Trophy Fishing 2007
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!
totally forgot
https://github.com/mborgerson/xemu/pull/785
#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).
#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.
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.
I only play NGB via Xemu, so I rebuilt the latest master with f0abe3c reverted. Here's the exe: xemu-NGB-waterfix-021923.zip

You are a true ninja!! Thank you!!!
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. 👍
I only play NGB via Xemu, so I rebuilt the latest master with f0abe3c reverted. Here's the exe: xemu-NGB-waterfix-021923.zip
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?
Thank you very much. I always thought with finally fixing of Ryu
s 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.
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