melonDS-emu / melonDS

DS emulator, sorta
https://melonds.kuribo64.net
GNU General Public License v3.0
3.27k stars 542 forks source link

Zig Zag pattern working only on NO$GBA #1015

Open Brankale opened 3 years ago

Brankale commented 3 years ago

I don't know if this can be useful but I found that this zig zag pattern on the wall is working only on NO$GBA

save.zip

DS DS

NO$GBA no$gba

DeSmuME desmume

MelonDS melonds

RSDuck commented 3 years ago

what kind of DS are you playing on?

Arisotura commented 3 years ago

have you tried the software renderer?

MarcoEstevez commented 3 years ago

tested with software renderer and JIT disabled

image

Brankale commented 3 years ago

what kind of DS are you playing on?

I took a photo from a 2DS but it's the same also on a DS Lite.

have you tried the software renderer?

I used the Software Renderer with JIT disabled.

fleroviux commented 3 years ago

Possibly related to the fractional part of texture coordinates. I can't quite make it work perfectly in my 3D renderer yet, but rounding the texture coordinates seems to achieve a similar effect. image

ghost commented 3 years ago

its kinda funny that they downplayed the pattern on the dp remakes lol.

Wunkolo commented 3 years ago

its kinda funny that they downplayed the pattern on the dp remakes lol.

haha you're right. In the remake they make it an intentional pattern image

nadiaholmquist commented 3 years ago

billede Here's another picture of it on hardware, on a DSi XL.

Arisotura commented 3 years ago

would be weird if it was something like texcoord rounding -- I don't recall observing any rounding when I did my hardware tests, but you never know when I turn out to be wrong...

Wunkolo commented 3 years ago

NO$GBA no$gba

I notice that NO$GBA seems to alternate the zig-zags in the reverse direction. It looks like has to do with rounding errors. In particular, how it integrates the two texture coordinate derivatives across the scanline. @fleroviux's renderer seems to be alternating the zig-zag in the opposite direction as well similar to NO$GBA. Compared to the actual hardware rounding errors.

Wunkolo commented 3 years ago

Here's an image of the zig-zag pattern taken straight from the NDS Hardware using a capture card, provided by Aspharon. image

Brankale commented 3 years ago

I found out that before melonDS 0.2 and in particular before this commit eb65685 the game looked like this

Schermata da 2021-05-06 20-20-38

It's not even close to the correct result but at least there's something that can resemble a zig zag pattern, at least on the right.

I know it's probably useless because the code is 4 years old but maybe can give some hints on what can cause this issue.

RSDuck commented 3 years ago

this could be related be related to the precision of the reciprocal and the rounding bias used in the linear interpolation code path.

If those values are tweaked you get results which look a lot like how it should be, though I was unable to get it exactly right (it's probably a lot more complicated): grafik

Dragios commented 3 years ago

Rendering inaccuracy Left is using melonDS 0.9.2 with software renderer while right is the NDS hardware capture (I reuse back the same source from above comments)

These are the subtle differences I notice between melonDS vs real hardware as highlighted in red circle. There might be more especially the outlines but I just highlight the obvious ones I know this is basically pixel peeping but I just wanna highlight in case some of you might missed it since melonDS strive for accuracy.

Here is the summary of what I notice: