melonDS
melonDS copied to clipboard
Shadow Zfighting in The Legend of Zelda: Phantom Hourglass and Spirit Tracks (OpenGL Renderer)
When using the OpenGL renderer in melonDS, these two titles suffer from shadow zfighting when on non-flat surfaces.
To reproduce this issue, the easiest way is to load Spirit Tracks and simply walk around on the carpet after the opening cutscenes. Both Niko (person you're talking to) and your shadow will flicker around on the carpet as you walk around. This is a touchscreen controlled game, so, tap on the screen to move around.
When using software renderer, everything renders as expected. This issue does not occur on Nintendo DS hardware.
Software Renderer:
OpenGL Renderer:
not to repeat what i said in another issue but theres a similar problem for metroid prime hunters
Z-fighting is tricky shit. the OpenGL renderer tries to emulate the DS's 24-bit depth range, but I'm not too sure how to go about emulating 24-bit integers with standard OpenGL shito (typically 32-bit floats, or some weird 24-bit float format that can't really hold 24-bit integers without losing precision)
there's also the whole issue of having to interpolate these huge values over polygons. maybe transforming them to a 'better' range might help.
Still broken.
The Z-fighting issue still occurs https://user-images.githubusercontent.com/77578151/159164396-efab88d8-4ac2-40ac-a960-2050191ba56c.mp4
https://user-images.githubusercontent.com/77578151/159164396-efab88d8-4ac2-40ac-a960-2050191ba56c.mp4
Z-fighting is tricky shit. the OpenGL renderer tries to emulate the DS's 24-bit depth range, but I'm not too sure how to go about emulating 24-bit integers with standard OpenGL shito (typically 32-bit floats, or some weird 24-bit float format that can't really hold 24-bit integers without losing precision)
there's also the whole issue of having to interpolate these huge values over polygons. maybe transforming them to a 'better' range might help.
DeSmuMe recently added internal resolution scaling to their OpenGL renderer, and it doesn't have this problem of Z-Fighting in Phantom Hourglass. So maybe MelonDS can do whatever they are doing?
DeSmuMe recently added internal resolution scaling to their OpenGL renderer, and it doesn't have this problem of Z-Fighting in Phantom Hourglass. So maybe MelonDS can do whatever they are doing?
Possibly, but I imagine taking inspiration from how they handle it doesn't translate well to the melonds implementation. It looks like desmume fixed it in this commit (untested though).
As you can see, the way they handle things is pretty different from melonds lol