Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit a26774e

Browse files
committed
Fixed color grading curves applying a slight shift in darks
Still a very tiny shift in the highlights (can be seen using the waveform) but it's far less pronunced that it was in the darks before.
1 parent a89bbb0 commit a26774e

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

PostProcessing/Resources/Shaders/ColorGrading.cginc

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,20 @@ half RotateHue(half value, half low, half hi)
193193
//
194194
half3 YrgbCurve(half3 c, sampler2D curveTex)
195195
{
196+
const float kHalfPixel = (1.0 / 128.0) / 2.0;
197+
196198
// Y
197-
half mr = tex2D(curveTex, half2(c.r, 0.75)).a;
198-
half mg = tex2D(curveTex, half2(c.g, 0.75)).a;
199-
half mb = tex2D(curveTex, half2(c.b, 0.75)).a;
200-
c = saturate(half3(mr, mg, mb));
199+
c += kHalfPixel.xxx;
200+
float mr = tex2D(curveTex, float2(c.r, 0.75)).a;
201+
float mg = tex2D(curveTex, float2(c.g, 0.75)).a;
202+
float mb = tex2D(curveTex, float2(c.b, 0.75)).a;
203+
c = saturate(float3(mr, mg, mb));
201204

202205
// RGB
203-
half r = tex2D(curveTex, half2(c.r, 0.75)).r;
204-
half g = tex2D(curveTex, half2(c.g, 0.75)).g;
205-
half b = tex2D(curveTex, half2(c.b, 0.75)).b;
206+
c += kHalfPixel.xxx;
207+
float r = tex2D(curveTex, float2(c.r, 0.75)).r;
208+
float g = tex2D(curveTex, float2(c.g, 0.75)).g;
209+
float b = tex2D(curveTex, float2(c.b, 0.75)).b;
206210
return saturate(half3(r, g, b));
207211
}
208212

PostProcessing/Resources/Shaders/LutGen.shader

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Shader "Hidden/Post FX/Lut Generator"
8484
#endif
8585

8686
// YRGB curves (done in linear/LDR for now)
87-
color = saturate(YrgbCurve(color, _Curves));
87+
color = YrgbCurve(color, _Curves);
8888

8989
return color;
9090
}

0 commit comments

Comments
 (0)