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

Commit 1bb1e30

Browse files
committed
Grain has to be done after user LUT so that it's not color graded
1 parent 8395ed7 commit 1bb1e30

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

PostProcessing/Resources/Shaders/Uber.shader

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -288,19 +288,6 @@ Shader "Hidden/Post FX/Uber Shader"
288288

289289
color = saturate(color);
290290

291-
// Grain
292-
#if GRAIN
293-
{
294-
float3 grain = tex2D(_GrainTex, uv * _Grain_Params2.xy + _Grain_Params2.zw).rgb;
295-
296-
// Noisiness response curve based on scene luminance
297-
float lum = 1.0 - sqrt(AcesLuminance(color));
298-
lum = lerp(1.0, lum, _Grain_Params1.x);
299-
300-
color += color * grain * _Grain_Params1.y * lum;
301-
}
302-
#endif
303-
304291
// Back to gamma space if needed
305292
#if UNITY_COLORSPACE_GAMMA
306293
{
@@ -329,6 +316,19 @@ Shader "Hidden/Post FX/Uber Shader"
329316
}
330317
#endif
331318

319+
// Grain
320+
#if GRAIN
321+
{
322+
float3 grain = tex2D(_GrainTex, uv * _Grain_Params2.xy + _Grain_Params2.zw).rgb;
323+
324+
// Noisiness response curve based on scene luminance
325+
float lum = 1.0 - sqrt(AcesLuminance(color));
326+
lum = lerp(1.0, lum, _Grain_Params1.x);
327+
328+
color += color * grain * _Grain_Params1.y * lum;
329+
}
330+
#endif
331+
332332
// Blue noise dithering
333333
#if DITHERING
334334
{

0 commit comments

Comments
 (0)