LiftGammaGain.h 762 B

1234567891011121314151617181920212223242526272829
  1. /*-----------------------------------------------------------.
  2. / Lift Gamma Gain /
  3. '-----------------------------------------------------------*/
  4. /*
  5. by 3an and CeeJay.dk
  6. Version 1.1
  7. */
  8. float4 LiftGammaGainPass( float4 colorInput )
  9. {
  10. // -- Get input --
  11. float3 color = colorInput.rgb;
  12. // -- Lift --
  13. //color = color + (RGB_Lift / 2.0 - 0.5) * (1.0 - color);
  14. color = color * (1.5-0.5 * RGB_Lift) + 0.5 * RGB_Lift - 0.5;
  15. color = saturate(color); //isn't strictly necessary, but doesn't cost performance.
  16. // -- Gain --
  17. color *= RGB_Gain;
  18. // -- Gamma --
  19. colorInput.rgb = pow(color, 1.0 / RGB_Gamma); //Gamma
  20. // -- Return output --
  21. //return (colorInput);
  22. return saturate(colorInput);
  23. }