Browse Source

Removed duplicate camera jitter application, fixing the jitter issue from before.

Also cleaned up an unused render texture.
stable
Nico de Poel 3 years ago
parent
commit
77c4cd4954
  1. 15
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/SuperResolution.cs

15
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/SuperResolution.cs

@ -80,8 +80,6 @@ namespace UnityEngine.Rendering.PostProcessing
private readonly Fsr2.DispatchDescription _dispatchDescription = new Fsr2.DispatchDescription(); private readonly Fsr2.DispatchDescription _dispatchDescription = new Fsr2.DispatchDescription();
private readonly Fsr2.GenerateReactiveDescription _genReactiveDescription = new Fsr2.GenerateReactiveDescription(); private readonly Fsr2.GenerateReactiveDescription _genReactiveDescription = new Fsr2.GenerateReactiveDescription();
private RenderTexture _upscaledOutput;
private Fsr2.QualityMode _prevQualityMode; private Fsr2.QualityMode _prevQualityMode;
private Vector2Int _prevDisplaySize; private Vector2Int _prevDisplaySize;
@ -126,9 +124,7 @@ namespace UnityEngine.Rendering.PostProcessing
_prevQualityMode = qualityMode; _prevQualityMode = qualityMode;
} }
// Effects rendering happens in OnPreCull, so this is the right place to apply camera jittering
ApplyJitter(context.camera);
// TODO: these input resources should come from context.source
cmd.SetGlobalTexture(Fsr2ShaderIDs.SrvInputColor, BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Color); cmd.SetGlobalTexture(Fsr2ShaderIDs.SrvInputColor, BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Color);
cmd.SetGlobalTexture(Fsr2ShaderIDs.SrvInputDepth, BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Depth); cmd.SetGlobalTexture(Fsr2ShaderIDs.SrvInputDepth, BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Depth);
cmd.SetGlobalTexture(Fsr2ShaderIDs.SrvInputMotionVectors, BuiltinRenderTextureType.MotionVectors); cmd.SetGlobalTexture(Fsr2ShaderIDs.SrvInputMotionVectors, BuiltinRenderTextureType.MotionVectors);
@ -170,9 +166,6 @@ namespace UnityEngine.Rendering.PostProcessing
// Apply a mipmap bias so that textures retain their sharpness // Apply a mipmap bias so that textures retain their sharpness
float biasOffset = Fsr2.GetMipmapBiasOffset(_renderSize.x, _displaySize.x); float biasOffset = Fsr2.GetMipmapBiasOffset(_renderSize.x, _displaySize.x);
//Fsr2.GlobalCallbacks.ApplyMipmapBias(biasOffset); //Fsr2.GlobalCallbacks.ApplyMipmapBias(biasOffset);
_upscaledOutput = new RenderTexture(_displaySize.x, _displaySize.y, 0, context.sourceFormat) { name = "FSR2 Upscaled Output", enableRandomWrite = true };
_upscaledOutput.Create();
} }
private void DestroyFsrContext() private void DestroyFsrContext()
@ -186,12 +179,6 @@ namespace UnityEngine.Rendering.PostProcessing
float biasOffset = Fsr2.GetMipmapBiasOffset(_renderSize.x, _prevDisplaySize.x); float biasOffset = Fsr2.GetMipmapBiasOffset(_renderSize.x, _prevDisplaySize.x);
//Fsr2.GlobalCallbacks.ApplyMipmapBias(-biasOffset); //Fsr2.GlobalCallbacks.ApplyMipmapBias(-biasOffset);
} }
if (_upscaledOutput != null)
{
_upscaledOutput.Release();
_upscaledOutput = null;
}
} }
private void ApplyJitter(Camera camera) private void ApplyJitter(Camera camera)

Loading…
Cancel
Save