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

Commit f8e7817

Browse files
committed
Use box filter upsample for Bloom in Uber shader if fast mode is enabled
1 parent 1dc71f3 commit f8e7817

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

PostProcessing/Runtime/Effects/Bloom.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,10 @@ public override void Render(PostProcessRenderContext context)
194194

195195
// Shader properties
196196
var uberSheet = context.uberSheet;
197-
uberSheet.EnableKeyword("BLOOM");
197+
if (settings.fastMode)
198+
uberSheet.EnableKeyword("BLOOM_LOW");
199+
else
200+
uberSheet.EnableKeyword("BLOOM");
198201
uberSheet.properties.SetVector(ShaderIDs.Bloom_DirtTileOffset, dirtTileOffset);
199202
uberSheet.properties.SetVector(ShaderIDs.Bloom_Settings, shaderSettings);
200203
uberSheet.properties.SetColor(ShaderIDs.Bloom_Color, linearColor);

PostProcessing/Shaders/Builtins/Uber.shader

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Shader "Hidden/PostProcessing/Uber"
77
#pragma multi_compile __ UNITY_COLORSPACE_GAMMA
88
#pragma multi_compile __ DISTORT
99
#pragma multi_compile __ CHROMATIC_ABERRATION CHROMATIC_ABERRATION_LOW
10-
#pragma multi_compile __ BLOOM
10+
#pragma multi_compile __ BLOOM BLOOM_LOW
1111
#pragma multi_compile __ COLOR_GRADING_LDR_2D COLOR_GRADING_HDR_2D COLOR_GRADING_HDR_3D
1212
#pragma multi_compile __ VIGNETTE
1313
#pragma multi_compile __ GRAIN
@@ -141,9 +141,13 @@ Shader "Hidden/PostProcessing/Uber"
141141

142142
color.rgb *= autoExposure;
143143

144-
#if BLOOM
144+
#if BLOOM || BLOOM_LOW
145145
{
146+
#if BLOOM
146147
half4 bloom = UpsampleTent(TEXTURE2D_PARAM(_BloomTex, sampler_BloomTex), uvDistorted, _BloomTex_TexelSize.xy, _Bloom_Settings.x);
148+
#else
149+
half4 bloom = UpsampleBox(TEXTURE2D_PARAM(_BloomTex, sampler_BloomTex), uvDistorted, _BloomTex_TexelSize.xy, _Bloom_Settings.x);
150+
#endif
147151

148152
// UVs should be Distort(uv * _Bloom_DirtTileOffset.xy + _Bloom_DirtTileOffset.zw)
149153
// but considering we use a cover-style scale on the dirt texture the difference

0 commit comments

Comments
 (0)