Skip to content

Commit 30fd49f

Browse files
author
AleMC
committed
graphics corrections
1 parent e4ec912 commit 30fd49f

File tree

5 files changed

+19
-28
lines changed

5 files changed

+19
-28
lines changed

PostProcessing/Runtime/Effects/MotionBlur.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public override void Render(PostProcessRenderContext context)
8181

8282
if (m_ResetHistory)
8383
{
84-
cmd.BlitFullscreenTriangle(context.source, context.destination);
84+
//cmd.BlitFullscreenTriangle(context.source, context.destination);
8585
m_ResetHistory = false;
8686
return;
8787
}
@@ -147,7 +147,7 @@ public override void Render(PostProcessRenderContext context)
147147

148148
// Pass 7 - Reconstruction pass
149149
sheet.properties.SetFloat(ShaderIDs.LoopCount, Mathf.Clamp(settings.sampleCount / 2, 1, 64));
150-
cmd.BlitFullscreenTriangle(context.source, context.destination, sheet, (int)Pass.Reconstruction);
150+
cmd.BlitFullscreenTriangle(BuiltinRenderTextureType.None, context.destination, sheet, (int)Pass.Reconstruction);
151151

152152
cmd.ReleaseTemporaryRT(vbuffer);
153153
cmd.ReleaseTemporaryRT(neighborMax);

PostProcessing/Runtime/PostProcessLayer.cs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public enum Antialiasing
8080
public bool standaloneMotionBlur = false;
8181

8282
[System.NonSerialized]
83-
public RenderTargetIdentifier? customSourceTarget;
83+
public RenderTargetIdentifier? customSourceTarget = null;
8484
[System.NonSerialized]
8585
public CommandBuffer standaloneMotionBlurCmd;
8686

@@ -1239,23 +1239,9 @@ void RenderStandaloneMotionBlur()
12391239
context.command = standaloneMotionBlurCmd;
12401240
var cmd = context.command;
12411241

1242-
context.source = m_Camera.targetTexture;
1243-
int rtId = Shader.PropertyToID("StandaloneMotionBlurRT");
1244-
1245-
RenderTextureDescriptor rtDescriptor;
1246-
if (m_Camera.targetTexture != null)
1247-
rtDescriptor = m_Camera.targetTexture.descriptor;
1248-
else
1249-
rtDescriptor = new RenderTextureDescriptor(Screen.width, Screen.height, RenderTextureFormat.DefaultHDR, 32);
1250-
1251-
context.command.GetTemporaryRT(rtId, rtDescriptor);
1252-
context.destination = rtId;
1242+
context.destination = m_Camera.targetTexture;
12531243

12541244
effect.renderer.Render(context);
1255-
1256-
context.command.Blit(context.destination, m_Camera.targetTexture);
1257-
1258-
context.command.ReleaseTemporaryRT(rtId);
12591245
}
12601246

12611247
int RenderBuiltins(PostProcessRenderContext context, bool isFinalPass, int releaseTargetAfterUse = -1, int eye = -1)

PostProcessing/Shaders/Builtins/Bloom.shader

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Shader "Hidden/PostProcessing/Bloom"
3838
half4 color = DownsampleBox13Tap(TEXTURE2D_PARAM(_MainTex, sampler_MainTex), i.texcoord, UnityStereoAdjustedTexelSize(_MainTex_TexelSize).xy);
3939
#if HUD_BLOOM
4040
half hudColor = SAMPLE_TEXTURE2D(_HUD_RT, sampler_HUD_RT, UnityStereoTransformScreenSpaceTex(i.texcoord)).r;
41-
color = color * (1 + saturate(hudColor * _HudBloomIntensity) * _HudBloomIntensity);
41+
color = color * (1 + hudColor * _HudBloomIntensity);
4242
#endif
4343
return Prefilter(SafeHDR(color), i.texcoord);
4444
}
@@ -48,7 +48,7 @@ Shader "Hidden/PostProcessing/Bloom"
4848
half4 color = DownsampleBox4Tap(TEXTURE2D_PARAM(_MainTex, sampler_MainTex), i.texcoord, UnityStereoAdjustedTexelSize(_MainTex_TexelSize).xy);
4949
#if HUD_BLOOM
5050
half hudColor = SAMPLE_TEXTURE2D(_HUD_RT, sampler_HUD_RT, UnityStereoTransformScreenSpaceTex(i.texcoord)).r;
51-
color = color * (1 + saturate(hudColor * _HudBloomIntensity) * _HudBloomIntensity);
51+
color = color * (1 + hudColor * _HudBloomIntensity);
5252
#endif
5353
return Prefilter(SafeHDR(color), i.texcoord);
5454
}

PostProcessing/Shaders/Builtins/MotionBlur.shader

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ Shader "Hidden/PostProcessing/MotionBlur"
55
#pragma target 3.0
66
#include "../StdLib.hlsl"
77

8+
TEXTURE2D_SAMPLER2D(_StandaloneMotionBlurRT, sampler_StandaloneMotionBlurRT);
9+
float4 _StandaloneMotionBlurRT_TexelSize;
10+
811
TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex);
912
float4 _MainTex_TexelSize;
1013

@@ -169,11 +172,13 @@ Shader "Hidden/PostProcessing/MotionBlur"
169172
return half3((v.xy * 2.0 - 1.0) * _MaxBlurRadius, v.z);
170173
}
171174

175+
//Replaced _MainTex with _StandaloneMotionBlurRT;
176+
172177
// Reconstruction filter
173178
half4 FragReconstruction(VaryingsDefault i) : SV_Target
174179
{
175180
// Color sample at the center point
176-
const half4 c_p = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord);
181+
const half4 c_p = SAMPLE_TEXTURE2D(_StandaloneMotionBlurRT, sampler_StandaloneMotionBlurRT, i.texcoord);
177182

178183
// Velocity/Depth sample at the center point
179184
const half3 vd_p = SampleVelocity(i.texcoord);
@@ -221,11 +226,11 @@ Shader "Hidden/PostProcessing/MotionBlur"
221226
const half l_t = l_v_max * abs(t_s);
222227

223228
// UVs for the sample position
224-
const float2 uv0 = i.texcoord + v_s * t_s * _MainTex_TexelSize.xy;
229+
const float2 uv0 = i.texcoord + v_s * t_s * _StandaloneMotionBlurRT_TexelSize.xy;
225230
const float2 uv1 = i.texcoord + v_s * t_s * _VelocityTex_TexelSize.xy;
226231

227232
// Color sample
228-
const half3 c = SAMPLE_TEXTURE2D_LOD(_MainTex, sampler_MainTex, uv0, 0.0).rgb;
233+
const half3 c = SAMPLE_TEXTURE2D_LOD(_StandaloneMotionBlurRT, sampler_StandaloneMotionBlurRT, uv0, 0.0).rgb;
229234

230235
// Velocity/Depth sample
231236
const half3 vd = SampleVelocity(uv1);

PostProcessing/Shaders/Builtins/Uber.shader

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,6 @@ Shader "Hidden/PostProcessing/Uber"
132132

133133
color.rgb *= autoExposure;
134134

135-
#if HUD_BLOOM
136-
half4 unmodifiedColor = color;
137-
float hudMask = SAMPLE_TEXTURE2D(_HUD_RT, sampler_HUD_RT, UnityStereoTransformScreenSpaceTex(i.texcoord)).r;
138-
#endif
139-
140135
#if BLOOM || BLOOM_LOW
141136
{
142137
#if BLOOM
@@ -159,6 +154,11 @@ Shader "Hidden/PostProcessing/Uber"
159154
}
160155
#endif
161156

157+
#if HUD_BLOOM
158+
half4 unmodifiedColor = color;
159+
float hudMask = SAMPLE_TEXTURE2D(_HUD_RT, sampler_HUD_RT, UnityStereoTransformScreenSpaceTex(i.texcoord)).r;
160+
#endif
161+
162162
#if VIGNETTE
163163
{
164164
UNITY_BRANCH

0 commit comments

Comments
 (0)