|
|
Hi,
I wrote an application to demonstrate proper generation of scanline effect for LCD-type monitors. You can download the latest version here: https://github.com/srcstorm/lcd_scanlines/releases
How does it work? In CRT displays, pixels of black lines are illuminated by active lines. However, this is true for both lines above and below the black line.
In order to simulate a CRT black line, brightness amounts that are coming from each line must be summed.
Static png masks that are used by MAME are not able to achieve this effect (although I prepared some masks that mimic it). So a new method must be used. Maybe HLSL scripts can do this.
Example with 50% scanline brightness: rgb(200,60,0) ---> pixel of active line above rgb(75,15,15) ---> pixel of black line rgb(100,0,60) ---> pixel of active line below
As you see, each active line provides 25% brightness.
I wrote this application as a proof of concept. I'm presenting the idea. If you want to inspect the source code and adapt it to your needs, you can visit the project page: https://github.com/srcstorm/lcd_scanlines
Edited by vio (11/13/16 11:41 PM)
|
|
|
|
Re: Dynamic Scanlines application
[Re: vio]
#360307 - 11/11/16 01:47 PM
|
|
|
I couldn't attach multiple image files in forum post so I zipped them in the first post. Here are sample outputs:
Original picture (mirage):
2x scaling:
4x scaling:
|
|
|
|
Re: Dynamic Scanlines application
[Re: vio]
#360316 - 11/11/16 07:54 PM
|
|
|
> I couldn't attach multiple image files in forum post so I zipped them in the first > post. Here are sample outputs: > > Original picture (mirage): > > > 2x scaling: > > > 4x scaling:
Looks good!
|
|
|
|
Re: Dynamic Scanlines application
[Re: vio]
#360347 - 11/13/16 02:21 PM
|
|
|
You can get quite the same result by using these scan-line settings for HLSL.
Code:
scanline_alpha 0.75 scanline_size 1.0 scanline_height 1.0 scanline_variation 0.0 scanline_bright_scale 1.0 scanline_bright_offset 0.0 scanline_jitter 0.0 defocus 0.0,1.0
The de-focus on the y-axis merges the colors in a similar way.
|
|
|
|
Re: Dynamic Scanlines application
[Re: Jezze]
#360379 - 11/14/16 01:34 AM
|
|
|
> You can get quite the same result by using these scan-line settings for HLSL. > > scanline_alpha 0.75 > scanline_size 1.0 > scanline_height 1.0 > scanline_variation 0.0 > scanline_bright_scale 1.0 > scanline_bright_offset 0.0 > scanline_jitter 0.0 > defocus 0.0,1.0 > > The de-focus on the y-axis merges the colors in a similar way.
scanline_alpha and scanline_size are not in the UI. I looked at the game ini, and they are there. I have alpha set to 0. In the UI I have scanline amount (which is not in the ini) at .5 , and have beautiful stock scanlines. See the discrepency?
|
Scifi frauds. SF illuminates.
_________________
Culture General Contact Unit (Eccentric)
|
|
|
Re: Dynamic Scanlines application
[Re: Traso]
#360380 - 11/14/16 02:06 AM
|
|
|
The names of settings and the descriptions of sliders are not 1:1 the same. The documentation on mamedev.org can tell you which setting is related to which slider.
|
|
|
|
Re: Dynamic Scanlines application
[Re: Jezze]
#360399 - 11/15/16 06:24 PM
|
|
|
> The names of settings and the descriptions of sliders are not 1:1 the same. The documentation on mamedev.org can tell you which setting is related to which slider.
I gathered that, but the value difference between ui setting of one and ini setting of another isn't explained by it.
|
Scifi frauds. SF illuminates.
_________________
Culture General Contact Unit (Eccentric)
|
|
|
Re: Dynamic Scanlines application
[Re: Traso]
#360404 - 11/15/16 08:22 PM
|
|
|
You know there is a hierarchy of .ini files in which settings of lower .ini files will be overridden by higher ones.
The (incomplete) order is: [driver].ini [system].ini raster.ini mame.ini
What .ini files are involved in your case?
|
|
|
|
Re: Dynamic Scanlines application
[Re: Jezze]
#360410 - 11/16/16 02:22 AM
|
|
|
> You know there is a hierarchy of .ini files in which settings of lower .ini files > will be overridden by higher ones. > > The (incomplete) order is: > [driver].ini > [system].ini > raster.ini > mame.ini > > What .ini files are involved in your case?
I meant the game ini, which should have final say. In any case, I zero'd out the settings and created new inis. Fine now.
|
Scifi frauds. SF illuminates.
_________________
Culture General Contact Unit (Eccentric)
|
|
|
|
New feature: sRGB color space aware processing option has been added. You can switch to this mode in Settings tab.
All images we see on our computers today are encoded in sRGB color space. sRGB is said to have non-linear gamma. This issue is thoroughly explained in this page: http://www.4p8.com/eric.brasseur/gamma.html
sRGB standard was created based on CRT behavior. Gamma function of sRGB is an outcome of electrical characteristics of a CRT pixel. A table from Mr. Brasseur's article is shown below.
A CRT pixel uses no power when showing black color, and max power when showing white. But for any given color in between, the power usage is unpredictable (non-linear).
There is a non-linear scanline brightness phenomena, which was discussed here: http://eab.abime.net/showthread.php?t=63009
I suppose sRGB gamma and non-linear scanlines are related. The brightness of a CRT pixel could be proportional to its power usage.
Through gamma function of sRGB, we can calculate the "real" brightness of each pixel. Hopefully in this mode, non-linear scanline brightness will be simulated in a technically correct way.
To demonstrate this new mode, I added the "Full" preset to settings. In linear mode this preset means %100 scanline brightness. However in sRGB mode the result is like this:
|
|
|
|
|
> You can get quite the same result by using these scan-line settings for HLSL. > > scanline_alpha 0.75 > scanline_size 1.0 > scanline_height 1.0 > scanline_variation 0.0 > scanline_bright_scale 1.0 > scanline_bright_offset 0.0 > scanline_jitter 0.0 > defocus 0.0,1.0 > > The de-focus on the y-axis merges the colors in a similar way.
HLSL stock except for scanline_alpha at .5 . They look the same to me. Or maybe paint messed them both up?
[ATTACHED IMAGE - CLICK FOR FULL SIZE]
|
Scifi frauds. SF illuminates.
_________________
Culture General Contact Unit (Eccentric)
|
|
|
|
[ATTACHED IMAGE - CLICK FOR FULL SIZE]
|
Scifi frauds. SF illuminates.
_________________
Culture General Contact Unit (Eccentric)
|
|
|
Re: Dynamic Scanlines application
[Re: vio]
#361631 - 12/23/16 06:12 AM
|
|
|
I've been always dissatisfied how the native scanline mask looks like so I started digging in the code and I found a solution. The screenshots are from my test build of GroovyMame, but it can be applied to the original mame. Details in the link below
http://forum.arcadecontrols.com/index.php/topic,152660.0.html
|
|
|
|
Re: Dynamic Scanlines application
[Re: Oomek]
#361660 - 12/23/16 09:48 PM
|
|
|
Thanks. I couldn't find the download link for the modded mame, but if it's working as seen on your screenshots, I'm looking forward to get a copy.
|
|
|