MAME HLSL CRT SCANLINE EMULATION PRESETS

The place for all discussion on gaming hardware
wirm
Posts: 9
Joined: Fri Feb 07, 2014 7:59 am

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by wirm »

Well the GT 630 is runny very smooth. 100% on everything so far. Blitz, MK4. Again I just got into mame so I haven't had a chance to run any bench marks yet. $65 USD on amazon will get your Hlsl scanelines working beautifully. Again, I think the big factor is if the card supports shader 3.0 and up.
User avatar
nesrulz
Posts: 182
Joined: Wed Nov 13, 2013 6:01 pm

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by nesrulz »

People, you do not have gfx problems when starting CAVE SH-3 games with HLSL?

http://shmups.system11.org/viewtopic.ph ... 24#p978324

Gfx bugs sometimes occur, although not written this message on startup.

My current solution is: restart the game until you pass without gfx bugs.
Last edited by nesrulz on Fri Feb 14, 2014 10:20 am, edited 2 times in total.
User avatar
blizzz
Posts: 1150
Joined: Fri Sep 16, 2011 6:19 pm
Location: Germany
Contact:

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by blizzz »

wirm wrote:Well the GT 630 is runny very smooth. 100% on everything so far. Blitz, MK4. Again I just got into mame so I haven't had a chance to run any bench marks yet. $65 USD on amazon will get your Hlsl scanelines working beautifully. Again, I think the big factor is if the card supports shader 3.0 and up.
Your integrated graphics chip supports shader model 4.1. Without support for the right shader model it wouldn't start. That doesn't say anything about the speed it runs at.

But nice to hear that it works with the GT630. I'm still interested in some benchmark numbers.
User avatar
blizzz
Posts: 1150
Joined: Fri Sep 16, 2011 6:19 pm
Location: Germany
Contact:

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by blizzz »

I tried to do a small benchmark. Here's what I used:

Mame 0.152 in fullscreen at 1080p, 60Hz
My mame.ini: pastebin

1) mame mslug3 -str 90
This will give you the speed of your current config
2) mame mslug3 -str 90 -nothrottle -nowaitvsync -nosyncrefresh
This will give you the max speed of your current config
3) mame mslug3 -str 90 -nothrottle -nowaitvsync -nosyncrefresh -nohlsl_enable
This will give you the max speed without hlsl


HTPC - Win7 64bit, i3-4130 @ 3.40GHz, 2 x 2GB 1600MHz CL9 RAM, GeForce GTX 650 Ti Boost (1GB GDDR5, chip 1006MHz, memory 1276MHz)
1) 101%
2) 781%
3) 883%

The first result shows that the game runs at full speed with my normal settings (1% speedup to match the refresh rate of my display). The two other tests vary slightly between each run, because the intro chooses the scenes randomly. I've taken the lowest score from 3 runs. I'm not sure if this means that my system is limited by the GPU, or the HLSL implementation just slows down the game a bit in general. But with 8 times the normal speed it doesn't matter.


Work PC - Win 8.1 64bit, i5-3470K @ 3.80GHz, 2 x 4GB 1600MHz CL9 RAM, Intel HD4000 650MHz (Turbo: 1150MHz)
1) 51%
2) PC hardlocks either at the start of the game or when mame closes if syncrefresh is deactivated. Have to hold the power button to restart. The speed seems to be about 150%.

This is strange. The game seems to run at exactly half speed with my normal settings. The fact that it can run at 150% speed shows that the hardware should be fast enough. Could be a driver problem. I don't know if the crashes are caused by the graphics driver or Windows 8, but I've never had a crash on this PC before.


Can't test it on my gaming PC. The PSU is currently in RMA because the fan is squeaking and switching the fan myself would void the warranty :roll:
wirm
Posts: 9
Joined: Fri Feb 07, 2014 7:59 am

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by wirm »

Just use 0 to enable the option in the mame.ini file correct? And F11 to view current framerate while playing or is their another method that is more precise?
User avatar
blizzz
Posts: 1150
Joined: Fri Sep 16, 2011 6:19 pm
Location: Germany
Contact:

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by blizzz »

Just start MAME from the command line like I did. It will show you the speed after MAME closes.
LRa
Posts: 112
Joined: Thu Mar 17, 2005 1:29 pm

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by LRa »

A little off, which Retroarch shader is most crt like?
User avatar
blizzz
Posts: 1150
Joined: Fri Sep 16, 2011 6:19 pm
Location: Germany
Contact:

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by blizzz »

LRa wrote:A little off, which Retroarch shader is most crt like?
Personally I use crt-geom-flat. It's not quite as good as HLSL in MAME, but not too bad.
LRa
Posts: 112
Joined: Thu Mar 17, 2005 1:29 pm

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by LRa »

blizzz wrote:
LRa wrote:A little off, which Retroarch shader is most crt like?
Personally I use crt-geom-flat. It's not quite as good as HLSL in MAME, but not too bad.
It's not bad at all but it has vertical scanlines (look alike).
User avatar
blizzz
Posts: 1150
Joined: Fri Sep 16, 2011 6:19 pm
Location: Germany
Contact:

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by blizzz »

You can comment out line 335 if you don't like that effect.

Code: Select all

  // dot-mask emulation:
  // Output pixels are alternately tinted green and magenta.
  mul_res *= dotMaskWeights;
LRa
Posts: 112
Joined: Thu Mar 17, 2005 1:29 pm

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by LRa »

blizzz wrote:You can comment out line 335 if you don't like that effect.

Code: Select all

  // dot-mask emulation:
  // Output pixels are alternately tinted green and magenta.
  mul_res *= dotMaskWeights;

And can I add "classic" scanlines instead?
User avatar
blizzz
Posts: 1150
Joined: Fri Sep 16, 2011 6:19 pm
Location: Germany
Contact:

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by blizzz »

LRa wrote:And can I add "classic" scanlines instead?
What do you mean with "classic" scanlines?

I've made a mod of the current git version of the crt-geom-flat shader. It has options for prescale, saturation (based on the HSP color model), scanline intensity, halation intensity and the phospor effect. The settings are for normal console games.

It also works well for GBA games with light scanlines (scanline 0.45, halation 0.25) and 0.9 saturation.
LRa
Posts: 112
Joined: Thu Mar 17, 2005 1:29 pm

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by LRa »

blizzz wrote: What do you mean with "classic" scanlines?
.
I meant horizontal scanlines.

Thanks, I'll try that. It is mostly for psx and genesis.
User avatar
Tatsuya79
Posts: 149
Joined: Tue Jan 07, 2014 10:29 am

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by Tatsuya79 »

lettuce wrote:No more black spot, yay!. But that Moire effect is bugging me.....
Better late than never, I think I found it.

In crt-interlaced-halation-pass2.cg near the end, just comment:
//mul_res += pow(tex2D(decal, xy2).rgb, float3(monitorgamma))*0.1;

EDIT: Halation is not working with it disabled, sorry. :(


And here is a compilation of little fixes CGWG was kind to give with some extras:

-no more black screen for Master System and systems under 200p
-tilting/curvature/distance working
-makes use of the entire screen (CRT-Geom had black spaces on top/bottom while curved)
-fixed black dot when curved
-Interlace, Multi-pass, DotMask switchable
-better oversample with slightly less moiré
Spoiler

Code: Select all

     /* COMPATIBILITY
       - HLSL compilers
       - Cg   compilers
    */

    /*
        CRT-interlaced-halation shader - pass2

        Like the CRT-interlaced shader, but adds a subtle glow around bright areas
        of the screen.

        Copyright (C) 2010-2012 cgwg, Themaister and DOLLS

        This program is free software; you can redistribute it and/or modify it
        under the terms of the GNU General Public License as published by the Free
        Software Foundation; either version 2 of the License, or (at your option)
        any later version.

        (cgwg gave their consent to have the original version of this shader
        distributed under the GPL in this message:

            http://board.byuu.org/viewtopic.php?p=26075#p26075

            "Feel free to distribute my shaders under the GPL. After all, the
            barrel distortion code was taken from the Curvature shader, which is
            under the GPL."
        )
    */

            // Comment the next line to disable interpolation in linear gamma (and
            // gain speed).
            #define LINEAR_PROCESSING

            // Enable screen curvature.
            #define CURVATURE

            // Enable 3x oversampling of the beam profile
            //#define OVERSAMPLE

            // Use the older, purely gaussian beam profile
            #define USEGAUSSIAN
          
            // Use interlacing detection; may interfere with other shaders if combined
            #define INTERLACED
			
			// Enable Dot-mask emulation:
            // Output pixels are alternately tinted green and magenta.
			//#define DOTMASK
			
			//Enable if using several shaders. 
			//Disabling it reduces moiré for single pass.
			//#define MULTIPASS
			
            // Macros.
            #define FIX(c) max(abs(c), 1e-5);
            #define PI 3.141592653589

            #ifdef LINEAR_PROCESSING
            #       define TEX2D(c) pow(tex2D(ORIG.texture, (c)), float4(CRTgamma))
            #else
            #       define TEX2D(c) tex2D(ORIG.texture, (c))
            #endif



                    // START of parameters

                    // gamma of simulated CRT
                    static float CRTgamma = 2.4;
                    // gamma of display monitor (typically 2.2 is correct)
                    static float monitorgamma = 2.2;
                    // overscan (e.g. 1.02 for 2% overscan)
                    static float2 overscan = float2(1.0,1.0);
                    // aspect ratio
                    static float2 aspect = float2(1.0, 0.75);
                    // lengths are measured in units of (approximately) the width
                    // of the monitor simulated distance from viewer to monitor
                    static float d = 2.0;
                    // radius of curvature
                    static float R = 2.0;
                    // tilt angle in radians
                    // (behavior might be a bit wrong if both components are
                    // nonzero)
                    const static float2 angle = float2(0.0,-0.15);
                    // size of curved corners
                    static float cornersize = 0.01;
                    // border smoothness parameter
                    // decrease if borders are too aliased
                    static float cornersmooth = 800.0;

                    // END of parameters


            float intersect(float2 xy, float2 sinangle, float2 cosangle)
            {
                    float A = dot(xy,xy)+d*d;
                    float B = 2.0*(R*(dot(xy,sinangle)-d*cosangle.x*cosangle.y)-d*d);
                    float C = d*d + 2.0*R*d*cosangle.x*cosangle.y;
                    return (-B-sqrt(B*B-4.0*A*C))/(2.0*A);
            }

            float2 bkwtrans(float2 xy, float2 sinangle, float2 cosangle)
            {
                    float c = intersect(xy, sinangle, cosangle);
                    float2 point = float2(c)*xy;
                    point -= float2(-R)*sinangle;
                    point /= float2(R);
                    float2 tang = sinangle/cosangle;
                    float2 poc = point/cosangle;
                    float A = dot(tang,tang)+1.0;
                    float B = -2.0*dot(poc,tang);
                    float C = dot(poc,poc)-1.0;
                    float a = (-B+sqrt(B*B-4.0*A*C))/(2.0*A);
                    float2 uv = (point-a*sinangle)/cosangle;
                    float r = FIX(R*acos(a));
                    return uv*r/sin(r/R);
            }

            float2 fwtrans(float2 uv, float2 sinangle, float2 cosangle)
            {
                    float r = FIX(sqrt(dot(uv,uv)));
                    uv *= sin(r/R)/r;
                    float x = 1.0-cos(r/R);
                    float D = d/R + x*cosangle.x*cosangle.y+dot(uv,sinangle);
                    return d*(uv*cosangle-x*sinangle)/D;
            }

            float3 maxscale(float2 sinangle, float2 cosangle)
            {
                    float2 c = bkwtrans(-R * sinangle / (1.0 + R/d*cosangle.x*cosangle.y), sinangle, cosangle);
                    float2 a = float2(0.5,0.5)*aspect;
                    float2 lo = float2(fwtrans(float2(-a.x,c.y), sinangle, cosangle).x,
                                 fwtrans(float2(c.x,-a.y), sinangle, cosangle).y)/aspect;
                    float2 hi = float2(fwtrans(float2(+a.x,c.y), sinangle, cosangle).x,
                                 fwtrans(float2(c.x,+a.y), sinangle, cosangle).y)/aspect;
                    return float3((hi+lo)*aspect*0.5,max(hi.x-lo.x,hi.y-lo.y));
            }

            // Calculate the influence of a scanline on the current pixel.
            //
            // 'distance' is the distance in texture coordinates from the current
            // pixel to the scanline in question.
            // 'color' is the colour of the scanline at the horizontal location of
            // the current pixel.
            float4 scanlineWeights(float distance, float4 color)
            {
                    // "wid" controls the width of the scanline beam, for each RGB
                    // channel The "weights" lines basically specify the formula
                    // that gives you the profile of the beam, i.e. the intensity as
                    // a function of distance from the vertical center of the
                    // scanline. In this case, it is gaussian if width=2, and
                    // becomes nongaussian for larger widths. Ideally this should
                    // be normalized so that the integral across the beam is
                    // independent of its width. That is, for a narrower beam
                    // "weights" should have a higher peak at the center of the
                    // scanline than for a wider beam.
            #ifdef USEGAUSSIAN
                    float4 wid = 0.3 + 0.1 * pow(color, float4(3.0));
                    float4 weights = float4(distance / wid);
                    return 0.4 * exp(-weights * weights) / wid;
            #else
                    float4 wid = 2.0 + 2.0 * pow(color, float4(4.0));
                    float4 weights = float4(distance / 0.3);
                    return 1.4 * exp(-pow(weights * rsqrt(0.5 * wid), wid)) / (0.6 + 0.2 * wid);
            #endif
            }

    struct orig
    {
        float2 tex_coord;
        uniform float2 video_size;
        uniform float2 texture_size;
        uniform float2 output_size;
        uniform sampler2D texture;
    };


    struct input
    {
        float2 video_size;
        float2 texture_size;
        float2 output_size;
        float frame_count;
        float frame_direction;
        float frame_rotation;
    };


    struct out_vertex {
        float4 position : POSITION;
        float4 color : COLOR;
        float2 texCoord : TEXCOORD0;
            float2 one;
            float mod_factor;
            float2 ilfac;
            float3 stretch;
            float2 sinangle;
            float2 cosangle;
    };



    /* VERTEX_SHADER */
    out_vertex main_vertex
    (
        float4 position : POSITION,
        float4 color : COLOR,
        float2 texCoord : TEXCOORD0,

        uniform float4x4 modelViewProj,
        orig ORIG,
        uniform input IN
    )
    {

        out_vertex OUT;

        OUT.position = mul(modelViewProj, position);
        OUT.color = color;


                    // Precalculate a bunch of useful values we'll need in the fragment
                    // shader.
                    OUT.sinangle = sin(angle);
                    OUT.cosangle = cos(angle);
                    OUT.stretch = maxscale(OUT.sinangle, OUT.cosangle);
        OUT.texCoord = texCoord;


                    OUT.ilfac = float2(1.0,clamp(floor(IN.video_size.y/200.0),1.0,2.0));

                    // The size of one texel, in texture-coordinates.
                    OUT.one = OUT.ilfac / ORIG.texture_size;

                    // Resulting X pixel-coordinate of the pixel we're drawing.
                    OUT.mod_factor = texCoord.x * ORIG.texture_size.x * IN.output_size.x / ORIG.video_size.x;

        return OUT;
    }

	
    /* FRAGMENT SHADER */
    float4 main_fragment(in out_vertex VAR, uniform sampler2D decal : TEXUNIT0, orig ORIG, uniform input IN) : COLOR
    {

    /*        float2 transform(float2 coord)
            {
                    coord *= ORIG.texture_size / ORIG.video_size;
                    coord = (coord-float2(0.5))*aspect*stretch.z+stretch.xy;
                    return (bkwtrans(coord)/overscan/aspect+float2(0.5)) * ORIG.video_size / ORIG.texture_size;
            }

            float corner(float2 coord)
            {
                    coord *= ORIG.texture_size / ORIG.video_size;
                    coord = (coord - float2(0.5)) * overscan + float2(0.5);
                    coord = min(coord, float2(1.0)-coord) * aspect;
                    float2 cdist = float2(cornersize);
                    coord = (cdist - min(coord,cdist));
                    float dist = sqrt(dot(coord,coord));
                    return clamp((cdist.x-dist)*cornersmooth,0.0, 1.0);
            }
    */

                    // Here's a helpful diagram to keep in mind while trying to
                    // understand the code:
                    //
                    //  |      |      |      |      |
                    // -------------------------------
                    //  |      |      |      |      |
                    //  |  01  |  11  |  21  |  31  | <-- current scanline
                    //  |      | @    |      |      |
                    // -------------------------------
                    //  |      |      |      |      |
                    //  |  02  |  12  |  22  |  32  | <-- next scanline
                    //  |      |      |      |      |
                    // -------------------------------
                    //  |      |      |      |      |
                    //
                    // Each character-cell represents a pixel on the output
                    // surface, "@" represents the current pixel (always somewhere
                    // in the bottom half of the current scan-line, or the top-half
                    // of the next scanline). The grid of lines represents the
                    // edges of the texels of the underlying texture.

                    // Texture coordinates of the texel containing the active pixel.
            #ifdef CURVATURE
                    float2 cd = VAR.texCoord;
                    cd *= ORIG.texture_size / ORIG.video_size;
                    cd = (cd-float2(0.5))*aspect*VAR.stretch.z+VAR.stretch.xy;
                    float2 xy =  (bkwtrans(cd, VAR.sinangle, VAR.cosangle)/overscan/aspect+float2(0.5)) * ORIG.video_size / ORIG.texture_size;

            #else
                    float2 xy = VAR.texCoord;
            #endif
                    float2 cd2 = xy;
                    cd2 *= ORIG.texture_size / ORIG.video_size;
                    cd2 = (cd2 - float2(0.5)) * overscan + float2(0.5);
                    cd2 = min(cd2, float2(1.0)-cd2) * aspect;
                    float2 cdist = float2(cornersize);
                    cd2 = (cdist - min(cd2,cdist));
                    float dist = sqrt(dot(cd2,cd2));
                    float cval = clamp((cdist.x-dist)*cornersmooth,0.0, 1.0);

                    float2 xy2 = ((xy*ORIG.texture_size/ORIG.video_size-float2(0.5))*float2(1.0,1.0)+float2(0.5))*IN.video_size/IN.texture_size;
                    // Of all the pixels that are mapped onto the texel we are
                    // currently rendering, which pixel are we currently rendering?
                    float2 ilfloat = float2(0.0,VAR.ilfac.y > 1.5 ? fmod(float(IN.frame_count),2.0) : 0.0);
          #ifdef INTERLACED
                    float2 ratio_scale = (xy * IN.texture_size - float2(0.5) + ilfloat)/VAR.ilfac;
          #else
                float2 ratio_scale = xy * IN.texture_size - float2(0.5);
          #endif
          
            #ifdef OVERSAMPLE
                    //float filter = fwidth(ratio_scale.y);
                    float filter = IN.video_size.y / IN.output_size.y;
            #endif
                    float2 uv_ratio = frac(ratio_scale);

                    // Snap to the center of the underlying texel.
          #ifdef INTERLACED
                    xy = (floor(ratio_scale)*VAR.ilfac + float2(0.5) - ilfloat) / IN.texture_size;
          #else
                xy = (floor(ratio_scale) + float2(0.5)) / IN.texture_size;
          #endif

                    // Calculate Lanczos scaling coefficients describing the effect
                    // of various neighbour texels in a scanline on the current
                    // pixel.
                    float4 coeffs = PI * float4(1.0 + uv_ratio.x, uv_ratio.x, 1.0 - uv_ratio.x, 2.0 - uv_ratio.x);

                    // Prevent division by zero.
                    coeffs = FIX(coeffs);

                    // Lanczos2 kernel.
                    coeffs = 2.0 * sin(coeffs) * sin(coeffs / 2.0) / (coeffs * coeffs);

                    // Normalize.
                    coeffs /= dot(coeffs, float4(1.0));

                    // Calculate the effective colour of the current and next
                    // scanlines at the horizontal location of the current pixel,
                    // using the Lanczos coefficients above.
					float4 col  = clamp(mul(coeffs, float4x4(
                        TEX2D(xy + float2(-VAR.one.x, 0.0)),
                        TEX2D(xy),
                        TEX2D(xy + float2(VAR.one.x, 0.0)),
                        TEX2D(xy + float2(2.0 * VAR.one.x, 0.0)))),
						0.0, 1.0);
					float4 col2 = clamp(mul(coeffs, float4x4(
                        TEX2D(xy + float2(-VAR.one.x, VAR.one.y)),
                        TEX2D(xy + float2(0.0, VAR.one.y)),
                        TEX2D(xy + VAR.one),
                        TEX2D(xy + float2(2.0 * VAR.one.x, VAR.one.y)))),
						0.0, 1.0);


            #ifndef LINEAR_PROCESSING
                    col  = pow(col , float4(CRTgamma));
                    col2 = pow(col2, float4(CRTgamma));
            #endif

                    // Calculate the influence of the current and next scanlines on
                    // the current pixel.
                    float4 weights  = scanlineWeights(uv_ratio.y, col);
                    float4 weights2 = scanlineWeights(1.0 - uv_ratio.y, col2);
            #ifdef OVERSAMPLE
                    uv_ratio.y =uv_ratio.y+1.0/3.0*filter;
                    weights = (weights+scanlineWeights(uv_ratio.y, col))/3.0;
                    weights2=(weights2+scanlineWeights(abs(1.0-uv_ratio.y), col2))/3.0;
                    uv_ratio.y =uv_ratio.y-2.0/3.0*filter;
                    weights=weights+scanlineWeights(abs(uv_ratio.y), col)/3.0;
                    weights2=weights2+scanlineWeights(abs(1.0-uv_ratio.y), col2)/3.0;
            #endif
                    float3 mul_res  = (col * weights + col2 * weights2).rgb;
			#ifdef MULTIPASS
					mul_res += pow(tex2D(decal, xy2).rgb, float3(monitorgamma))*0.1;
			#endif
					mul_res *= float3(cval);

                    // dot-mask emulation:
                    // Output pixels are alternately tinted green and magenta.
			#ifdef DOTMASK
                    float3 dotMaskWeights = lerp(
                            float3(1.0, 0.7, 1.0),
                            float3(0.7, 1.0, 0.7),
                            floor(fmod(VAR.mod_factor, 2.0))
                        );
            #else
                    float3 dotMaskWeights = lerp(
                            float3(1.0, 1.0, 1.0),
                            float3(1.0, 1.0, 1.0),
                            floor(fmod(VAR.mod_factor, 2.0))
                        );
            #endif
                    

                    mul_res *= dotMaskWeights;

                    // Convert the image gamma for display on our output device.
                    mul_res = pow(mul_res, float3(1.0 / monitorgamma));

                    // Color the texel.
                    return float4(mul_res, 1.0);
    }

edit: The moiré wasn't on purpose in fact and it's just the multi-pass doing it from what I believe (but I don't understand the code that much to tell for sure).
I renamed the code accordingly.
Last edited by Tatsuya79 on Tue Feb 18, 2014 2:53 pm, edited 3 times in total.
User avatar
blizzz
Posts: 1150
Joined: Fri Sep 16, 2011 6:19 pm
Location: Germany
Contact:

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by blizzz »

If you want to see how CRT filters are not meant to be, just check out the screenshot section of the offficial Metal Slug 3 release on Steam: http://steamcommunity.com/app/250180/sc ... crollTop=0

It's hard to believe that they charge money for that.
wirm
Posts: 9
Joined: Fri Feb 07, 2014 7:59 am

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by wirm »

GTX 630 on Metal Gear X no throttle with Hlsl enabled runs at 175%
User avatar
Fudoh
Posts: 13015
Joined: Mon Mar 06, 2006 3:29 am
Location: Germany
Contact:

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by Fudoh »

Last night I watched Rocky 1 on Blu-Ray. You know what they did ? They added THICK FAT scanlines to the old black & white CRT hanging in the bar where Rocky watches an interview with Apollo. Something is seriously wrong with people. And seeing those misguided programmers butchering MS3 on steam just reminded me of that...
User avatar
blizzz
Posts: 1150
Joined: Fri Sep 16, 2011 6:19 pm
Location: Germany
Contact:

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by blizzz »

wirm wrote:GTX 630 on Metal Gear X no throttle with Hlsl enabled runs at 175%
Thanks for checking! :)
175% sounds like a good enough performance.
fagin
Posts: 1654
Joined: Fri Mar 19, 2010 2:29 pm
Location: UK

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by fagin »

Fudoh wrote:Last night I watched Rocky 1 on Blu-Ray. You know what they did ? They added THICK FAT scanlines to the old black & white CRT hanging in the bar where Rocky watches an interview with Apollo. Something is seriously wrong with people. And seeing those misguided programmers butchering MS3 on steam just reminded me of that...
Is that a problem...... I mean the hammering that both fighters took in the ring would of killed anyone in REAL life, so at least the scanline reproduction effect was in the same ballpark, in regards to being unbelievable! :mrgreen:
User avatar
u-man
Posts: 18
Joined: Mon Feb 24, 2014 7:17 pm

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by u-man »

Hello Folks,

first to say, I am a noob or beginner when it comes to shaders, but i am very happy that i found this Retroarch-thingy through this forum. I like the CRT-Shader from Retroarch a lot, but wanted to ask here, how I can have a shader like this in the following link: http://filthypants.blogspot.de/2011/05/ ... dated.html

I am interested in the Beam 4 Shader. I would like to have that working with my Retroarch. So can anybode help me to get the Bezel-Window from the "normal" CRT-Shader, but with the look of Beam 4 Shader?

Please help me with this, even if it is of no help for this thread. Hope it is not to hard, to build me such a shader.

Many thanx in advance... this thread is awesome... thumbs up for it.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music."
Spottedfeather
Posts: 3
Joined: Sat Mar 08, 2014 10:18 pm

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by Spottedfeather »

I can't figure out how to get MAME to emulate a CRT monitor. I read the instructions in the first page of this topic, but it mention putting them in the HLSL section of the mame.ini file. There is no HLSL section of the MAME.ini file.
User avatar
Overkill
Posts: 512
Joined: Mon Aug 22, 2011 6:11 pm
Location: Portugal

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by Overkill »

Use Nueda instructions on page 13 http://shmups.system11.org/viewtopic.ph ... &start=330 , grab mame 0.152 and use is .bat file
Scarhelm
Posts: 8
Joined: Mon Apr 15, 2013 3:53 am

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by Scarhelm »

I made a couple small tweaks to the retroarch halation filter, removed the tilt and hopefully made the screen curve look abit more realistic. looks preety good with dotmask and allitle more blurr, just allitle test i thought id share

https://dl.dropboxusercontent.com/u/112 ... -tweak.rar

screenshots

https://dl.dropboxusercontent.com/u/112 ... -03-04.png

https://dl.dropboxusercontent.com/u/112 ... -24-32.png
Last edited by Scarhelm on Tue Mar 25, 2014 6:06 pm, edited 3 times in total.
User avatar
Fudoh
Posts: 13015
Joined: Mon Mar 06, 2006 3:29 am
Location: Germany
Contact:

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by Fudoh »

@Scarhelm (and anybody else posting configurations): to make the thread more enjoyable for all the readers and without the need to fire up the emulation right away, please post screenshots along with your config suggestions! Thanks!
maou42
Posts: 1
Joined: Tue Mar 25, 2014 6:46 pm

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by maou42 »

Hi there

Very informative thread...

I have been playing with my settings but would like to ask a few questions:

What is the relationship between shadow_mask_x_count (and y), shadow_mask_usize (and v), game resolution and physical resolution?

I am mainly playing 320x224 games on a 1600x900 LCD.
I am using crt_shadow_mask.png
I read somewhere that this png represents "2 pixels" and that the shadow_mask _x_count should be 160 (320/2). Same goes with y.
Also, shadow_mask_usize should be 0.375 (also v)
Finally, should bilinear filtering be used with HLSL? Is defocus not doing the job already? How important is it that HW stretching be on?

I do not understand how to get to these results. I would like the best settings for my resolution.
is crt_shadow_mask.png the most authentic png for neo geo games?

Many thanks to whoever can help...

PS: Have you seen the post saying that Post.fx should have the linear values switched to NONE for clarity? It is all very confusing...
LRa
Posts: 112
Joined: Thu Mar 17, 2005 1:29 pm

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by LRa »

Scarhelm wrote:I made a couple small tweaks to the retroarch halation filter, removed the tilt and hopefully made the screen curve look abit more realistic. looks preety good with dotmask and allitle more blurr, just allitle test i thought id share

https://dl.dropboxusercontent.com/u/112 ... -tweak.rar

screenshots

https://dl.dropboxusercontent.com/u/112 ... -03-04.png

https://dl.dropboxusercontent.com/u/112 ... -24-32.png

Looking awesome!
User avatar
Pasky
Posts: 698
Joined: Mon Oct 21, 2013 3:58 am

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by Pasky »

I'm having issues using this, I'm not getting the results seen in screen shots here using these settings:

Code: Select all

#
# DIRECT3D POST-PROCESSING OPTIONS
#
hlsl_enable 1
hlslpath hlsl
hlsl_ini_read 0
hlsl_ini_write 0
hlslini %g
hlsl_prescale_x 0
hlsl_prescale_y 0
hlsl_preset -1
hlsl_write
hlsl_snap_width 1920
hlsl_snap_height 1080
shadow_mask_alpha 0.15
shadow_mask_texture aperture.png
shadow_mask_x_count 1280
shadow_mask_y_count 720
shadow_mask_usize 0.09375
shadow_mask_vsize 0.09375
curvature 0.0
pincushion 0.06
scanline_alpha 1.00
scanline_size 1.00
scanline_height 0.7
scanline_bright_scale 1.5
scanline_bright_offset 0.60
scanline_jitter 0.05
defocus 0.8,0.8
converge_x 0.0,0.0,0.0
converge_y 0.0,0.0,0.0
radial_converge_x 0.0,0.0,0.0
radial_converge_y 0.0,0.0,0.0
red_ratio 1.0,0.0,0.0
grn_ratio 0.0,1.0,0.0
blu_ratio 0.0,0.0,1.0
saturation 1.3
offset 0.0,0.0,0.0
scale 1.0,1.0,1.0
power 1.0,1.0,1.0
floor 0.03,0.03,0.03
phosphor_life 0.0,0.0,0.0
yiq_enable 0
yiq_cc 3.59754545
yiq_a 0.5
yiq_b 0.5
yiq_o 0.0
yiq_p 1.0
yiq_n 1.0
yiq_y 3.0
yiq_i 1.2
yiq_q 0.6
yiq_scan_time 52.6
yiq_phase_count 2
I'm getting a really bad (bloom?) brightness. It's really bad overexposure. Not sure why. I created a default mame.ini using mame -cc. Then just replaced the D3D post processing with the above and get this:

Image

Image

Any idea how to lower the brightness?
Bullet762
Posts: 1
Joined: Sun Apr 13, 2014 5:18 am

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by Bullet762 »

Pasky wrote:I'm having issues using this, I'm not getting the results seen in screen shots here using these settings:
****
Any idea how to lower the brightness?

Change this setting

vector_bloom_scale 0.090
raster_bloom_scale 0.090
User avatar
Pasky
Posts: 698
Joined: Mon Oct 21, 2013 3:58 am

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by Pasky »

Thanks, what about reducing the moire effect?
Scarhelm
Posts: 8
Joined: Mon Apr 15, 2013 3:53 am

Re: MAME HLSL CRT SCANLINE EMULATION PRESETS

Post by Scarhelm »

the best way you can reduce moire is turn down scanline_bright_scale 1.5 to 1.0

turn up hlsl_prescale_x 0 hlsl_prescale_y to maybe 3-7 if your system can take it

can try reducing shadow_mask_alpha 5-10, might give less moire.
Post Reply