Sepia.h 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. /*------------------------------------------------------------------------------
  2. SEPIA
  3. ------------------------------------------------------------------------------*/
  4. float4 SepiaPass( float4 colorInput )
  5. {
  6. float3 sepia = colorInput.rgb;
  7. // calculating amounts of input, grey and sepia colors to blend and combine
  8. float grey = dot(sepia, float3(0.2126, 0.7152, 0.0722));
  9. sepia *= ColorTone;
  10. float3 blend2 = (grey * GreyPower) + (colorInput.rgb / (GreyPower + 1));
  11. colorInput.rgb = lerp(blend2, sepia, SepiaPower);
  12. // returning the final color
  13. return colorInput;
  14. }
  15. //TODO: do speed comparisons of these on nvidia hardware
  16. /*
  17. float3 blend2 = (grey * GreyPower) + (colorInput.rgb / (GreyPower + 1)); //379fps AMD
  18. float3 blend2 = (GreyPower * (grey * GreyPower + grey) + colorInput.rgb) / (GreyPower + 1); //379fps AMD
  19. float3 blend2 = (grey * GreyPower * (GreyPower+1) + colorInput.rgb) / (GreyPower + 1); //379fps AMD
  20. float3 blend2 = (grey * GreyPower + grey * GreyPower * GreyPower + colorInput.rgb) / (GreyPower + 1); //379fps AMD
  21. */