gonetz / GLideN64

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

Jet Force Gemini: Crosshairs broken #2653

Closed avengah closed 2 years ago

avengah commented 2 years ago

I tried with Project64, Mupen64Plus, Retroarch with Mupen64Plus-Next core and original Mupen64, and original Mupen64 is the only one where the crosshairs display correctly. I've tried messing with various settings but nothing fixes it in the newer emulators without using a different video plugin.

oddMLan commented 2 years ago

That's due to the emulator's fault broken or missing FBInfo implementation. The CPU writes the crosshair to the framebuffer but the plugin can't know when this happens. It's the job of the emulator to inform the plugin of this change. Original Mupen64 is the only emulator that properly implements this requirement.

avengah commented 2 years ago

I see. Is Mupen64 the best emulator for JFG then, especially as I'm on an old, slow PC? It even gets the rain on Tawfret right as long as Copy auxiliary buffers to N64 memory is off. Apparently most emulators struggle with that!

quicksilver7837 commented 2 years ago

Do all crosshairs display incorrectly for you or just certain weapons?

Also have you noticed a strange camera shaking issue on tawfret? Mainly around the village and bridge area? I wonder if it's a related issue?

oddMLan commented 2 years ago

I see. Is Mupen64 the best emulator for JFG then, especially as I'm on an old, slow PC? It even gets the rain on Tawfret right as long as Copy auxiliary buffers to N64 memory is off. Apparently most emulators struggle with that!

Yes, afraid so. Until newer emus get a better FBInfo implementation.

avengah commented 2 years ago

Do all crosshairs display incorrectly for you or just certain weapons?

Also have you noticed a strange camera shaking issue on tawfret? Mainly around the village and bridge area? I wonder if it's a related issue?

All the crosshairs are broken. None of them show the outer part of the crosshair; the darker green parts that follow behind; you only see the central X with some weapons, and other weapons don't show any part of the crosshair.

I haven't played Tawfret through yet. I have only done quick tests so far. I will let you know when I get there on my playthrough.

I will note that some of the newer LLE graphics plugins like Angrylion, ParaLLEl etc. might possibly be better on faster PCs, but on my old toaster they stutter badly. ParaLLEl runs smoothly only at 1x upscaling. So I'm pretty much stuck using Project64 Video and GLideN64 (and Jabo's works too but is quite glitchy). Banjo-Tooie and Conker run perfectly for me with Project64 and GLideN64. Thanks!

avengah commented 2 years ago

I got it mostly working well in m64p with GLideN64 and original mupen64, but there is an issue with the characters' shadows. For crosshairs to show correctly, Copy auxiliary buffers to N64 memory must be off. However, for shadows to display correctly, it must be on. With it off, when you jump, there is a black line that appears next to you on the ground, and it gets thicker and disappears as you go up, then reappears and goes thinner, then disappears as you land. I think this is an issue exclusive to GLideN64 as I never saw it in other plugins.

weinerschnitzel commented 2 years ago

I thought there were efforts made to make mupen64plus handle fbinfo the same as mupen64 0.51?

If the behavior is not the same between mupen64 and mupen64plus, maybe there is still room for mupen64plus to improve?

EDIT: mupen64plus had fixes made to make the old dynarec behave like mupen64 0.5.1, but there are suspected missing reads and writes through PI DMA. CountPerOp also has implications on what gets read. New_dynarec is missing hooks and is currently not compatible.

Fbinfo is disabled when using either dynarec tho. If you remove the dynarec check in mupen64plus, I think you will get results using the old dynarec. It would be interesting to note if JFG works there.

I dont think copy auxiliary buffer to rdram should clobber fbinfo, though. That would be a plugin matter.

gonetz commented 2 years ago

I got it mostly working well in m64p with GLideN64 and original mupen64, but there is an issue with the characters' shadows. For crosshairs to show correctly, Copy auxiliary buffers to N64 memory must be off. However, for shadows to display correctly, it must be on. With it off, when you jump, there is a black line that appears next to you on the ground, and it gets thicker and disappears as you go up, then reappears and goes thinner, then disappears as you land. I think this is an issue exclusive to GLideN64 as I never saw it in other plugins.

crosshairs and shadows are frame buffer effects, but very different ones. Crosshair is implemented as CPU direct write to the main frame buffer in N64 RDRAM. Emulator uses FBInfo to notify the plugin about that, so the plugin can copy pixels written by CPU to video card's buffer. Dynamic shadow uses an aux frame buffer to render the shadow dynamically, and then to use that buffer as texture. This game also uses some softening post-processing of that image on CPU side. The aux buffer must be copied to RDAM to make that post-processing working. If "Copy auxiliary buffers" is disabled, the shadow is taken from the hi-res aux buffer. Texture wrap/clamp may work incorrectly in that case, so that black line artifact appears.

I'm not sure why FBInfo and "Copy auxiliary buffers" does not work together. FBInfo requires main buffer in RDRAM be force cleared each frame, so only pixels written by CPU remain in it. Aux buffers need not be cleared, so aux copy should work with FBInfo.

Jj0YzL5nvJ commented 2 years ago

mupen64plus/mupen64plus-core#931

gonetz commented 2 years ago

I fixed several hard-to-find issues with FBInfo and Aux buffer copy both enabled, #2657 Crosshairs and shadows in JFG now work well. Tested with Mupen64. It should work with mupen64plus with Cached Interpreter, but I did not test it.

gonetz commented 2 years ago

I tested JFG with mupen64plus, Cached Interpreter mode. FBInfo works fine. @avengah please test the latest master build.

mudlord commented 2 years ago

This game also uses some softening post-processing of that image on CPU side.

The first game to do Gaussian blur-style soft shadows, which is exceptionally amazing. Modern games instead used Shader Model 2.0 pixel shaders and up on render target/FBO textures for this.

Rare was exceptionally ahead of its time.

quicksilver7837 commented 2 years ago

With the recent changes to this game I am now getting this on my raspberry pi 4 in the second area of the tawfret level also the little video screens on the character select menu are just black and static: 20220224_223858 image

Prior to the changes the game was playable. If I turn off the gliden64 compatability check the game functions as it did before so this may be caused by changes to the gliden64 compatibility .ini

weinerschnitzel commented 2 years ago

@quicksilver7837 are you using a dynarec core? The new settings prefer fbinfo, and if you are not using an interpreter core with mupen64plus, fbinfo will not be used.

Enabling copy color to RDRAM should restore the old functionality if you need to use the dynarec core for speed.

gonetz commented 2 years ago

The new settings prefer fbinfo, and if you are not using an interpreter core with mupen64plus, fbinfo will not be used.

Right. JFG with FBInfo enabled, mupen64plus: JFG1 JFG2

gonetz commented 2 years ago

Fixed with PR #2657