Browse Source

Updated SuperResolution effect implementation to be compatible with FSR 3.1

dec2024update
Nico de Poel 2 years ago
parent
commit
d1808d542e
  1. 3
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Editor/PostProcessLayerEditor.cs
  2. 11
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/PostProcessResources.asset
  3. 6
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/SuperResolution.cs

3
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Editor/PostProcessLayerEditor.cs

@ -37,6 +37,7 @@ namespace UnityEditor.Rendering.PostProcessing
SerializedProperty m_FsrExposureSource;
SerializedProperty m_FsrExposureTexture;
SerializedProperty m_FsrPreExposure;
SerializedProperty m_FsrDebugView;
SerializedProperty m_FsrAutoReactive;
SerializedProperty m_FsrAutoReactiveParams;
SerializedProperty m_FsrReactiveMaskTexture;
@ -96,6 +97,7 @@ namespace UnityEditor.Rendering.PostProcessing
m_FsrExposureSource = FindProperty(x => x.superResolution.exposureSource);
m_FsrExposureTexture = FindProperty(x => x.superResolution.exposure);
m_FsrPreExposure = FindProperty(x => x.superResolution.preExposure);
m_FsrDebugView = FindProperty(x => x.superResolution.enableDebugView);
m_FsrAutoReactive = FindProperty(x => x.superResolution.autoGenerateReactiveMask);
m_FsrAutoReactiveParams = FindProperty(x => x.superResolution.generateReactiveParameters);
m_FsrReactiveMaskTexture = FindProperty(x => x.superResolution.reactiveMask);
@ -231,6 +233,7 @@ namespace UnityEditor.Rendering.PostProcessing
EditorGUILayout.PropertyField(m_FsrExposureSource);
if (m_FsrExposureSource.intValue == (int)SuperResolution.ExposureSource.Manual) EditorGUILayout.PropertyField(m_FsrExposureTexture);
EditorGUILayout.PropertyField(m_FsrPreExposure);
EditorGUILayout.PropertyField(m_FsrDebugView);
EditorGUILayout.PropertyField(m_FsrAutoReactive);
EditorGUILayout.PropertyField(m_FsrAutoReactive.boolValue ? m_FsrAutoReactiveParams : m_FsrReactiveMaskTexture);
EditorGUILayout.PropertyField(m_FsrAutoTcr);

11
Packages/com.unity.postprocessing@3.2.2/PostProcessing/PostProcessResources.asset

@ -128,11 +128,14 @@ MonoBehaviour:
multiScaleAOUpsample: {fileID: 7200000, guid: 600d6212b59bb40409d19d750b5fd1e9, type: 3}
gaussianDownsample: {fileID: 7200000, guid: 6dba4103d23a7904fbc49099355aff3e, type: 3}
superResolution:
computeLuminancePyramidPass: {fileID: 7200000, guid: d253be05abcdc80428503d3e4cce3a36, type: 3}
reconstructPreviousDepthPass: {fileID: 7200000, guid: 4f59e5b9179d74844ae06a30ae1e0629, type: 3}
depthClipPass: {fileID: 7200000, guid: 20e44016ed34b0d4b8de499d1b566c69, type: 3}
lockPass: {fileID: 7200000, guid: a135306e6d1857e43a86ef20db2a47fe, type: 3}
prepareInputsPass: {fileID: 7200000, guid: 4f59e5b9179d74844ae06a30ae1e0629, type: 3}
lumaPyramidPass: {fileID: 7200000, guid: d253be05abcdc80428503d3e4cce3a36, type: 3}
shadingChangePyramidPass: {fileID: 7200000, guid: 251e663738905fa4d8817001682d802f, type: 3}
shadingChangePass: {fileID: 7200000, guid: 9a2bff2f97619ed4989d9b0577ba0641, type: 3}
prepareReactivityPass: {fileID: 7200000, guid: 20e44016ed34b0d4b8de499d1b566c69, type: 3}
lumaInstabilityPass: {fileID: 7200000, guid: a135306e6d1857e43a86ef20db2a47fe, type: 3}
accumulatePass: {fileID: 7200000, guid: c9b45f0ae7673694ba57a4aadfe212e9, type: 3}
sharpenPass: {fileID: 7200000, guid: 7aaf5cfff022de2499e9b0412f947f6c, type: 3}
autoGenReactivePass: {fileID: 7200000, guid: 5716b91fdaa4e9e439df6b96a796fe6e, type: 3}
tcrAutoGenPass: {fileID: 7200000, guid: 75cdc6ef23f08ed498d4da511923fcea, type: 3}
debugViewPass: {fileID: 7200000, guid: cb24a71d54164c54eb5e86839acd48c5, type: 3}

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

@ -59,6 +59,9 @@ namespace UnityEngine.Rendering.PostProcessing
Manual,
}
[Tooltip("Enable a debug view to analyze the upscaling process.")]
public bool enableDebugView = false;
[Tooltip("Optional texture to control the influence of the current frame on the reconstructed output. If unset, either an auto-generated or a default cleared reactive mask will be used.")]
public Texture reactiveMask = null;
[Tooltip("Optional texture for marking areas of specialist rendering which should be accounted for during the upscaling process. If unset, a default cleared mask will be used.")]
@ -284,13 +287,14 @@ namespace UnityEngine.Rendering.PostProcessing
_dispatchDescription.MotionVectorScale.x = -scaledRenderSize.x;
_dispatchDescription.MotionVectorScale.y = -scaledRenderSize.y;
_dispatchDescription.RenderSize = scaledRenderSize;
_dispatchDescription.InputResourceSize = scaledRenderSize;
_dispatchDescription.UpscaleSize = _displaySize;
_dispatchDescription.FrameTimeDelta = Time.unscaledDeltaTime;
_dispatchDescription.CameraNear = camera.nearClipPlane;
_dispatchDescription.CameraFar = camera.farClipPlane;
_dispatchDescription.CameraFovAngleVertical = camera.fieldOfView * Mathf.Deg2Rad;
_dispatchDescription.ViewSpaceToMetersFactor = 1.0f; // 1 unit is 1 meter in Unity
_dispatchDescription.Reset = _resetHistory;
_dispatchDescription.Flags = enableDebugView ? Fsr3Upscaler.DispatchFlags.DrawDebugView : 0;
// Set up the parameters for the optional experimental auto-TCR feature
_dispatchDescription.EnableAutoReactive = autoGenerateTransparencyAndComposition;

Loading…
Cancel
Save