Advertisement
Guest User

MPC Curves 2

a guest
Aug 21st, 2013
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. sampler s0 : register(s0);
  2. float4 p0 : register(c0);
  3. float4 p1 : register(c1);
  4.  
  5. #define width (p0[0])
  6. #define height (p0[1])
  7. #define counter (p0[2])
  8. #define clock (p0[3])
  9. #define one_over_width (p1[0])
  10. #define one_over_height (p1[1])
  11. #define PI acos(-1)
  12.  
  13. #define Curves_contrast 1.0
  14. #define Curves_formula 2
  15.  
  16. float4 main(float2 tex : TEXCOORD0) : COLOR {
  17. float4 c0 = tex2D(s0, tex);
  18.  
  19. float3 color = c0.rgb; //original input color
  20. float3 lumCoeff = float3(0.2126, 0.7154, 0.0721); //Values to calculate luma with
  21. float Curves_contrast_blend = Curves_contrast;
  22.  
  23. float redChannel = color.r;
  24. float greenChannel = color.g;
  25. float blueChannel = color.b;
  26.  
  27. // -- Curve 2 --
  28. #if Curves_formula == 2
  29. // Applies Curve to all 3 individual channels
  30. redChannel = ( (redChannel - 0.5) / (0.5 + abs(redChannel-0.5)) ) + 0.5; // 717 amd fps
  31. greenChannel = ( (greenChannel - 0.5) / (0.5 + abs(greenChannel-0.5)) ) + 0.5; // 717 amd fps
  32. blueChannel = ( (blueChannel - 0.5) / (0.5 + abs(blueChannel-0.5)) ) + 0.5; // 717 amd fps
  33. #endif
  34.  
  35. // Blends the original color with the new processed colors
  36. float3 newColor = lerp(color, float3(redChannel, greenChannel, blueChannel), Curves_contrast_blend);
  37.  
  38. //Blend by Curves_contrast
  39. c0.rgb = lerp(c0.rgb, newColor, Curves_contrast_blend);
  40.  
  41. return c0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement