This commit is contained in:
StarBeats 2024-12-23 18:05:43 +08:00
parent c076a15a5b
commit 656145eb07
9 changed files with 73 additions and 24 deletions

View File

@ -2638,6 +2638,9 @@ ReflectionProbe:
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
m_RenderingLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_IntensityMultiplier: 1 m_IntensityMultiplier: 1
m_BlendDistance: 0.5 m_BlendDistance: 0.5
m_HDR: 1 m_HDR: 1
@ -6654,6 +6657,9 @@ ReflectionProbe:
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
m_RenderingLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_IntensityMultiplier: 1 m_IntensityMultiplier: 1
m_BlendDistance: 0.5 m_BlendDistance: 0.5
m_HDR: 1 m_HDR: 1
@ -9111,6 +9117,9 @@ ReflectionProbe:
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
m_RenderingLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_IntensityMultiplier: 1 m_IntensityMultiplier: 1
m_BlendDistance: 1 m_BlendDistance: 1
m_HDR: 1 m_HDR: 1
@ -10653,6 +10662,9 @@ ReflectionProbe:
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
m_RenderingLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_IntensityMultiplier: 1 m_IntensityMultiplier: 1
m_BlendDistance: 0.5 m_BlendDistance: 0.5
m_HDR: 1 m_HDR: 1
@ -18432,6 +18444,9 @@ ReflectionProbe:
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
m_RenderingLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_IntensityMultiplier: 1 m_IntensityMultiplier: 1
m_BlendDistance: 4 m_BlendDistance: 4
m_HDR: 1 m_HDR: 1
@ -21287,6 +21302,9 @@ ReflectionProbe:
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
m_RenderingLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_IntensityMultiplier: 1 m_IntensityMultiplier: 1
m_BlendDistance: 0.1 m_BlendDistance: 0.1
m_HDR: 1 m_HDR: 1
@ -21473,6 +21491,9 @@ ReflectionProbe:
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
m_RenderingLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_IntensityMultiplier: 1 m_IntensityMultiplier: 1
m_BlendDistance: 0.5 m_BlendDistance: 0.5
m_HDR: 1 m_HDR: 1
@ -25101,19 +25122,19 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7019485897165914674, guid: 8e5bed6b8dcfed240a38affefd9c58f6, type: 3} - target: {fileID: 7019485897165914674, guid: 8e5bed6b8dcfed240a38affefd9c58f6, type: 3}
propertyPath: m_LocalRotation.w propertyPath: m_LocalRotation.w
value: 1 value: -0.9006986
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7019485897165914674, guid: 8e5bed6b8dcfed240a38affefd9c58f6, type: 3} - target: {fileID: 7019485897165914674, guid: 8e5bed6b8dcfed240a38affefd9c58f6, type: 3}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
value: -0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7019485897165914674, guid: 8e5bed6b8dcfed240a38affefd9c58f6, type: 3} - target: {fileID: 7019485897165914674, guid: 8e5bed6b8dcfed240a38affefd9c58f6, type: 3}
propertyPath: m_LocalRotation.y propertyPath: m_LocalRotation.y
value: -0 value: 0.43444455
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7019485897165914674, guid: 8e5bed6b8dcfed240a38affefd9c58f6, type: 3} - target: {fileID: 7019485897165914674, guid: 8e5bed6b8dcfed240a38affefd9c58f6, type: 3}
propertyPath: m_LocalRotation.z propertyPath: m_LocalRotation.z
value: -0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7019485897165914677, guid: 8e5bed6b8dcfed240a38affefd9c58f6, type: 3} - target: {fileID: 7019485897165914677, guid: 8e5bed6b8dcfed240a38affefd9c58f6, type: 3}
propertyPath: field of view propertyPath: field of view
@ -26531,11 +26552,12 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1558980086} m_GameObject: {fileID: 1558980086}
m_Enabled: 1 m_Enabled: 0
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a62f35552be2a4a4e8e2683b7aea565b, type: 3} m_Script: {fileID: 11500000, guid: a62f35552be2a4a4e8e2683b7aea565b, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
transform: {fileID: 1425990503}
--- !u!1 &8509203744807723470 --- !u!1 &8509203744807723470
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -28,7 +28,7 @@ MonoBehaviour:
m_SupportsHDR: 1 m_SupportsHDR: 1
m_HDRColorBufferPrecision: 0 m_HDRColorBufferPrecision: 0
m_MSAA: 1 m_MSAA: 1
m_RenderScale: 0.5882813 m_RenderScale: 0.6666667
m_UpscalingFilter: 0 m_UpscalingFilter: 0
m_FsrOverrideSharpness: 1 m_FsrOverrideSharpness: 1
m_FsrSharpness: 1 m_FsrSharpness: 1
@ -114,5 +114,5 @@ MonoBehaviour:
m_PrefilterNativeRenderPass: 1 m_PrefilterNativeRenderPass: 1
m_ShaderVariantLogLevel: 0 m_ShaderVariantLogLevel: 0
m_ShadowCascades: 0 m_ShadowCascades: 0
superResolution: 14 superResolution: 4
vrsRate: 0 vrsRate: 0

View File

@ -146,10 +146,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c3c4391133b9f3142b57264047029ec5, type: 3} m_Script: {fileID: 11500000, guid: c3c4391133b9f3142b57264047029ec5, type: 3}
m_Name: XESS m_Name: XESS
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Active: 1 m_Active: 0
xess1ConfigParam: xess1ConfigParam:
OutputWidth: 2560 OutputWidth: 1920
OutputHeight: 1440 OutputHeight: 1080
Quality: 103 Quality: 103
UseHiResMotionVectors: 0 UseHiResMotionVectors: 0
UseJitteredMotionVectors: 0 UseJitteredMotionVectors: 0
@ -177,20 +177,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a6b8ba513f1b1fe499924f362fdde22d, type: 3} m_Script: {fileID: 11500000, guid: a6b8ba513f1b1fe499924f362fdde22d, type: 3}
m_Name: GSR m_Name: GSR
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Active: 0 m_Active: 1
quality: 3 quality: 3
v1settings: v1settings:
EnableEdgeDirection: 1 EnableEdgeDirection: 1
Mode: 4 Mode: 1
Sharp: 0.942 Sharp: 0.72
MipMapBias: -1.76 MipMapBias: -1.08
GSRV1Material: {fileID: 2100000, guid: d57e64d5723127243b429034bed82c7d, type: 2} GSRV1Material: {fileID: 2100000, guid: d57e64d5723127243b429034bed82c7d, type: 2}
v2settings: v2settings:
UseCompute2Pass: 0 UseCompute2Pass: 0
GSRV2Material: {fileID: 2100000, guid: faa906817c0647f42a0cec70faeb91c1, type: 2} GSRV2Material: {fileID: 2100000, guid: faa906817c0647f42a0cec70faeb91c1, type: 2}
GSRV2ComputeShader: {fileID: 7200000, guid: 9a4e6ff1f9a33fa4ea1e9744e313e2fd, type: 3} GSRV2ComputeShader: {fileID: 7200000, guid: 9a4e6ff1f9a33fa4ea1e9744e313e2fd, type: 3}
FiveSample: 1 FiveSample: 0
Exposure_co_rcp: 0.1 Exposure_co_rcp: 0.1
MipMapBias: -0.8
--- !u!114 &2459758869679212578 --- !u!114 &2459758869679212578
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -505,7 +505,7 @@ namespace UnityEngine.Rendering.Universal
ref var colorDescriptor = ref cameraData.cameraTargetDescriptor; ref var colorDescriptor = ref cameraData.cameraTargetDescriptor;
colorDescriptor.width = cameraData.camera.pixelWidth; colorDescriptor.width = cameraData.camera.pixelWidth;
colorDescriptor.height = cameraData.camera.pixelHeight; colorDescriptor.height = cameraData.camera.pixelHeight;
if (asset.SuperResolution == ESuperResolution.GSR2) if (asset.SuperResolution == ESuperResolution.GSR2_COMPUTE)
{ {
colorDescriptor.graphicsFormat = GraphicsFormat.R16G16B16A16_SFloat; colorDescriptor.graphicsFormat = GraphicsFormat.R16G16B16A16_SFloat;
colorDescriptor.enableRandomWrite = true; // colorDescriptor.enableRandomWrite = true; //

View File

@ -95,6 +95,15 @@ namespace X.Rendering.Feature
public void SetSR(ESuperResolution resolution) public void SetSR(ESuperResolution resolution)
{ {
if (resolution == ESuperResolution.GSR2)
{
v2settings.UseCompute2Pass = false;
}
if (resolution == ESuperResolution.GSR2_COMPUTE)
{
v2settings.UseCompute2Pass = true;
}
switch (resolution) switch (resolution)
{ {
case ESuperResolution.GSR1: case ESuperResolution.GSR1:
@ -104,6 +113,7 @@ namespace X.Rendering.Feature
} }
break; break;
case ESuperResolution.GSR2: case ESuperResolution.GSR2:
case ESuperResolution.GSR2_COMPUTE:
{ {
SetActive(true); SetActive(true);
useGSR1 = false; useGSR1 = false;
@ -170,6 +180,7 @@ namespace X.Rendering.Feature
{ {
v1settings.GSRV1Material.DisableKeyword("UseEdgeDirection"); v1settings.GSRV1Material.DisableKeyword("UseEdgeDirection");
} }
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", false);
cmd.SetRenderTarget(destination); cmd.SetRenderTarget(destination);
@ -208,6 +219,8 @@ namespace X.Rendering.Feature
public bool FiveSample = false; public bool FiveSample = false;
[SerializeField] [SerializeField]
public float Exposure_co_rcp = 1; public float Exposure_co_rcp = 1;
[SerializeField, Range(-5f, 2.5f)]
public float MipMapBias = 0;
} }
sealed class GSRV2 : IDisposable sealed class GSRV2 : IDisposable
@ -301,6 +314,8 @@ namespace X.Rendering.Feature
private void DispatchUpscale(CommandBuffer cmdBuffer, RTHandle historyIn, RTHandle historyOut, RTHandle destination) private void DispatchUpscale(CommandBuffer cmdBuffer, RTHandle historyIn, RTHandle historyOut, RTHandle destination)
{ {
var gsrv2 = v2settings.GSRV2ComputeShader; var gsrv2 = v2settings.GSRV2ComputeShader;
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", true);
var jitter = TemporalAA.CurrentJitter;
cmdBuffer.SetComputeTextureParam(gsrv2, 1, "_inputPrevHistoryOutput", historyIn); cmdBuffer.SetComputeTextureParam(gsrv2, 1, "_inputPrevHistoryOutput", historyIn);
cmdBuffer.SetComputeTextureParam(gsrv2, 1, "_inputYCoCgColor", YCoCgColor); cmdBuffer.SetComputeTextureParam(gsrv2, 1, "_inputYCoCgColor", YCoCgColor);
cmdBuffer.SetComputeTextureParam(gsrv2, 1, "_inputMotionDepthClipAlphaBuffer", motionDepthClipAlphaBuffer); cmdBuffer.SetComputeTextureParam(gsrv2, 1, "_inputMotionDepthClipAlphaBuffer", motionDepthClipAlphaBuffer);
@ -311,7 +326,7 @@ namespace X.Rendering.Feature
cmdBuffer.SetComputeFloatParams(gsrv2, "_cameraFovAngleHor", cameraFovAngleHor); cmdBuffer.SetComputeFloatParams(gsrv2, "_cameraFovAngleHor", cameraFovAngleHor);
cmdBuffer.SetComputeFloatParams(gsrv2, "minLerpContribution", minLerpContribution); cmdBuffer.SetComputeFloatParams(gsrv2, "minLerpContribution", minLerpContribution);
cmdBuffer.SetComputeFloatParams(gsrv2, "Exposure_co_rcp", v2settings.Exposure_co_rcp); cmdBuffer.SetComputeFloatParams(gsrv2, "Exposure_co_rcp", v2settings.Exposure_co_rcp);
cmdBuffer.SetGlobalVector("_JitterOffset", GetJitter()); cmdBuffer.SetGlobalVector("_JitterOffset", jitter);
if (v2settings.FiveSample) if (v2settings.FiveSample)
{ {
@ -385,6 +400,8 @@ namespace X.Rendering.Feature
dimension = TextureDimension.Tex2D, dimension = TextureDimension.Tex2D,
msaaSamples = 1, msaaSamples = 1,
}); });
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", v2settings.MipMapBias);
if (v2settings.UseCompute2Pass) if (v2settings.UseCompute2Pass)
{ {

View File

@ -15,6 +15,7 @@ namespace X.Rendering.Feature
FSR3, FSR3,
GSR1, // 高通空域超分1 GSR1, // 高通空域超分1
GSR2, GSR2,
GSR2_COMPUTE,
ASR, // Accuracy Super Resolution ASR, // Accuracy Super Resolution
HW_SPATIAL_SR, // 华为空域超分 HW_SPATIAL_SR, // 华为空域超分
HW_AISR, // 华为AI空域超分 HW_AISR, // 华为AI空域超分

View File

@ -153,7 +153,6 @@ namespace X.Rendering.Feature
} }
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", true); SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", true);
SuperResolutionParamSets.Instance.Set<bool>("UpScaledMotionVector", true);
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", xess1ConfigParam.MipMapBias); SuperResolutionParamSets.Instance.Set<float>("MipmapBias", xess1ConfigParam.MipMapBias);
SuperResolutionParamSets.Instance.Set<float>("JitterScale", xess1ConfigParam.JitterScaleX); SuperResolutionParamSets.Instance.Set<float>("JitterScale", xess1ConfigParam.JitterScaleX);

View File

@ -85,6 +85,12 @@ Shader "MRP/SR/GSR2"
float4 topLeft = _DepthTexture.GatherRed(samLinearClamp, (gatherCoord + v12), 0); float4 topLeft = _DepthTexture.GatherRed(samLinearClamp, (gatherCoord + v12), 0);
float2 v14 = float2(_renderSizeParam.z * 2.0f, _renderSizeParam.w * 2.0f); float2 v14 = float2(_renderSizeParam.z * 2.0f, _renderSizeParam.w * 2.0f);
float4 topRight = _DepthTexture.GatherRed(samLinearClamp, (gatherCoord + v14), 0); float4 topRight = _DepthTexture.GatherRed(samLinearClamp, (gatherCoord + v14), 0);
#if !UNITY_REVERSED_Z
btmLeft = 1.0 - btmLeft;
btmRight = 1.0 - btmRight;
topLeft = 1.0 - topLeft;
topRight = 1.0 - topRight;
#endif
float maxC = max(max(max(btmLeft.z, btmRight.w), topLeft.y), topRight.x); float maxC = max(max(max(btmLeft.z, btmRight.w), topLeft.y), topRight.x);
float btmLeft4 = max(max(max(btmLeft.y, btmLeft.x), btmLeft.z), btmLeft.w); float btmLeft4 = max(max(max(btmLeft.y, btmLeft.x), btmLeft.z), btmLeft.w);
@ -114,12 +120,15 @@ Shader "MRP/SR/GSR2"
//refer to ue/fsr2 PostProcessFFX_FSR2ConvertVelocity.usf, and using nearest depth for dilated motion //refer to ue/fsr2 PostProcessFFX_FSR2ConvertVelocity.usf, and using nearest depth for dilated motion
float4 EncodedVelocity = _MotionVectorTexture.Load(int3(inputPos, 0)); float2 motion = _MotionVectorTexture.Load(int3(inputPos, 0));
float2 motion; // if (EncodedVelocity.x > 0.0)
if (EncodedVelocity.x > 0.0) // {
// motion = EncodedVelocity.xy;//decodeVelocityFromTexture(EncodedVelocity.xy);
// }
if (length(motion) > 0.000001f)
{ {
motion = EncodedVelocity.xy;//decodeVelocityFromTexture(EncodedVelocity.xy); motion.y = -motion.y;
} }
else else
{ {

View File

@ -15,10 +15,10 @@ EditorUserSettings:
value: 5b00515154055e035459547042705a44154f1e2c2e2e7f677e7d4567e1b9376d value: 5b00515154055e035459547042705a44154f1e2c2e2e7f677e7d4567e1b9376d
flags: 0 flags: 0
RecentlyUsedSceneGuid-3: RecentlyUsedSceneGuid-3:
value: 5a57555407545f0b5e0f5f764277594914161e2b787977692b714e64e4b2363b value: 57050d5004060d590f56087046700f4445164c7e7a7824312e7c4e6bb0e1376d
flags: 0 flags: 0
RecentlyUsedSceneGuid-4: RecentlyUsedSceneGuid-4:
value: 57050d5004060d590f56087046700f4445164c7e7a7824312e7c4e6bb0e1376d value: 5a57555407545f0b5e0f5f764277594914161e2b787977692b714e64e4b2363b
flags: 0 flags: 0
vcSharedLogLevel: vcSharedLogLevel:
value: 0d5e400f0650 value: 0d5e400f0650