_AMDG_

color_grade.glsl (For Dolphin Emulator)

Nov 2nd, 2019 (edited)
381
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. // Copyright (c) Andrew Porter. All Rights Reserved.
  3. // License: https://github.com/ServiRegis/Licenses/blob/master/CODEX-CREATIVUS-ET-PUBLICUS.txt
  4. //
  5.  
  6.  
  7. #define LUMA_COEFFICIENT float3(0.2126f, 0.7152f, 0.0722f)
  8.  
  9. void main() {
  10.     float4 screen = Sample();
  11.     screen.a = dot(screen.rgb, LUMA_COEFFICIENT);
  12.     // chroma
  13.     screen.rgb = screen.rgb - screen.a;
  14.     // luma
  15.     screen.a = screen.a - 2.0f;
  16.     screen.a = screen.a * screen.a;
  17.     screen.a = 1.0f / screen.a - 0.25f;
  18.     screen.a = sqrt(screen.a);
  19.     screen.a *= 1.1547005383792515290182975610039f;
  20.        
  21.     screen.rgb = screen.rgb + screen.a;
  22.    
  23.     SetOutput(screen);
  24. }
RAW Paste Data