Advertisement
Guest User

Untitled

a guest
Jan 7th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. void main()
  2. {
  3.  
  4. float4 color = Sample();
  5.  
  6. float Adaptation = 0.04;
  7. float Gamma = 1.2;
  8. float IntensityContrast = 1.3;
  9. float Saturation = 1.4;
  10. float ToneMappingCurve = 2.0;
  11. float ToneMappingOversaturation = 40.0;
  12.  
  13. float Brightness = 0.3;
  14. float BrightnessCurve = 2.28;
  15. float BrightnessMultiplier = 0.85;
  16. float BrightnessToneMappingCurve = 0.42;
  17.  
  18. color.rgb = pow(color.rgb, vec3(Gamma));
  19.  
  20. color.rgb = color.rgb / vec3(Adaptation);
  21.  
  22. color.rgb *= vec3(Brightness);
  23. color.rgb += vec3(0.000001);
  24. float3 xncol = normalize(color.rgb);
  25. float3 scl = color.rgb/xncol.rgb;
  26.  
  27. scl = pow(scl, vec3(IntensityContrast));
  28.  
  29. xncol = pow(xncol, vec3(Saturation));
  30.  
  31. color.rgb = scl*xncol;
  32.  
  33. float lumamax = ToneMappingOversaturation;
  34. color.rgb = (color.rgb * (1.0 + color.rgb/lumamax))/(color.rgb + ToneMappingCurve);
  35.  
  36. float Y = dot(color.rgb, float3(0.299, 0.587, 0.114)); //0.299 * R + 0.587 * G + 0.114 * B;
  37. float U = dot(color.rgb, float3(-0.14713, -0.28886, 0.436)); //-0.14713 * R - 0.28886 * G + 0.436 * B;
  38. float V = dot(color.rgb, float3(0.615, -0.51499, -0.10001)); //0.615 * R - 0.51499 * G - 0.10001 * B;
  39.  
  40. Y = pow(Y, BrightnessCurve);
  41. Y = Y * BrightnessMultiplier;
  42. Y = Y / (Y + BrightnessToneMappingCurve);
  43. float desaturatefact = clamp(Y * Y * Y * 1.7, 0.0, 1.0);
  44. U = mix(U, 0.0, desaturatefact);
  45. V = mix(V, 0.0, desaturatefact);
  46. color.rgb = V * float3(1.13983, -0.58060, 0.0) + U * float3(0.0, -0.39465, 2.03211) + Y;
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54. SetOutput(color);
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement