@@ -64,6 +64,9 @@ Shader "Hidden/PostProcessing/Uber"
6464 half2 _Grain_Params1; // x: lum_contrib, y: intensity
6565 float4 _Grain_Params2; // x: xscale, h: yscale, z: xoffset, w: yoffset
6666
67+ // Misc
68+ half _LumaInAlpha;
69+
6770 half4 FragUber (VaryingsDefault i) : SV_Target
6871 {
6972 float2 uv = i.texcoord;
@@ -170,8 +173,8 @@ Shader "Hidden/PostProcessing/Uber"
170173 }
171174 #endif
172175
173- half3 new_color = color * lerp (_Vignette_Color, (1.0 ).xxx, vfactor);
174- color.rgb = lerp (color, new_color, _Vignette_Opacity);
176+ half3 new_color = color.rgb * lerp (_Vignette_Color, (1.0 ).xxx, vfactor);
177+ color.rgb = lerp (color.rgb , new_color, _Vignette_Opacity);
175178 color.a = lerp (1.0 , color.a, vfactor);
176179 }
177180 }
@@ -202,19 +205,21 @@ Shader "Hidden/PostProcessing/Uber"
202205 }
203206 #endif
204207
205- half4 output;
208+ half4 output = color ;
206209
207210 #if FINALPASS
208211 {
209- color.rgb = Dither (color.rgb, i.texcoord);
210- output = color;
212+ output.rgb = Dither (output.rgb, i.texcoord);
211213 }
212214 #else
213215 {
214- // Put saturated luma in alpha for FXAA - higher quality than "green as luma" and
215- // necessary as RGB values will potentially still be HDR for the FXAA pass
216- half luma = Luminance (saturate (color));
217- output = half4 (color.rgb, luma);
216+ if (_LumaInAlpha > 0.5 )
217+ {
218+ // Put saturated luma in alpha for FXAA - higher quality than "green as luma" and
219+ // necessary as RGB values will potentially still be HDR for the FXAA pass
220+ half luma = Luminance (saturate (output));
221+ output.a = luma;
222+ }
218223 }
219224 #endif
220225
0 commit comments