Want games on SDLMAME to look as beautifully crisp and smooth on an LCD as they do on a CRT? This comes very close.
Warnings:
If you use the OSD menu at any time the display will flicker horribly. If your CPU or GPU is too slow the display will flicker horribly. If you use fastforward mode your display will flicker horribly. If your OS can't reliably schedule MAME fast enough your display will flicker in a less painful but still unpleasant way. Basically if you try anything other than playing the game it will flicker unpleasantly. And even if everything works perfectly you're making your monitor look like a slow old CRT, so you still get flicker (but the good type of flicker). If you have photosensitive epilepsy then attempt this at your own risk.
Prerequisites:
120Hz LCD (I'm using a ViewSonic VX2268wm)
Vsync enabled for OpenGL (I'm using the Free software ATI drivers with Ubuntu 10.10 and the xorg-edgers ppa, although I think it will work without the ppa too)
Fast enough CPU/GPU to run whatever game you want at double speed with zero glitches. I highly recommend installing a 1000Hz+full preemption kernel.
MAME configured with OpenGL rendering, no throttling, no frameskip, single threaded.
Open src/osd/sdl/drawogl.c (I used 0.137 with Nimitz' ShmupMAME 2.0 patch)
Find the line:
SDL_GL_SwapBuffers();
Immediately after it add:
glClear(GL_COLOR_BUFFER_BIT);
SDL_GL_SwapBuffers();
(so you have two buffer swaps with a clear between them).
Build as normal.
You need to manually set your monitor's refresh rate to double the game's refresh rate. Use gtf and xrandr, or whatever the Windows equivalent is if somebody's crazy enough to try this on Windows.
My system is too slow to run anything fullscreen (unoptimized drivers probably), but it works fine windowed at the same size. I clear the desktop, set wallpaper to plain black, set window borders to dark and hide the taskbars so I can have fake fullscreen.
Set your monitor brightness to maximum. This hack will halve the brightness. Turn off your room lights. DO NOT PANIC at how washed out everything looks, your eyes will adjust in a few minutes. Note how your LCD now looks almost identical to a CRT. Sample and hold blurring is almost completely gone. You can now easily get that "zone" feeling where you lose awareness of your surroundings and the stick moves without conscious thought.
I played a round of DoDonPachi to test it and scored 34M. It really did have that exciting CRT motion feeling. Ideally I'd like to get a LED lit 120Hz LCD, and somehow physically mod it so the LEDs actually flashed on and off with the correct timing, but this software hack is the next best option. It would also be nice to stop the OSD from flickering, and to optionally allow low brightness frames instead of fully black frames so you can trade off brightness and motion quality.
I'd be very interested if anybody else actually gets this working.
SDLMAME black frame insertion (fake CRT) hack
-
- Posts: 83
- Joined: Fri Apr 03, 2009 4:14 pm
- Location: UK
-
- Posts: 83
- Joined: Fri Apr 03, 2009 4:14 pm
- Location: UK
Re: SDLMAME black frame insertion (fake CRT) hack
I was having a lot of trouble getting this to work reliably with Ketsui until I realized that such rapidly fluctuating CPU load confuses power management. Power management disabled and it works perfectly.
Re: SDLMAME black frame insertion (fake CRT) hack
don't know how I missed this but... pics?
why 120hz?
why 120hz?
=/
Re: SDLMAME black frame insertion (fake CRT) hack
Not much point in pics, the effect can only be seen in motion.Kingbuzzo wrote:don't know how I missed this but... pics?
60fps source with a black frame inserted between every original frame to simulate CRT flicker.Kingbuzzo wrote:why 120hz?

Re: SDLMAME black frame insertion (fake CRT) hack
do you really need vsync? I'd assume that introduces lag. Speaking of which, have you tested the input lag on this lcd?
edit: found a test here. If this is accurate, I must say I'm impressed
http://3dvision-blog.com/viewsonic-vx22 ... -good-crt/
edit: found a test here. If this is accurate, I must say I'm impressed
http://3dvision-blog.com/viewsonic-vx22 ... -good-crt/
=/
-
- Posts: 83
- Joined: Fri Apr 03, 2009 4:14 pm
- Location: UK
Re: SDLMAME black frame insertion (fake CRT) hack
You really do need vsync, and that's true even if you have a 60Hz monitor. Vsync is the *only* way to get perfect 1:1 mapping of emulated:displayed frames. If you're not using vsync as the master timing source then you always get annoying visual glitches.Kingbuzzo wrote:do you really need vsync? I'd assume that introduces lag. Speaking of which, have you tested the input lag on this lcd?
edit: found a test here. If this is accurate, I must say I'm impressed
http://3dvision-blog.com/viewsonic-vx22 ... -good-crt/
And this black frame insertion hack actually reduces lag as a side effect of the simple CPU time wasting implementation.
Re: SDLMAME black frame insertion (fake CRT) hack
I wanted to follow up, since it's now year 2013, and there is now a web-based demonstration of black frame insertion:
http://www.testufo.com/#test=blackframes
(Works best in Chrome, IE10 or FireFox 24+)
There's now a third party MAME 0.148 patch with black frame insertion, and I believe GroovyMAME is going to eventually build the black frame insertion feature in:
www.blurbusters.com/mame
"Software-based black frame insertion improves motion clarity in MAME on 120 Hz displays"
http://www.testufo.com/#test=blackframes
(Works best in Chrome, IE10 or FireFox 24+)
There's now a third party MAME 0.148 patch with black frame insertion, and I believe GroovyMAME is going to eventually build the black frame insertion feature in:
www.blurbusters.com/mame
"Software-based black frame insertion improves motion clarity in MAME on 120 Hz displays"