Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ninja Gaiden Black experiencing water texture issues. #837

Closed
vanderleivieirainacio opened this issue Apr 9, 2022 · 26 comments
Closed

Ninja Gaiden Black experiencing water texture issues. #837

vanderleivieirainacio opened this issue Apr 9, 2022 · 26 comments
Labels
bug Something isn't working

Comments

@vanderleivieirainacio
Copy link

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 vanderleivieirainacio added the bug Something isn't working label Apr 9, 2022
@abaire
Copy link
Contributor

abaire commented Apr 9, 2022

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?

@vanderleivieirainacio
Copy link
Author

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

Captura de tela 2022-04-09 120902

@abaire
Copy link
Contributor

abaire commented Apr 9, 2022

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 f0abe3c by changing the two GL_UNSIGNED_BYTE values back to GL_BYTE to just verify that that does not trigger the issue.

@abaire
Copy link
Contributor

abaire commented Apr 9, 2022

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 6e19690 (version 88) and it still looks correct near that save point:
Screenshot_20220409_084814

@vanderleivieirainacio
Copy link
Author

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

@abaire
Copy link
Contributor

abaire commented Apr 9, 2022

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.

@vanderleivieirainacio
Copy link
Author

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

@abaire
Copy link
Contributor

abaire commented Apr 11, 2022

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
Copy link
Contributor

abaire commented Apr 11, 2022

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

@vanderleivieirainacio
Copy link
Author

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

@Machina74
Copy link

Machina74 commented Jun 5, 2022

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

@abaire
Copy link
Contributor

abaire commented Jun 5, 2022

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.

@Machina74
Copy link

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

@Triticum0
Copy link

Also affects Bass Trophy Fishing 2007

@abaire
Copy link
Contributor

abaire commented Jun 6, 2022

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!

@Triticum0
Copy link

totally forgot

@ko81e24wy
Copy link

#785

@abaire
Copy link
Contributor

abaire commented Jun 13, 2022

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

@ko81e24wy
Copy link

ko81e24wy commented Jun 13, 2022

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

@TheMiguelSanchez
Copy link

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.

@pas-de-2
Copy link

pas-de-2 commented Feb 19, 2023

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

@TheMiguelSanchez
Copy link

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

@OutRunner
Copy link

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

@Steff833
Copy link

Steff833 commented Jul 9, 2023

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?

@abaire
Copy link
Contributor

abaire commented Jul 9, 2023

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.

@mborgerson
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants