gonetz / GLideN64

A new generation, open-source graphics plugin for N64 emulators.
Other
762 stars 175 forks source link

Zelda MM LoT fixes. #2674

Closed gonetz closed 2 years ago

gonetz commented 2 years ago

Fixed issues from tasks: Majora's Mask Lens of Truth Depth Issue #2074 Lens of truth depth issues #2647

Both regular and N64 depth compare work.

fzurita commented 2 years ago

Is the reason that the new code is only activated for MM is because you are not sure if other games will break? Or do other games break for sure?

gonetz commented 2 years ago

The mechanism of LoT in Zelda MM is unique for this game. My previous solution for Zelda MM LoT worked only for Zelda MM. My new solution is also very hackish and Zelda MM specific. I don't know how to make a general solution. Since I never saw smth like this in other games, it's ok to have a specialized solution for a specific problem. Note, that LoT works only in HLE mode with "One piece" BG mode. It was like that before, nothing new here.

fzurita commented 2 years ago

I tested the one scenario with the ghost and I didn't see any issues and it appears fixed. I'll check the shadow issue mentioned above.

N64 Depth compare seems to be working ok in Android as well with the LoT.

fzurita commented 2 years ago

I do see the issue with the shadow. Shadows seem to disappear when the LoT is active, but only in the area outside the lens of truth effect as shown in the other image posted.

weinerschnitzel commented 2 years ago

Would understanding how the actor flags are used in oot help to solve this? I dont think the code would be too different in mm, but some actors may have different flags.

Example case:

https://github.com/zeldaret/oot/blob/4f6967b02778e61ed0e9fa471f9ba7d67524c908/src/overlays/actors/ovl_En_Test/z_en_test.c#L1810

gonetz commented 2 years ago

Small issue with the shadows outside the area of effect. https://i.imgur.com/xc7EYbf.mp4

Savestate: http://0x0.st/oN2A.zip

Emulator crashes on loading of that savestate.

gonetz commented 2 years ago

As I see, the shadow issue happens only with N64 depth compare enabled. It is because only z-buffer image texture is copied, while delta-z image texture is just cleared. delta-z is important for correct display of decal surfaces, like shadows. I need to introduce 2 more texture inputs in shaders to copy not only z-buffer, but also delta-z one.

gonetz commented 2 years ago

PR updated. Please disable/clear your shader cache.

gonetz commented 2 years ago

Another update.

Jj0YzL5nvJ commented 2 years ago

Fixed! It also fixes an unreported problem with footprints =P