mgba-emu / mgba

mGBA Game Boy Advance Emulator
https://mgba.io/
Mozilla Public License 2.0
5.42k stars 747 forks source link

Flickering in some games. #76

Closed Zusion closed 4 years ago

Zusion commented 8 years ago

Some games such as the one in the example above (Boktai) swap between 2 frames quickly to create a kind of pseudo transparency. I'm assuming this doesn't work as intended due to the difference in speed of the GBA's display compared to the monitors we use. Is it possible to implement some kind of interpolation or something to mimic that effect?

endrift commented 8 years ago

If you run with sync to video enabled, it'll look fine, but there are plenty of other issues there. As for deblinking, I'm not entirely sure what the best way to do that is without making everything look smudged. I can look into it for a future version.

Zusion commented 8 years ago

I've tried it with sync to video enabled and it's still the same.

ShadowOne333 commented 8 years ago

I can confirm this issue for the Wii version. I tried Yoshi's Island (Super Mario Advance 3) with the flickering question clouds and they don't flicker at all.

Either they're completely visible or completely invisible depending on when the flickering start.

Rev used: Oct 10th.

ShadowOne333 commented 8 years ago

Just a heads up. I tried the nightly for Oct 24th and played Yoshi's Island with it. The flickering clouds with the question mark now blink/flicker properly!

Seems to have been solved with that build.

taisel commented 8 years ago

@shadowone333 for 60 fps shadow flicker to not pulse at all would require the host display to be running at 30 fps and not 60 fps. Is the wii version running at 30 fps NTSC instead of 60?

photodiode commented 7 years ago

I encountered the flickering when I tried to play ZAS Setting the frame skip to 1 "fixes" it, but then you only get half the background so to speak.

zas2

Just an idea: Make a ghosting filter to emulate slow LCD?

sczther commented 7 years ago

ZAS is intentionally, it's made for the original DMG, which has the last frame still drawn, so it essentially mixes them both. (That's the famous ghosting, making many action games unpleasant to play.) ZAS uses this quirk to have rich backgrounds, on a DMG, it has both the ships and the background at once. There should be an option like "mix frames" in mGBA to simulate this behavior. If there isn't, then that's the problem.

photodiode commented 7 years ago

Yes, a "mix the current and last frame" option would be great.

LordGinger commented 7 years ago

The issue is still present in the latest nightly (0.6-4464-a5f029c). In other emulators it can be alleviated using a motion blur shader, which helps with interframe blending.

endrift commented 7 years ago

"Issue"? It's an intended effect on hardware. The only reason this is still open is so I can remember to add an interframe blending option to imitate hardware ghosting.

GrieverV commented 5 years ago

Just noting that Final Fantasy I & II: Dawn of Souls also uses this effect for transparency Final Fantasy I

ubergeek77 commented 5 years ago

I know this is an old issue, but I thought I would add something that @endrift and others may find interesting.

When I switched from playing Boktai on my Android phone to playing it on Windows (both using the mGBA core), the flickering became much more noticeable on Windows. I double checked on my phone, and sure enough, the transparency/flickering effect is quite good under Android. I didn't even give the effect much thought.

I don't know any of the specifics, but I remember learning a long time ago that Windows has its own sort of Vsync/framebuffer that it applies to everything running in windowed mode. From personal experience, this effect has been noticeable; I remember having a ton of screen tearing in older games without proper Vsync support, and running them in windowed/borderless windowed solved most of the issues, whereas exclusive fullscreen would bypass this framebuffer, leading to screen tearing. I tried running mGBA in fullscreen, but either it only implements borderless windowed mode, or my having multiple monitors prevented me from trying it in exclusive fullscreen mode. Doing so had no visible affect.

In any case, I think this Windows framebuffer is causing the problems here. Windows erroneously trying to sync the frames to the screen's refresh rate are causing some of the flickering effects in GBA games to be skipped. Using the mGBA setting to sync to video does help somewhat, but the improvement is minimal, and it's nowhere near as seamless as on Android. Again, I don't know the full technical details of this, but from what I've seen, I'd say this is a pretty good guess.

In summary:

I'm not sure about other consoles that can run mGBA through RetroArch, but if I had to guess, this is a Windows-specific issue.

I should note that this may/may not have been an issue in the past for non-Windows systems (this is a 3-year-old issue, after all), however this is my experiences using the latest version of mGBA available through RetroArch and mgba.io. As of this writing, that's the 9-20-2018 nightly build on Windows, and version 0.7-WIP on Android through RetroArch (which is probably the same build, or extremely similar).

coolanybody commented 5 years ago

This also happens with Friends of Mineral Town bad text

endrift commented 5 years ago

Interframe blending for Qt and SDL versions added in 47bf26ff73d9bdf8a044773b20fc816f6e823e7e. Wii, Vita, 3DS and Switch implementations forthcoming. Still deciding how I'm going to handle RA.

PrincessPleco commented 5 years ago

A wonderful feature. I tested in Golden Sun and Final Fantasy I & II - Dawn of Souls. Works great.

Except... I think I found a bug. Turn on the interframe blending. Then run your mouse cursor over the screen. It seems to interfere with the blending when you do. This is in software and OpenGL video modes both.

endrift commented 5 years ago

Implemented now everywhere except RA and OpenEmu.

benderscruffy commented 5 years ago

everytime i tick Interframe blending the screen goes black but music plays (every game) in opengl it doesnt do it in software i have an AMD Radeon HD 7450

PrincessPleco commented 5 years ago

If it helps, my video card is the Nvidia Geforce 750 Ti and I'm working with Windows 10 Home 64-bit Version 1809.

endrift commented 4 years ago

@CharlesCorrin what version of the drivers do you have? I can't reproduce on my (newer) Nvidia card on Windows.

PrincessPleco commented 4 years ago

Nvidia driver version 26.21.14.3086 , dated May 22 2019. The newest one at this time. I usually get the newest drivers fast. Could the driver be buggy?

Oh, and I should describe the alleged bug better. It looks like the frames aren't blending while the mouse cursor is moving across the program window. But when the cursor is still, mGBA blends properly. Test game is Final Fantasy I & II - Dawn of Souls.

EDIT: Made a new discovery: With "Sync to video" enabled, the bug is gone completely.

endrift commented 4 years ago

I encountered driver bugs with an earlier version, but I doubt that's what's going on here. I might need to find a way to log this stuff.

PrincessPleco commented 4 years ago

After the success with https://github.com/mgba-emu/mgba/commit/09ccf5403eb0a0d85fa119c612b9070fe8807818 for the other issue, I decided I should test this. The bug I reported in this topic is fixed too. :3 Though I don't know why it is.

benderscruffy, how's the one you reported? Fixed or no?

benderscruffy commented 4 years ago

no it is worse now any game using opengl is black screen with music playing with or without Interframe blending ticked i can only use software (Qt) now

endrift commented 4 years ago

OpenGL force 1.x should be fixed now, as is interframe blending on 1.x.

endrift commented 4 years ago

This is fixed now in everything except the libretro core, but it's a frontend feature so Retroarch should implement it instead of the cores.

tnelling commented 3 years ago

mgbaAW2

Not sure if this is the exact same issue, but I ran into this with Advance Wars 2 dialogue. The issue persists whether or not I have interframe blending or sync to video enabled (in the gif both are enabled).

endrift commented 3 years ago

That is issue #1790, not this one. Do you have an AMD GPU?

tnelling commented 3 years ago

I'm not sure why it would be #1790, since I'm not holding the turbo key (or doing anything turbo related).

I have an NVIDIA GeForce.

Liger0 commented 3 years ago

I'm not sure why it would be #1790, since I'm not holding the turbo key (or doing anything turbo related).

I have an NVIDIA GeForce.

I actually have had it without using turbo hold key, but it seems to be more reproduce-able with the turbo.

tnelling commented 3 years ago

For what it's worth, after I created this, I noticed that it was only happening with dialogue at the top of the screen. The dialogue at the bottom didn't seem to have the issue. Though I can't say with absolute certainty that it never did.

cjlaborde commented 3 years ago

mgbaAW2

Not sure if this is the exact same issue, but I ran into this with Advance Wars 2 dialogue. The issue persists whether or not I have interframe blending or sync to video enabled (in the gif both are enabled).

I have same issue with advanced wars flickering3

endrift commented 3 years ago

Again, that's #1790, not this.

endrift commented 3 years ago

Actually, looking at these GIFs again, that might be a separate bug that just affects Advance Wars. It's 100% not this bug, but it may not be that bug either.

endrift commented 3 years ago

Relevant Advance Wars bug was filed as #1823.