21 January 2013, 19:51 | #1 |
FS-UAE Developer
Join Date: Dec 2011
Location: Førde, Norway
Age: 43
Posts: 4,043
|
Improved scanline renderer in FS-UAE
Hi, inspired by Dr.Venom and Pixelfans ideas in http://eab.abime.net/showthread.php?t=63009, I modified FS-UAE's scanline filter to apply different intensities to the scanline effect depending on the intensity of the underlying pixel. I also blend neighboring pixels horizontally to make the output a little more "analog".
I think the result is quite nice: Scaled 2x: |
21 January 2013, 21:09 | #2 |
Global Moderator
Join Date: Aug 2008
Location: Sidcup, England
Posts: 10,300
|
|
21 January 2013, 21:24 | #3 |
Amiga-based Cyborg
Join Date: Dec 2004
Location: Canada
Posts: 808
|
This is a huge improvement over the "bad old days", when scanlines in emulation were just black lines overlaid on the screen.
|
21 January 2013, 21:39 | #4 |
Old fart
|
Hello Frode, can you post screenshot in game? instead of main screen? :-)
By the way it looks very nice. Regards spajdr |
21 January 2013, 21:50 | #5 |
FS-UAE Developer
Join Date: Dec 2011
Location: Førde, Norway
Age: 43
Posts: 4,043
|
Sure
|
21 January 2013, 22:38 | #6 |
Missile Command Champion
Join Date: Aug 2005
Location: Germany
Age: 52
Posts: 12,470
|
Looks great. Is it a .shader file that work with the normal WinUAE version too?
|
21 January 2013, 22:44 | #7 |
FS-UAE Developer
Join Date: Dec 2011
Location: Førde, Norway
Age: 43
Posts: 4,043
|
No, this is pure (CPU) software filter running in FS-UAE before the frame is rendered to screen. FS-UAE has support for loading custom OpenGL shaders from files, and it would make sense to move this work to the GPU (to offload the CPU). But this implementation would not work on WinUAE either, as WinUAE uses Direct3D and FS-UAE uses OpenGL shaders.
The implementation is trivial though, nothing technically fancy, so it shouldn't be difficult to write a shader (in any shader language). |
21 January 2013, 22:58 | #8 | |
FS-UAE Developer
Join Date: Dec 2011
Location: Førde, Norway
Age: 43
Posts: 4,043
|
I think the Flashback title screen looks especially good:
To compare with and without filter: Without filter: http://fengestad.no/fs-uae/wp-conten...reenshot-6.png With filter: http://fengestad.no/fs-uae/wp-conten...eenshot-51.png Quote:
I'll also create a small guide on what display settings to use to get the best results with scanlines (and other filters). "Correct" scaling is vital to get good results on LCDs. |
|
21 January 2013, 22:58 | #9 |
Missile Command Champion
Join Date: Aug 2005
Location: Germany
Age: 52
Posts: 12,470
|
I see, thanks for your detailed answer. Maybe somebody is willing to write the D3D shader code then.
Last edited by Retro-Nerd; 21 January 2013 at 23:12. |
22 January 2013, 13:15 | #10 |
Old fart
|
This looks great Frode. Wish i had this via some kind of plugin or screen enhancer driver for Indivision MKII AGA.
|
26 January 2013, 18:16 | #11 |
Amiga-based Cyborg
Join Date: Dec 2004
Location: Canada
Posts: 808
|
I know I'm going to sound like a picky bastard here... but although the new scanlines are a definite improvement on low-res non-interlaced screens (excellent, really), they're too strong on high-res interlace.
On real Amiga monitor, interlaced screen scanlines are much less visible than on non-interlaced screens. I'd really like to use the new scanlines only on non-interlaced screens and the fainter old scanlines on interlaced. (...yes, I already said I was a picky bastard ) |
02 February 2013, 15:11 | #12 | |
FS-UAE Developer
Join Date: Dec 2011
Location: Førde, Norway
Age: 43
Posts: 4,043
|
Quote:
So perhaps I'll instead re-implement the scanline feature as shader(s), and make it possible to use different shaders on different "screen modes" (low-res, high-res, interlaced, RTG, etc) and/or make such information available to the shader. |
|
02 February 2013, 17:23 | #13 |
Da Digger :)
Join Date: Nov 2008
Location: Monza, Italy
Posts: 2,822
|
Beautiful work, FrodeSolheim!!
Wouldn't it be truly possible to make a corresponding filter for WinUae? If so, couldn't you find the time to realize it? I have to confess I never tried your FS-UAE... because I thought it was for Linux only and because I didn't know which benefits the Windows version has over WinUae. Now I took a walk on the website and see that it's more focused on games and on interface simplicity/usability. Could you kindly explain which advantages has a typical WinUae user by "switching" to FS-UAE? Thanks, Massimo |
02 February 2013, 17:55 | #14 |
Registered User
Join Date: Sep 2008
Location: Sesimbra/Portugal
Posts: 1,462
|
Only now have seen this thread. I have to agree that those are the sexiest scanlines i've seen on a virtual Amiga screen. Keep up the good work FS!
|
09 February 2013, 22:02 | #15 |
Amiga-based Cyborg
Join Date: Dec 2004
Location: Canada
Posts: 808
|
That would be great. I can't wait.
|
09 February 2013, 23:55 | #16 |
FS-UAE Developer
Join Date: Dec 2011
Location: Førde, Norway
Age: 43
Posts: 4,043
|
I'm playing around with scripting! I have embedded Lua and consider allowing themes to script certain parts of FS-UAE. It's mostly a fun little project, but may be useful to allow people to do more custom stuff without implementing hundreds of options.
For example, different scanlines in different video modes could (instead of having several configuration options for that) be scripted as something like this: Code:
function on_process_frame() if fs_uae_is_highres_frame() then fs_emu_set_scanline_params(...) else fs_emu_set_scanline_params(...) end end Last edited by FrodeSolheim; 10 February 2013 at 01:24. |
10 February 2013, 09:50 | #17 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,574
|
Use of lua for scripting is something I have been planning to do for year or two. (for example to read and write config values, run script when some variable changes and so on)
btw, detecting if mode is lores or hires can be tricky because it is not rare to have hires scoreboard and lores game area. (Is this lores or hires or both?) btw2, isn't this more or less same as "RGB masks" in WinUAE (which is from MAME originally I think)? I mean adjusting intensity depending on original pixel value. |
10 February 2013, 10:35 | #18 | ||
FS-UAE Developer
Join Date: Dec 2011
Location: Førde, Norway
Age: 43
Posts: 4,043
|
Quote:
So the two parts would be: (1) Lua functions run at certain points in the emulation (hsync, vsync for example). Lua can access the Amiga somehow - read registers, read memory, (2) Lua functions run a certain points in the video thread. This will more FS-UAE-specific. The "detect highres/interlaced" example could look something like this: Code:
function on_finish_frame() bplcon0 = amiga_read_bplcon0() end function on_init_video() lowres_shader = fs_emu_load_shader("scanlines_lowres.shader") highres_shader = fs_emu_load_shader("scanlines_highres.shader") end function on_render_frame() -- checking if HIRES and LACE bits are set if bit32.band(bplcon0, 0x8004) == 0x8004 then fs_emu_set_shader(highres_shader) else fs_emu_set_shader(lowres_shader) end ... end At least the interface-with-Amiga part of the API could in theory be shared between FS-UAE / WinUAE... Quote:
Of course, a more flexible solution would be to build a 1D texture with information about each video line, and let a shader access this information to handle each line according to highres/interlaced information, but I wasn't planning to go all the way with this one Quite possibly, haven't look at it! (Oh, and it's not like I think I've discovered the wheel with the scanlines here -it is trivial solution, I was just happy about the specific end result) Last edited by FrodeSolheim; 10 February 2013 at 10:42. |
||
10 February 2013, 11:04 | #19 | ||||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,574
|
Quote:
Even detecting interlace by using LACE it isn't always reliable if program tries to be tricky. My original plan was to allow script to select when it wants to be called (at vsync or when "x" happens or when any config entry has changed) Quote:
I never really found good enough documentation how to pass variables between lua and c code so does get_config_entry("name of config entry") work for config file access? (+matching setter) Use of function call for each config entry/register looks weird.. Quote:
Quote:
And then there are few programs that mix resolutions horizontally (Disposable Hero title screen is the most "popular"). I think this is only possible in theory |
||||
10 February 2013, 11:39 | #20 |
FS-UAE Developer
Join Date: Dec 2011
Location: Førde, Norway
Age: 43
Posts: 4,043
|
Regarding the interlace discussion: I think we agree on the highres/interlace issue. I am aware of (some of) the problems, not as aware as you of course -thanks for the additional info . But my main point was that since stuff like this does not have a good general solution, it is be better to allow a best-effort implementation via scripting (which might be good enough for specific use cases), because it doesn't make sense to add FS-UAE options for features that cannot work properly in general. This scanline/shader example wasn't the reason I looked into Lua scripting btw, it just happened to be relevant for a request in this thread.
I'm no Lua expert, but there seems to be a way to effectively export variables by reference to Lua: http://lua-users.org/lists/lua-l/2001-03/msg00048.html, but I'm not that keen on that. The other option of pushing globals to Lua by value is not desirable either (unless the values seldom change), so this makes no sense for stuff like memory/registers. I plan to only use functions to pass information between C/Lua, as this at least creates a clean interface without ugly hacks, and it will only incur overhead when the feature is actually used. Of course, for config variables it makes sense to have a general config getter/setter. For stuff like registers, whether it is amiga_read_bplcon0(), amiga_read_register(BPLCON0) or amiga_read_register("BPLCON0") is more of a detail, since code must be used to actually map it to the correct register anyway. I like something along the line of amiga_read_register(BPLCON0), or perhaps generalized a bit further to just read a specific amount of data from a specific memory location (which is desirable to have anyway). I really haven't planned the API, I just made up an example for the above case Lua could also be a nice choice for some other features. I remember someone wanted to read some highscore data out of a game, and a Lua script accessing the memory every frame could be a nice choice for this. The other option was implementing a command pipe which could run commands accessing the memory. A command pipe for communication is still an option, but in this case, the command pipe handler could be implemented in Lua, to avoid creating specific command handlers in C. Or the Lua script could store data in a predetermined file (etc). I say predetermined because I run the Lua scripts in a sandbox so they can't access files. But Lua scripts could be allowed to save data to specific files in a specific location by implementing a custom output routine which goes through UAE (i.e. UAE can save data to a safe location on behalf of the script). Lua is a really nice language to embed btw, much nicer / simpler C API than for example Python! Btw, this is getting really off-topic Last edited by FrodeSolheim; 10 February 2013 at 11:47. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Scanline modifications wanted | Retro-Nerd | support.FS-UAE | 8 | 20 August 2013 20:31 |
Scanline shader problem | TysonJacobs | support.WinUAE | 3 | 26 July 2013 09:43 |
Playing around with RGB/Scanline-Effect | lomaxx | Nostalgia & memories | 13 | 23 July 2009 14:08 |
Scanline option request | Christian | request.UAE Wishlist | 3 | 26 May 2009 22:24 |
REQ : Vistapro (Landscape Renderer) | Djay | request.Apps | 22 | 01 May 2002 22:47 |
|
|