melonDS icon indicating copy to clipboard operation
melonDS copied to clipboard

Shadow Zfighting in The Legend of Zelda: Phantom Hourglass and Spirit Tracks (OpenGL Renderer)

Open JMC47 opened this issue 5 years ago • 5 comments

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

OpenGL Renderer: image

JMC47 avatar Jun 26 '19 21:06 JMC47

not to repeat what i said in another issue but theres a similar problem for metroid prime hunters image image

steventylerseanherr avatar Nov 06 '19 06:11 steventylerseanherr

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.

Arisotura avatar Nov 08 '19 21:11 Arisotura

Still broken.

Capture

ghost avatar Dec 07 '21 05:12 ghost

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

yontekh avatar Mar 20 '22 13:03 yontekh

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?

yontekh avatar Sep 01 '22 21:09 yontekh

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

Codex- avatar Sep 18 '23 01:09 Codex-