SweetFX Shader Suite release and discussion thread #4

Discussion in 'Games, Gaming & Game-demos' started by CeeJay.dk, Sep 30, 2013.

Thread Status:
Not open for further replies.
  1. K-putt

    K-putt Master Guru

    Messages:
    472
    Likes Received:
    0
    GPU:
    GTX 780Ti
    If you think like that then don't use SweetFX. Photographers try to not use filters at all.

    And of course it blurs. That's what Chromatic Aberration does. Kinda... It slightly shifts rgb channels.
     
  2. JPulowski

    JPulowski Active Member

    Messages:
    84
    Likes Received:
    0
    GPU:
    NVIDIA GeForce GTX 690
    I also ported some shaders for MPC-HC use and updated some others.
    Vibrance (Updated):
    Code:
       /*-----------------------------------------------------------.
      /                          Vibrance                           /
      '-----------------------------------------------------------*/
    /*
      by Christian Cann Schuldt Jensen ~ CeeJay.dk
    
      Vibrance intelligently boosts the saturation of pixels
      so pixels that had little color get a larger boost than pixels that had a lot.
    
      This avoids oversaturation of pixels that were already very saturated.
    */
    
    #define Vibrance     0.15  //[-1.00 to 1.00] Intelligently saturates (or desaturates if you use negative values) the pixels depending on their original saturation.
    #define Vibrance_RGB_balance float3(1.00, 1.00, 1.00) //[-10.00 to 10.00,-10.00 to 10.00,-10.00 to 10.00] A per channel multiplier to the Vibrance strength so you can give more boost to certain colors over others
    
    sampler s0 : register(s0);
    
    float4 VibrancePass( float4 colorInput )
    {  
      #define Vibrance_coeff float3(Vibrance_RGB_balance * Vibrance)
    
    	float4 color = colorInput; //original input color
    	float3 lumCoeff = float3(0.212656, 0.715158, 0.072186);  //Values to calculate luma with
    
    	float luma = dot(lumCoeff, color.rgb); //calculate luma (grey)
    
    	float max_color = max(colorInput.r, max(colorInput.g,colorInput.b)); //Find the strongest color
    	float min_color = min(colorInput.r, min(colorInput.g,colorInput.b)); //Find the weakest color
    
      float color_saturation = max_color - min_color; //The difference between the two is the saturation
    
      //color.rgb = lerp(luma, color.rgb, (1.0 + (Vibrance * (1.0 - color_saturation)))); //extrapolate between luma and original by 1 + (1-saturation) - simple
    
      //color.rgb = lerp(luma, color.rgb, (1.0 + (Vibrance * (1.0 - (sign(Vibrance) * color_saturation))))); //extrapolate between luma and original by 1 + (1-saturation) - current
      color.rgb = lerp(luma, color.rgb, (1.0 + (Vibrance_coeff * (1.0 - (sign(Vibrance_coeff) * color_saturation))))); //extrapolate between luma and original by 1 + (1-saturation) - current
    
      //color.rgb = lerp(luma, color.rgb, 1.0 + (1.0-pow(color_saturation, 1.0 - (1.0-Vibrance))) ); //pow version
    
    	return color; //return the result
    	//return color_saturation.xxxx; //Visualize the saturation
    }
    
    float4 main(float2 tex : TEXCOORD0) : COLOR {
    	float4 FinalColor = tex2D(s0, tex);
    	FinalColor = VibrancePass(FinalColor);
    	return FinalColor;
    }
    Explosion:
    Code:
    /*-----------------------------------------------------------.   
      /                         Explosion                           /
      '-----------------------------------------------------------*/
    /* 
    
    */
    
    #define Explosion_Radius    5.0     //[0.2 to 100.0] Amount of effect you want.
    
    sampler s0 : register(s0);
    float4 p0 :  register(c0);
    
    #define screen_size float2(p0[0],p0[1])
    #define px (1.0 / p0[0])
    #define py (1.0 / p0[1])
    #define pixel float2(px,py)
    
    float4 ExplosionPass( float4 colorInput, float2 tex )
    {
    
      // -- pseudo random number generator --
      float2 sine_cosine;
      sincos(dot(tex, float2(12.9898,78.233)),sine_cosine.x,sine_cosine.y);
      sine_cosine = sine_cosine * 43758.5453 + tex;
      float2 noise = frac(sine_cosine);
    
      tex = (-Explosion_Radius * pixel) + tex; //Slightly faster this way because it can be calculated while we calculate noise.
      
      colorInput.rgb = tex2D(s0, (2.0 * Explosion_Radius * pixel) * noise + tex).rgb;
      
     
      return colorInput;
    }
    
    float4 main(float2 tex : TEXCOORD0) : COLOR {
    	float4 FinalColor = tex2D(s0, tex);
    	FinalColor = ExplosionPass(FinalColor,tex);
    	return FinalColor;
    }
    Cartoon:
    Code:
    #define CartoonPower         1.5     //[0.1 to 10.0] Amount of effect you want.
    #define CartoonEdgeSlope     1.5     //[0.1 to 8.0] Raise this to filter out fainter edges. You might need to increase the power to compensate. Whole numbers are faster.
    
    sampler s0 : register(s0);
    float4 p0 :  register(c0);
    
    #define pixel float2((1.0 / p0[0]),(1.0 / p0[1]))
    
    float4 CartoonPass( float4 colorInput, float2 Tex )
    {
      float3 CoefLuma2 = float3(0.2126, 0.7152, 0.0722);  //Values to calculate luma with
      
      float diff1 = dot(CoefLuma2,tex2D(s0, Tex + pixel).rgb);
      diff1 -= dot(CoefLuma2,tex2D(s0, Tex - pixel).rgb);
      
      float diff2 = dot(CoefLuma2,tex2D(s0, Tex +float2(pixel.x,-pixel.y)).rgb);
      diff2 -= dot(CoefLuma2,tex2D(s0, Tex +float2(-pixel.x,pixel.y)).rgb);
        
      float edge = dot(float2(diff1,diff2),float2(diff1,diff2));
      
      colorInput.rgb = colorInput.rgb - edge * CartoonPower;
    	
      return saturate(colorInput);
    }
    
    float4 main(float2 tex : TEXCOORD0) : COLOR {
    	float4 FinalColor = tex2D(s0, tex);
    	FinalColor = CartoonPass(FinalColor,tex);
    	return FinalColor;
    }
    Vignette:
    Code:
    #define VignetteType       1  //[1|2|3] 1 = Original, 2 = New, 3 = TV style
    #define VignetteRatio   1.00  //[0.15 to 6.00]  Sets a width to height ratio. 1.00 (1/1) is perfectly round, while 1.60 (16/10) is 60 % wider than it's high.
    #define VignetteRadius  1.00  //[-1.00 to 3.00] lower values = stronger radial effect from center
    #define VignetteAmount -1.00  //[-2.00 to 1.00] Strength of black. -2.00 = Max Black, 1.00 = Max White.
    #define VignetteSlope      8  //[2 to 16] How far away from the center the change should start to really grow strong (odd numbers cause a larger fps drop than even numbers)
    #define VignetteCenter float2(0.500, 0.500)  //[0.000 to 1.000, 0.000 to 1.000] Center of effect for VignetteType 1. 2 and 3 do not obey this setting.
    
    sampler s0 : register(s0);
    float4 p0 :  register(c0);
    
    #define pixel float2((1.0 / p0[0]),(1.0 / p0[1]))
    
    float4 VignettePass( float4 colorInput, float2 tex )
    {
    
    	#if VignetteType == 1
    		//Set the center
    		float2 tc = tex - VignetteCenter;
    
    		//Adjust the ratio
    		tc *= float2((pixel.y / pixel.x),VignetteRatio);
    
    		//Calculate the distance
    		tc /= VignetteRadius;
    		float v = dot(tc,tc);
    
    		//Apply the vignette
    		colorInput.rgb *= (1.0 + pow(v, VignetteSlope * 0.5) * VignetteAmount); //pow - multiply
    	#endif
    
    	#if VignetteType == 2 // New round (-x*x+x) + (-y*y+y) method.
        
            tex = -tex * tex + tex;
    		colorInput.rgb = saturate(( (pixel.y / pixel.x)*(pixel.y / pixel.x) * VignetteRatio * tex.x + tex.y) * 4.0) * colorInput.rgb;
      #endif
    
    	#if VignetteType == 3 // New (-x*x+x) * (-y*y+y) TV style method.
    
            tex = -tex * tex + tex;
    		colorInput.rgb = saturate(tex.x * tex.y * 100.0) * colorInput.rgb;
    	#endif
    		
    	#if VignetteType == 4
    		tex = abs(tex - 0.5);
    		//tex = abs(0.5 - tex); //same result
    		float tc = dot(float4(-tex.x ,-tex.x ,tex.x , tex.y) , float4(tex.y, tex.y ,1.0 ,1.0 ) ); //XOR
    
    		tc = saturate(tc -0.495);
    		colorInput.rgb *= (pow((1.0 - tc * 200),4)+0.25); //or maybe abs(tc*100-1) (-(tc*100)-1)
      #endif
      
    	#if VignetteType == 5
    		tex = abs(tex - 0.5);
    		//tex = abs(0.5 - tex); //same result
    		float tc = dot(float4(-tex.x ,-tex.x ,tex.x , tex.y) , float4(tex.y, tex.y ,1.0 ,1.0 ) ); //XOR
    
    		tc = saturate(tc -0.495)-0.0002;
    		colorInput.rgb *= (pow((1.0 - tc * 200),4)+0.0); //or maybe abs(tc*100-1) (-(tc*100)-1)
      #endif
    
    	#if VignetteType == 6 //MAD version of 2
    		tex = abs(tex - 0.5);
    		//tex = abs(0.5 - tex); //same result
    		float tc = tex.x * (-2.0 * tex.y + 1.0) + tex.y; //XOR
    
    		tc = saturate(tc -0.495);
    		colorInput.rgb *= (pow((-tc * 200 + 1.0),4)+0.25); //or maybe abs(tc*100-1) (-(tc*100)-1)
    		//colorInput.rgb *= (pow(((tc*200.0)-1.0),4)); //or maybe abs(tc*100-1) (-(tc*100)-1)
      #endif
    
      #if VignetteType == 7 // New round (-x*x+x) * (-y*y+y) method.
        
    	  //tex.y /= float2((pixel.y / pixel.x),VignetteRatio);
        float tex_xy = dot( float4(tex,tex) , float4(-tex,1.0,1.0) ); //dot is actually slower
    		colorInput.rgb = saturate(tex_xy * 4.0) * colorInput.rgb;
    	#endif
    
    	return colorInput;
    }
    
    float4 main(float2 tex : TEXCOORD0) : COLOR {
    	float4 FinalColor = tex2D(s0, tex);
    	FinalColor = VignettePass(FinalColor,tex);
    	return FinalColor;
    }
    SweetCRT (WIP):
    Code:
       /*-----------------------------------------------------------.   
      /                        SweetCRT                            /
      '-----------------------------------------------------------*/
    /*
    SweetCRT - a Work in progress.
    */
    
    #define scanline_strength 0.75
    
    sampler s0 : register(s0);
    float4 p0 :  register(c0);
    
    #define screen_size float2((p0[0]),(p0[1]))
    
    float4 SweetCRTPass( float4 colorInput, float2 tex )
    {
       //
       float scanlines = frac(tex.y * (screen_size.y * 0.5)) - 0.49; //
       scanlines = 1.0 + scanlines * scanline_strength;
       
       colorInput.rgb = saturate(colorInput.rgb * scanlines);
       //colorInput.rgb = saturate(scanlines).xxx;
      
       return colorInput;
    }
    
    float4 main(float2 tex : TEXCOORD0) : COLOR {
    	float4 FinalColor = tex2D(s0, tex);
    	FinalColor = SweetCRTPass(FinalColor,tex);
    	return FinalColor;
    }
    Technicolor:
    Code:
       /*-----------------------------------------------------------.   
      /                        TECHICOLOR                           /
      '-----------------------------------------------------------*/
    // Original by DKT70
    // Optimized by CeeJay.dk
    // - Version 1.1
    
    #define TechniAmount 0.4         //[0.00 to 1.00]
    #define TechniPower  4.0         //[0.00 to 8.00]
    #define redNegativeAmount   0.88 //[0.00 to 1.00]
    #define greenNegativeAmount 0.88 //[0.00 to 1.00]
    #define blueNegativeAmount  0.88 //[0.00 to 1.00]
    
    sampler s0 : register(s0);
    
    #define cyanfilter float3(0.0, 1.30, 1.0)
    #define magentafilter float3(1.0, 0.0, 1.05) 
    #define yellowfilter float3(1.6, 1.6, 0.05)
    
    #define redorangefilter float2(1.05, 0.620) //RG_
    #define greenfilter float2(0.30, 1.0)       //RG_
    #define magentafilter2 magentafilter.rb     //R_B
    
    float4 TechnicolorPass( float4 colorInput )
    {
    	float3 tcol = colorInput.rgb;
    	
      float2 rednegative_mul   = tcol.rg * (1.0 / (redNegativeAmount * TechniPower));
    	float2 greennegative_mul = tcol.rg * (1.0 / (greenNegativeAmount * TechniPower));
    	float2 bluenegative_mul  = tcol.rb * (1.0 / (blueNegativeAmount * TechniPower));
    	
      float rednegative   = dot( redorangefilter, rednegative_mul );
    	float greennegative = dot( greenfilter, greennegative_mul );
    	float bluenegative  = dot( magentafilter2, bluenegative_mul );
    	
    	float3 redoutput   = rednegative.rrr + cyanfilter;
    	float3 greenoutput = greennegative.rrr + magentafilter;
    	float3 blueoutput  = bluenegative.rrr + yellowfilter;
    	
    	float3 result = redoutput * greenoutput * blueoutput;
    	colorInput.rgb = lerp(tcol, result, TechniAmount);
    	return colorInput;
    }
    
    float4 main(float2 tex : TEXCOORD0) : COLOR {
    	float4 FinalColor = tex2D(s0, tex);
    	FinalColor = TechnicolorPass(FinalColor);
    	return FinalColor;
    }
    DPX:
    Code:
    /*
    DPX/Cineon shader by Loadus ( http://www.loadusfx.net/virtualdub/DPX.fx )
    Ported to SweetFX by CeeJay.dk
    
    Version 1.0
    */
    
    #define Red   8.0  //[1.0 to 15.0]
    #define Green 8.0  //[1.0 to 15.0]
    #define Blue  8.0  //[1.0 to 15.0]
    
    #define ColorGamma    2.5  //[0.1 to 2.5] Adjusts the colorfulness of the effect in a manner similar to Vibrance. 1.0 is neutral.
    #define DPXSaturation 3.0  //[0.0 to 8.0] Adjust saturation of the effect. 1.0 is neutral.
    
    #define RedC   0.36  //[0.60 to 0.20]
    #define GreenC 0.36  //[0.60 to 0.20]
    #define BlueC  0.34  //[0.60 to 0.20]
    
    #define Blend 0.2    //[0.00 to 1.00] How strong the effect should be.
    
    sampler s0 : register(s0);
    
    static float3x3 RGB =
    {
    2.67147117265996,-1.26723605786241,-0.410995602172227,
    -1.02510702934664,1.98409116241089,0.0439502493584124,
    0.0610009456429445,-0.223670750812863,1.15902104167061
    };
    
    static float3x3 XYZ =
    {
    0.500303383543316,0.338097573222739,0.164589779545857,
    0.257968894274758,0.676195259144706,0.0658358459823868,
    0.0234517888692628,0.1126992737203,0.866839673124201
    };
    
    float4 DPXPass(float4 InputColor) : COLOR0 {
    
    	float DPXContrast = 0.1;
    
    	float DPXGamma = 1.0;
    
    	float RedCurve = Red;
    	float GreenCurve = Green;
    	float BlueCurve = Blue;
    
    	float3 B = InputColor.rgb;
    	//float3 Bn = B; // I used InputColor.rgb instead.
    
    	B = pow(B, 1.0/DPXGamma);
    
    	B.r = pow(B.r, 1.00);
    	B.g = pow(B.g, 1.00);
    	B.b = pow(B.b, 1.00);
    
            B = (B * (1.0 - DPXContrast)) + DPXContrast / 2.0;
     	
     	B.r = (1.0 /(1.0 + exp(- RedCurve * (B.r - RedC))) - (1.0 / (1.0 + exp(RedCurve / 2.0))))/(1.0 - 2.0 * (1.0 / (1.0 + exp(RedCurve / 2.0))));				
    	B.g = (1.0 /(1.0 + exp(- GreenCurve * (B.g - GreenC))) - (1.0 / (1.0 + exp(GreenCurve / 2.0))))/(1.0 - 2.0 * (1.0 / (1.0 + exp(GreenCurve / 2.0))));				
    	B.b = (1.0 /(1.0 + exp(- BlueCurve * (B.b - BlueC))) - (1.0 / (1.0 + exp(BlueCurve / 2.0))))/(1.0 - 2.0 * (1.0 / (1.0 + exp(BlueCurve / 2.0))));					
    
            //TODO use faster code for conversion between RGB/HSV  -  see http://www.chilliant.com/rgb2hsv.html
    	   float value = max(max(B.r, B.g), B.b);
    	   float3 color = B / value;
    	
    	   color = pow(color, 1.0/ColorGamma);
    	
    	   float3 c0 = color * value;
    
    	   c0 = mul(XYZ, c0);
    
    	   float luma = dot(c0, float3(0.30, 0.59, 0.11)); //Use BT 709 instead?
    	   float3 chroma = c0 - luma;
    
    	   c0 = luma + chroma * DPXSaturation;
    	   c0 = mul(RGB, c0);
    	
    	InputColor.rgb = lerp(InputColor.rgb, c0, Blend); //as long as Blend is always 0 we don't really need to lerp. The compiler *should* be smart enough to optimize this though (check to be sure)
    
    	return InputColor;
    }
    
    float4 main(float2 tex : TEXCOORD0) : COLOR {
    	float4 FinalColor = tex2D(s0, tex);
    	FinalColor = DPXPass(FinalColor);
    	return FinalColor;
    }
    Curves (Updated):
    Code:
       /*-----------------------------------------------------------.
      /                          Curves                             /
      '-----------------------------------------------------------*/
    /*
      by Christian Cann Schuldt Jensen ~ CeeJay.dk
    
      Curves, uses S-curves to increase contrast, without clipping highlights and shadows.
    */
    
    #define Curves_mode        0 //[0|1|2] Choose what to apply contrast to. 0 = Luma, 1 = Chroma, 2 = both Luma and Chroma. Default is 0 (Luma)
    #define Curves_contrast 0.15 //[-1.00 to 1.00] The amount of contrast you want
    
    // -- Advanced curve settings --
    #define Curves_formula     2 //[1|2|3|4|5|6|7|8|9|10] The contrast s-curve you want to use.
                                 //1 = Sine, 2 = Abs split, 3 = Smoothstep, 4 = Exp formula, 5 = Simplified Catmull-Rom (0,0,1,1), 6 = Perlins Smootherstep
                                 //7 = Abs add, 8 = Techicolor Cinestyle, 9 = Parabola, 10 = Half-circles.
                                 //Note that Technicolor Cinestyle is practically identical to Sine, but runs slower. In fact I think the difference might only be due to rounding errors.
                                 //I prefer 2 myself, but 3 is a nice alternative with a little more effect (but harsher on the highlight and shadows) and it's the fastest formula.
    							 
    sampler s0 : register(s0);
    
    float4 CurvesPass( float4 colorInput )
    {
      float3 lumCoeff = float3(0.2126, 0.7152, 0.0722);  //Values to calculate luma with
      float Curves_contrast_blend = Curves_contrast;
      float PI = acos(-1); //3.1415926589
    
       /*-----------------------------------------------------------.
      /               Separation of Luma and Chroma                 /
      '-----------------------------------------------------------*/
    
      // -- Calculate Luma and Chroma if needed --
      #if Curves_mode != 2
    
        //calculate luma (grey)
        float luma = dot(lumCoeff, colorInput.rgb);
    
        //calculate chroma
    	  float3 chroma = colorInput.rgb - luma;
      #endif
    
      // -- Which value to put through the contrast formula? --
      // I name it x because makes it easier to copy-paste to Graphtoy or Wolfram Alpha or another graphing program
      #if Curves_mode == 2
    	  float3 x = colorInput.rgb; //if the curve should be applied to both Luma and Chroma
    	#elif Curves_mode == 1
    	  float3 x = chroma; //if the curve should be applied to Chroma
    	  x = x * 0.5 + 0.5; //adjust range of Chroma from -1 -> 1 to 0 -> 1
      #else // Curves_mode == 0
        float x = luma; //if the curve should be applied to Luma
      #endif
    
       /*-----------------------------------------------------------.
      /                     Contrast formulas                       /
      '-----------------------------------------------------------*/
    
      // -- Curve 1 --
      #if Curves_formula == 1
        x = sin(PI * 0.5 * x); // Sin - 721 amd fps, +vign 536 nv
        x *= x;
        
        //x = 0.5 - 0.5*cos(PI*x);
        //x = 0.5 * -sin(PI * -x + (PI*0.5)) + 0.5;
      #endif
    
      // -- Curve 2 --
      #if Curves_formula == 2
        x = x - 0.5;  
        x = ( x / (0.5 + abs(x)) ) + 0.5;
        
        //x = ( (x - 0.5) / (0.5 + abs(x-0.5)) ) + 0.5;
      #endif
    
      // -- Curve 3 --
      #if Curves_formula == 3
        //x = smoothstep(0.0,1.0,x); //smoothstep
        x = x*x*(3.0-2.0*x); //faster smoothstep alternative - 776 amd fps, +vign 536 nv
        //x = x - 2.0 * (x - 1.0) * x* (x- 0.5);  //2.0 is contrast. Range is 0.0 to 2.0
      #endif
    
      // -- Curve 4 --
      #if Curves_formula == 4
        x = (1.0524 * exp(6.0 * x) - 1.05248) / (20.0855 + exp(6.0 * x)); //exp formula
      #endif
    
      // -- Curve 5 --
      #if Curves_formula == 5
        //x = 0.5 * (x + 3.0 * x * x - 2.0 * x * x * x); //a simplified catmull-rom (0,0,1,1) - btw smoothstep can also be expressed as a simplified catmull-rom using (1,0,1,0)
        //x = (0.5 * x) + (1.5 -x) * x*x; //estrin form - faster version
        x = x * (x * (1.5-x) + 0.5); //horner form - fastest version
    
        Curves_contrast_blend = Curves_contrast * 2.0; //I multiply by two to give it a strength closer to the other curves.
      #endif
    
     	// -- Curve 6 --
      #if Curves_formula == 6
        x = x*x*x*(x*(x*6.0 - 15.0) + 10.0); //Perlins smootherstep
    	#endif
    
    	// -- Curve 7 --
      #if Curves_formula == 7
        //x = ((x-0.5) / ((0.5/(4.0/3.0)) + abs((x-0.5)*1.25))) + 0.5;
    	x = x - 0.5;
    	x = x / ((abs(x)*1.25) + 0.375 ) + 0.5;
    	//x = ( (x-0.5) / ((abs(x-0.5)*1.25) + (0.5/(4.0/3.0))) ) + 0.5;
      #endif
    
      // -- Curve 8 --
      #if Curves_formula == 8
        x = (x * (x * (x * (x * (x * (x * (1.6 * x - 7.2) + 10.8) - 4.2) - 3.6) + 2.7) - 1.8) + 2.7) * x * x; //Techicolor Cinestyle - almost identical to curve 1
      #endif
    
      // -- Curve 9 --
      #if Curves_formula == 9
        x =  -0.5 * (x*2.0-1.0) * (abs(x*2.0-1.0)-2.0) + 0.5; //parabola
      #endif
    
      // -- Curve 10 --
      #if Curves_formula == 10 //Half-circles
    
        #if Curves_mode == 0
          float xstep = step(x,0.5);
    	    float xstep_shift = (xstep - 0.5);
    	    float shifted_x = x + xstep_shift;
        #else
          float3 xstep = step(x,0.5);
    	    float3 xstep_shift = (xstep - 0.5);
    	    float3 shifted_x = x + xstep_shift;
        #endif
    
    	x = abs(xstep - sqrt(-shifted_x * shifted_x + shifted_x) ) - xstep_shift;
    
      //x = abs(step(x,0.5)-sqrt(-(x+step(x,0.5)-0.5)*(x+step(x,0.5)-0.5)+(x+step(x,0.5)-0.5)))-(step(x,0.5)-0.5); //single line version of the above
        
      //x = 0.5 + (sign(x-0.5)) * sqrt(0.25-(x-trunc(x*2))*(x-trunc(x*2))); //worse
      
      /* // if/else - even worse
      if (x-0.5)
      x = 0.5-sqrt(0.25-x*x);
      else
      x = 0.5+sqrt(0.25-(x-1)*(x-1));
    	*/
    
      //x = (abs(step(0.5,x)-clamp( 1-sqrt(1-abs(step(0.5,x)- frac(x*2%1)) * abs(step(0.5,x)- frac(x*2%1))),0 ,1))+ step(0.5,x) )*0.5; //worst so far
    	
    	//TODO: Check if I could use an abs split instead of step. It might be more efficient
    	
    	Curves_contrast_blend = Curves_contrast * 0.5; //I divide by two to give it a strength closer to the other curves.
      #endif
    
      // -- Curve 11 --
      #if Curves_formula == 11 //Cubic catmull
        float a = 1.00; //control point 1
        float b = 0.00; //start point
        float c = 1.00; //endpoint
        float d = 0.20; //control point 2
        x = 0.5 * ((-a + 3*b -3*c + d)*x*x*x + (2*a -5*b + 4*c - d)*x*x + (-a+c)*x + 2*b); //A customizable cubic catmull-rom spline
      #endif
    
      // -- Curve 12 --
      #if Curves_formula == 12 //Cubic Bezier spline
        float a = 0.00; //start point
        float b = 0.00; //control point 1
        float c = 1.00; //control point 2
        float d = 1.00; //endpoint
    
        float r  = (1-x);
    	float r2 = r*r;
    	float r3 = r2 * r;
    	float x2 = x*x;
    	float x3 = x2*x;
    	//x = dot(float4(a,b,c,d),float4(r3,3*r2*x,3*r*x2,x3));
    
    	//x = a * r*r*r + r * (3 * b * r * x + 3 * c * x*x) + d * x*x*x;
    	//x = a*(1-x)*(1-x)*(1-x) +(1-x) * (3*b * (1-x) * x + 3 * c * x*x) + d * x*x*x;
    	x = a*(1-x)*(1-x)*(1-x) + 3*b*(1-x)*(1-x)*x + 3*c*(1-x)*x*x + d*x*x*x;
      #endif
    
      // -- Curve 13 --
      #if Curves_formula == 13 //Cubic Bezier spline - alternative implementation.
        float3 a = float3(0.00,0.00,0.00); //start point
        float3 b = float3(0.25,0.15,0.85); //control point 1
        float3 c = float3(0.75,0.85,0.15); //control point 2
        float3 d = float3(1.00,1.00,1.00); //endpoint
    
        float3 ab = lerp(a,b,x);           // point between a and b
        float3 bc = lerp(b,c,x);           // point between b and c
        float3 cd = lerp(c,d,x);           // point between c and d
        float3 abbc = lerp(ab,bc,x);       // point between ab and bc
        float3 bccd = lerp(bc,cd,x);       // point between bc and cd
        float3 dest = lerp(abbc,bccd,x);   // point on the bezier-curve
        x = dest;
      #endif
    
      // -- Curve 14 --
      #if Curves_formula == 14
        x = 1.0 / (1.0 + exp(-(x * 10.0 - 5.0))); //alternative exp formula
      #endif
    
       /*-----------------------------------------------------------.
      /                 Joining of Luma and Chroma                  /
      '-----------------------------------------------------------*/
    
      #if Curves_mode == 2 //Both Luma and Chroma
    	float3 color = x;  //if the curve should be applied to both Luma and Chroma
    	colorInput.rgb = lerp(colorInput.rgb, color, Curves_contrast_blend); //Blend by Curves_contrast
    
      #elif Curves_mode == 1 //Only Chroma
    	x = x * 2.0 - 1.0; //adjust the Chroma range back to -1 -> 1
    	float3 color = luma + x; //Luma + Chroma
    	colorInput.rgb = lerp(colorInput.rgb, color, Curves_contrast_blend); //Blend by Curves_contrast
    
      #else // Curves_mode == 0 //Only Luma
        x = lerp(luma, x, Curves_contrast_blend); //Blend by Curves_contrast
        colorInput.rgb = x + chroma; //Luma + Chroma
    
      #endif
    
      //Return the result
      return colorInput;
    }
    
      /*
      //Working on a proper catmull-rom spline
      float catmullrom(float t, float p0, float p1, float p2, float p3)
      {
        0.5 * ( (2 * p1) + (-p0 + p2) * x + (2 * p0 - 5 * p1 + 4 * p2 - p3) * t * t + (-p0 + 3 * p1 - 3 * p2 + p3) * x * x * x );
      }
    
      //0.5 *(  (2 * b) + (-a + c) * x + (2*a - 5*b + 4*c - d) * x*x +(-a + 3*b- 3*c + d) * x*x*x)
    
      //y = 1/2 *(x (-a *(x-1)^2+c *(-3 * x^2+4 * x+1)+d * x *(x-1))+b (3 * x^3-5 * x^2+2)) //reduce
      //a * x * (x * (1 - 0.5 * x) - 0.5) + b * ((1.5 * x - 2.5) * x*x + 1) + x * (x * (x * (0.5 * d - 1.5 * c) + 2 * c - 0.5 * d) + 0.5 * c) //horner
    
      */
      
    float4 main(float2 tex : TEXCOORD0) : COLOR {
    	float4 FinalColor = tex2D(s0, tex);
    	FinalColor = CurvesPass(FinalColor);
    	return FinalColor;
    }
    Lift Gamma Gain:
    Code:
       /*-----------------------------------------------------------.   
      /                      Lift Gamma Gain                        /
      '-----------------------------------------------------------*/
    /*
      by 3an and CeeJay.dk
      
      Version 1.1
    */
    
    #define RGB_Lift  float3(1.000, 1.000, 1.000)  //[0.000 to 2.000] Adjust shadows for Red, Green and Blue.
    #define RGB_Gamma float3(1.000, 1.100, 1.000)  //[0.000 to 2.000] Adjust midtones for Red, Green and Blue
    #define RGB_Gain  float3(1.000, 1.000, 1.000)  //[0.000 to 2.000] Adjust highlights for Red, Green and Blue
    
    //Note that a value of 1.000 is a neutral setting that leave the color unchanged.
    
    sampler s0 : register(s0);
    
    float4 LiftGammaGainPass( float4 colorInput )
    {
    	// -- Get input --
    	float3 color = colorInput.rgb;
    	
    	// -- Lift --
    	//color = color + (RGB_Lift / 2.0 - 0.5) * (1.0 - color); 
    	color = color * (1.5-0.5 * RGB_Lift) + 0.5 * RGB_Lift - 0.5;
    	color = saturate(color); //isn't strictly necessary, but doesn't cost performance.
    	
    	// -- Gain --
    	color *= RGB_Gain; 
    	
    	// -- Gamma --
    	colorInput.rgb = pow(color, 1.0 / RGB_Gamma); //Gamma
    	
    	// -- Return output --
    	//return (colorInput);
    	return saturate(colorInput);
    }
    
    float4 main(float2 tex : TEXCOORD0) : COLOR {
    	float4 FinalColor = tex2D(s0, tex);
    	FinalColor = LiftGammaGainPass(FinalColor);
    	return FinalColor;
    }
    Tonemap:
    Code:
    /*------------------------------------------------------------------------------
    						TONEMAP
    ------------------------------------------------------------------------------*/
    // Version 1.1
    
    #define Gamma       1.000  //[0.000 to 2.000] Adjust midtones. 1.000 is neutral. This setting does exactly the same as the one in Lift Gamma Gain, only with less control.
    #define Exposure    0.000  //[-1.000 to 1.000] Adjust exposure
    #define Saturation  0.000  //[-1.000 to 1.000] Adjust saturation
    #define Bleach      0.000  //[0.000 to 1.000] Brightens the shadows and fades the colors
    #define Defog       0.000  //[0.000 to 1.000] How much of the color tint to remove
    #define FogColor float3(0.00, 0.00, 2.55) //[0.00 to 2.55, 0.00 to 2.55, 0.00 to 2.55] What color to remove - default is blue
    
    sampler s0 : register(s0);
    
    float4 TonemapPass( float4 colorInput )
    {
    	float3 color = colorInput.rgb;
    
    	color = saturate(color - Defog * FogColor); // Defog
    	
    	color *= pow(2.0f, Exposure); // Exposure
    	
    	color = pow(color, Gamma);    // Gamma -- roll into the first gamma correction in main.h ?
    
    	//#define BlueShift 0.00	//Blueshift
    	//float4 d = color * float4(1.05f, 0.97f, 1.27f, color.a);
    	//color = lerp(color, d, BlueShift);
    	
    	float3 lumCoeff = float3(0.2126, 0.7152, 0.0722);
    	float lum = dot(lumCoeff, color.rgb);
    	
    	float3 blend = lum.rrr; //dont use float3
    	
    	float L = saturate( 10.0 * (lum - 0.45) );
      	
    	float3 result1 = 2.0f * color.rgb * blend;
    	float3 result2 = 1.0f - 2.0f * (1.0f - blend) * (1.0f - color.rgb);
    	
    	float3 newColor = lerp(result1, result2, L);
    	float A2 = Bleach * color.rgb; //why use a float for A2 here and then multiply by color.rgb (a float3)?
    	//float3 A2 = Bleach * color.rgb; //
    	float3 mixRGB = A2 * newColor;
    	
    	color.rgb += ((1.0f - A2) * mixRGB);
    	
    	//float3 middlegray = float(color.r + color.g + color.b) / 3;
    	float3 middlegray = dot(color,(1.0/3.0)); //1fps slower than the original on nvidia, 2 fps faster on AMD
    	
    	float3 diffcolor = color - middlegray; //float 3 here
    	colorInput.rgb = (color + diffcolor * Saturation)/(1+(diffcolor*Saturation)); //saturation
    	
    	return colorInput;
    }
    
    float4 main(float2 tex : TEXCOORD0) : COLOR {
    	float4 FinalColor = tex2D(s0, tex);
    	FinalColor = TonemapPass(FinalColor);
    	return FinalColor;
    }
    Advanced CRT: (Requires Shader Model 3.)
    Code:
    // CRT shader
    // 
    // 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.
    
    #define CRTAmount            1.00    //[0.00 to 1.00]  Amount of CRT effect you want
    
    #define CRTResolution        2.0     //[1.0 to 8.0]    Input size coefficent (low values gives the "low-res retro look"). Default is 1.2
    #define CRTgamma             2.2     //[0.0 to 4.0]    Gamma of simulated CRT (default 2.2)
    #define CRTmonitorgamma      2.4     //[0.0 to 4.0]    Gamma of display monitor (typically 2.2 is correct)
    #define CRTBrightness        1.2     //[1.0 to 3.0]    Used to boost brightness a little. Default is 1.0
    #define CRTScanlineIntensity 2.0     //[2.0 to 4.0]    Scanlines intensity (use integer values preferably). Default is 2.0
    #define CRTScanlineGaussian  1       //[0 or 1]        Use the "new nongaussian scanlines bloom effect". Default is on
    
    #define CRTCurvature         1       //[[0 or 1]          "Barrel effect" enabled (1) or off (0)
    #define CRTCurvatureRadius   2.0     //[0.0 to 2.0]       Curvature Radius (only effective when Curvature is enabled). Default is 1.5
    #define CRTCornerSize        0.0100  //[0.0000 to 0.0020] Higher values, more rounded corner. Default is 0.001
    #define CRTDistance          2.00    //[0.00 to 4.00]     Simulated distance from viewer to monitor. Default is 2.00
    #define CRTAngleX            0.00    //[-0.20 to 0.20]    Tilt angle in radians (X coordinates)
    #define CRTAngleY           -0.15   //[-0.20 to 0.20]    Tilt angle in radians (Y coordinates). (Value of -0.15 gives the 'arcade tilt' look)
    #define CRTOverScan          1.00    //[1.00 to 1.10]     Overscan (e.g. 1.02 for 2% overscan). Default is 1.01
    #define CRTOversample        0       //[0 or 1]           Enable 3x oversampling of the beam profile (warning : performance hit)
    
    sampler s0 : register(s0);
    float4 p0 :  register(c0);
    
    #define screen_size float2((p0[0]),(p0[1]))
    #define d CRTDistance
    #define R CRTCurvatureRadius
    
    // Comment the next line to disable interpolation in linear gamma (and gain speed).
    //#define LINEAR_PROCESSING
    
    // aspect ratio
    #define aspect float2(1.0, 0.75)
    
    // Precalculate a bunch of useful values we'll need in the fragment
    // shader.
    #define sinangle sin(float2(CRTAngleX, CRTAngleY))
    #define cosangle cos(float2(CRTAngleX, CRTAngleY))
    #define stretch maxscale()
    
    // Macros.
    #define FIX(c) max(abs(c), 1e-5);
    
    float PI = acos(-1); //#define PI 3.141592653589
    
    // The size of one texel, in texture-coordinates.
    #define coone 1.0 / rubyTextureSize
    
    #define mod_factor tex.x * rubyTextureSize.x * rubyOutputSize.x / rubyInputSize.x
    
    #ifdef LINEAR_PROCESSING
    #       define TEX2D(c) pow(tex2D(s0, (c)), CRTgamma)
    #else
    #       define TEX2D(c) tex2D(s0, (c))
    #endif
    
    float intersect(float2 xy)
    {
      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; //all constants
      return (-B - sqrt(B * B -4.0 * A * C)) / (2.0 * A);
    }
    
    
    float2 bkwtrans(float2 xy)
    {
      float c = intersect(xy);
      float2 _point = float2(c, c) * xy;
      _point -= float2(-R, -R) * sinangle;
      _point /= float2(R, 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 = R * acos(a);
      return uv * r / sin(r / R);
    }
    
    float2 fwtrans(float2 uv)
    {
      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 c = bkwtrans(-R * sinangle / (1.0 + R / d * cosangle.x * cosangle.y));
      float2 a = float2(0.5, 0.5) * aspect;
      float2 lo = float2(fwtrans(float2(-a.x, c.y)).x,
    		             fwtrans(float2(c.x,-a.y)).y) / aspect;
      float2 hi = float2(fwtrans(float2(+a.x, c.y)).x,
    		             fwtrans(float2(c.x, +a.y)).y) / aspect;
      return float3((hi + lo) * aspect * 0.5, max(hi.x - lo.x, hi.y - lo.y));
    }
    
    float2 transform(float2 coord, float2 textureSize, float2 inputSize)
    {
      coord *= textureSize / inputSize;
      coord = (coord - 0.5) * aspect * stretch.z + stretch.xy;
      return (bkwtrans(coord) / float2(CRTOverScan, CRTOverScan) / aspect + 0.5) * inputSize / textureSize;
    }
    
    float corner(float2 coord, float2 textureSize, float2 inputSize)
    {
      coord *= textureSize / inputSize;
      coord = (coord - 0.5) * float2(CRTOverScan, CRTOverScan) + 0.5;
      coord = min(coord, 1.0 - coord) * aspect;
      float2 cdist = float2(CRTCornerSize, CRTCornerSize);
      coord = (cdist - min(coord, cdist));
      float dist = sqrt(dot(coord, coord));
      return clamp((cdist.x-dist) * 1000.0, 0.0, 1.0);
    }
    
    // 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.
    #if CRTScanlineGaussian == 0
    	float4 wid = 0.3 + 0.1 * pow(color, 3.0);
    	float4 weights = float4(distance / wid);
    	return 0.4 * exp(-weights * weights) / wid;
    #else
        float4 wid = 2.0 + 2.0 * pow(color, 4.0);
    	float calcdistance = distance / 0.3; // Optimization  ?
        //float4 weights = float4(distance / 0.3, distance / 0.3, distance / 0.3, distance / 0.3);
        float4 weights = float4(calcdistance, calcdistance, calcdistance, calcdistance);
        return 1.4 * exp(-pow(weights * rsqrt(0.5 * wid), wid)) / (0.6 + 0.2 * wid);
    #endif
    }
    
    float4 AdvancedCRTPass( float4 colorInput, float2 tex )
    {
    	// 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.
    
    	float  Input_ratio = ceil(256 * CRTResolution);
    	float2 Resolution = float2(Input_ratio, Input_ratio);
    	float2 rubyTextureSize = Resolution;
    	float2 rubyInputSize = Resolution;
    	float2 rubyOutputSize = screen_size;
    	
    #if CRTCurvature == 1
        float2 xy = transform(tex, rubyTextureSize, rubyInputSize);
    #else
        float2 xy = tex;
    #endif
    	float cval = corner(xy, rubyTextureSize, rubyInputSize);
      	
        // Of all the pixels that are mapped onto the texel we are
        // currently rendering, which pixel are we currently rendering?
        float2 ratio_scale = xy * rubyTextureSize - 0.5;
    	
    #if CRTOversample == 1
    	float filter = fwidth(ratio_scale.y);
    #endif	
    	float2 uv_ratio = frac(ratio_scale);
    
        // Snap to the center of the underlying texel.
        xy = (floor(ratio_scale) + 0.5) / rubyTextureSize;
    
    	// 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, 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(-coone.x, 0.0)),
    			TEX2D(xy),
    			TEX2D(xy + float2(coone.x, 0.0)),
    			TEX2D(xy + float2(2.0 * coone.x, 0.0)))),
    			0.0, 1.0);
    	float4 col2 = clamp(mul(coeffs, float4x4(
    			TEX2D(xy + float2(-coone.x, coone.y)),
    			TEX2D(xy + float2(0.0, coone.y)),
    			TEX2D(xy + coone),
    			TEX2D(xy + float2(2.0 * coone.x, coone.y)))),
    			0.0, 1.0);
    
    #ifndef LINEAR_PROCESSING
        col  = pow(col , CRTgamma);
        col2 = pow(col2, 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);
    	
    #if CRTOversample == 1
        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 * float3(cval, cval, cval);
    
    	// dot-mask emulation:
    	// Output pixels are alternately tinted green and magenta.
    	float3 dotMaskWeights = lerp(float3(1.0, 0.7, 1.0), 
                                     float3(0.7, 1.0, 0.7), 
                                     floor(mod_factor % CRTScanlineIntensity));
    
    	mul_res *= dotMaskWeights * float3(0.83, 0.83, 1.0) * CRTBrightness;
    
    	// Convert the image gamma for display on our output device.
    	mul_res = pow(mul_res, 1.0 / CRTmonitorgamma);
    
    	//return saturate(lerp(colorInput, float4(mul_res, 1.0), CRTAmount));
    	colorInput.rgb = lerp(colorInput.rgb, mul_res, CRTAmount);
    	return saturate(colorInput);
    }
    
    float4 main(float2 tex : TEXCOORD0) : COLOR {
    	float4 FinalColor = tex2D(s0, tex);
    	FinalColor = AdvancedCRTPass(FinalColor,tex);
    	return FinalColor;
    }
    That's all for now. I hope you enjoy it. :)

    Edit: I removed the Levels shader. It already exists in MPC-HC under the name "16-235 -> 0-255 [SD][HD]". Thanks to TCPIP for letting me know.
     
    Last edited: Oct 2, 2013
  3. BetA

    BetA Ancient Guru

    Messages:
    3,950
    Likes Received:
    0
    GPU:
    MSI GTX670 PEOC@1350Mhz


    Nice work mate :)
    Thanks a lot for this. i wanted to port them myself but was to lazy, lol..
     
  4. CeeJay.dk

    CeeJay.dk Master Guru

    Messages:
    686
    Likes Received:
    1
    GPU:
    Radeon 6870
    ! Looking the code over I noticed something.

    I've left in the new and still experimental limiter code for LumaSharpen activated .. and the old one disabled.

    That's not right. Sure the new one works, but does it work better than the old one?
    I don't know yet - that's why it's experimental.

    I'll probably make a quick bugfix release to fix this.

    Any other issues that you want fixed while we are at it?
     

  5. jim2point0

    jim2point0 Maha Guru

    Messages:
    1,324
    Likes Received:
    0
    GPU:
    Asus Strix 1080TI
    Photographers color correct and do photo manipulation all the time. Which is what I see SweetFX doing for games. I'm all for making color adjustments and graphical improvements. I just see chromatic aberration as a flaw rather than an enhancement... and I fear it's becoming a trend in games. Bloody awful looking in Payday 2.
     
  6. JPulowski

    JPulowski Active Member

    Messages:
    84
    Likes Received:
    0
    GPU:
    NVIDIA GeForce GTX 690
    There are already some resize shaders that I mentioned in video pixel shader pack. Can you take a look at them? Or did you try them with video games? If resizing is possible Lanczos and Sinc algorithms could show very nice results I believe.
     
  7. CeeJay.dk

    CeeJay.dk Master Guru

    Messages:
    686
    Likes Received:
    1
    GPU:
    Radeon 6870
    Clipping is when you push some details to full black or full white. When you do this the details disappear because there must be difference to the surrounding pixels for a detail to exist - when everything is full white or full black .. and thus the same color then the details are lost.

    I saturate the output of Lumasharpen, but don't saturate Levels because after Levels comes other color modifing effect and they might pull the details back into the 0 - 1 range between black and white so the details are visible again.

    The details are only really lost once they are clamped away with saturate or they are written to the buffer.
     
  8. K-putt

    K-putt Master Guru

    Messages:
    472
    Likes Received:
    0
    GPU:
    GTX 780Ti
    Some of them, yes. But many try to avoid things like this and do a proper shot in the first place.
    But then again, they probably have presets in their cameras for exatcly that.
    And you're right. Some games look pretty bad with it. But some don't. I think it fits good into Dear Esther.

    It's the same with Bloom. You don't want that in your photo. But you kinda want it in your game screenshots. But not every game.
    Or Lens Flares. I really hate those in many video games. But you find them in every J. J. Abrams movie.

    At least you have the option with sweetfx to enable it, or not.

    And you just can't really compare game screenshots with proper photography.
     
  9. isamu99

    isamu99 Member

    Messages:
    41
    Likes Received:
    0
    Thanks CeeJay, good work my man :)
     
  10. Redemption80

    Redemption80 Ancient Guru

    Messages:
    17,796
    Likes Received:
    1
    GPU:
    GALAX 970/ASUS 970 STRIX
    I always though SweetFX was about having choice to make things look how you wanted in a game if the designers choices weren't to your own taste.

    I gave up looking at most SweetFX shots as too many people turned good looking games into a noise ridden/black crushed mess, but if they were happy with it then not for me to say they shouldn't use those settings.

    I won't be using CA myself, as it looks very much like playing a game with an astigmatism, but i'm a big fan of other "flaws" like lens flare and film grain, so CA seems like a good addition for those who like it.
     

  11. Wanny

    Wanny Ancient Guru

    Messages:
    7,480
    Likes Received:
    0
    GPU:
    GTX 980 Ti GAMING 6G
    There are lots of ways to contrast with SweetFX without crushing.
     
  12. Redemption80

    Redemption80 Ancient Guru

    Messages:
    17,796
    Likes Received:
    1
    GPU:
    GALAX 970/ASUS 970 STRIX
    I know, my point was just that many people clearly prefer that look.
     
  13. K-putt

    K-putt Master Guru

    Messages:
    472
    Likes Received:
    0
    GPU:
    GTX 780Ti
    Maybe because they don't know it better? Who knows.
    Make some good presets and share it with the people and maybe they will use your presets :)
     
  14. CeeJay.dk

    CeeJay.dk Master Guru

    Messages:
    686
    Likes Received:
    1
    GPU:
    Radeon 6870
    I've updated SweetFX to version 1.5.1

    Changes :
    • LumaSharpen in 1.5 still had some experimental code activated when it should not have. Fixed that.
    • Changed some code and settings to workaround a bug in SweetFX Configurator. The configurator should now work fine with SweetFX 1.5.1
    • The Custom shader now have some more interesting example code that inverts the luma of the image, and it now has an example setting.

    Also I have put together an archive with SweetFX configurator with the new SweetFX 1.5.1 files since Terrasque never seems to get around to updating it.
     
  15. Redemption80

    Redemption80 Ancient Guru

    Messages:
    17,796
    Likes Received:
    1
    GPU:
    GALAX 970/ASUS 970 STRIX
    Fantastic, and i was thinking that myself.

    Thanks again for the hard work, it's stuff like this that makes me stick with PC's rather than going the easy route of console.
     

  16. 007.SirBond

    007.SirBond Master Guru

    Messages:
    295
    Likes Received:
    0
    GPU:
    NVIDIA GTX Titan 6GB
  17. TFL Replica

    TFL Replica Master Guru

    Messages:
    381
    Likes Received:
    0
    GPU:
    NVIDIA GTX 970
    Thanks CeeJay. :thumbup:
     
  18. sidspyker

    sidspyker Master Guru

    Messages:
    409
    Likes Received:
    0
    GPU:
    MSI GTX 1080 Gaming X
    Hurray! Thanks CJ.
     
  19. CeeJay.dk

    CeeJay.dk Master Guru

    Messages:
    686
    Likes Received:
    1
    GPU:
    Radeon 6870
    I wrote a small comparison at that that thread, but I'll quickly post the summary here :

    ENB strives to implement the most advanced and impressive effects for a few select games.

    SweetFX strives to be super fast, compatible, and easy to use for as many games as possible.
     
  20. sidspyker

    sidspyker Master Guru

    Messages:
    409
    Likes Received:
    0
    GPU:
    MSI GTX 1080 Gaming X
    Btw CeeJay, you mentioned once before that there was some SMAA performance impact in 1.4 and that 1.5 would possibly have an alternate method not requiring SMAA to be the 'base' when injected.

    So far as you had suggested, I have been using this:
    Should I continue using this?
     
Thread Status:
Not open for further replies.

Share This Page