This commit is contained in:
StarBeats 2024-12-17 19:03:29 +08:00
parent f4bbef9e99
commit 3ccfaf4dc7
11 changed files with 75 additions and 21 deletions

View File

@ -1,9 +1,9 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 5500c7bc667b55f49b29485c043a2b42 guid: Cn8ftXmqASi6epsI4nfo7953qufqb5nBuoGXa/Fnz8E2iB3Zkxr25P8=
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}
serializedVersion: 12 serializedVersion: 13
mipmaps: mipmaps:
mipMapMode: 0 mipMapMode: 0
enableMipMap: 1 enableMipMap: 1
@ -22,6 +22,9 @@ TextureImporter:
normalMapFilter: 0 normalMapFilter: 0
flipGreenChannel: 0 flipGreenChannel: 0
isReadable: 0 isReadable: 0
webStreaming: 0
priorityLevel: 0
uploadedMode: 2
streamingMipmaps: 0 streamingMipmaps: 0
streamingMipmapsPriority: 0 streamingMipmapsPriority: 0
vTOnly: 0 vTOnly: 0
@ -70,6 +73,7 @@ TextureImporter:
- serializedVersion: 3 - serializedVersion: 3
buildTarget: DefaultTexturePlatform buildTarget: DefaultTexturePlatform
maxTextureSize: 512 maxTextureSize: 512
maxPlaceholderSize: 32
resizeAlgorithm: 0 resizeAlgorithm: 0
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 1
@ -83,6 +87,7 @@ TextureImporter:
- serializedVersion: 3 - serializedVersion: 3
buildTarget: Standalone buildTarget: Standalone
maxTextureSize: 2048 maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0 resizeAlgorithm: 0
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 1
@ -96,6 +101,7 @@ TextureImporter:
- serializedVersion: 3 - serializedVersion: 3
buildTarget: Server buildTarget: Server
maxTextureSize: 2048 maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0 resizeAlgorithm: 0
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 1
@ -109,6 +115,7 @@ TextureImporter:
- serializedVersion: 3 - serializedVersion: 3
buildTarget: Android buildTarget: Android
maxTextureSize: 512 maxTextureSize: 512
maxPlaceholderSize: 32
resizeAlgorithm: 0 resizeAlgorithm: 0
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 1
@ -122,6 +129,7 @@ TextureImporter:
- serializedVersion: 3 - serializedVersion: 3
buildTarget: iPhone buildTarget: iPhone
maxTextureSize: 512 maxTextureSize: 512
maxPlaceholderSize: 32
resizeAlgorithm: 0 resizeAlgorithm: 0
textureFormat: -1 textureFormat: -1
textureCompression: 1 textureCompression: 1
@ -132,6 +140,34 @@ TextureImporter:
ignorePlatformSupport: 0 ignorePlatformSupport: 0
androidETC2FallbackOverride: 0 androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0 forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: HMIAndroid
maxTextureSize: 512
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: OpenHarmony
maxTextureSize: 512
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: 48
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 1
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []

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

@ -145,25 +145,25 @@ 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: 2560
OutputHeight: 1440 OutputHeight: 1440
Quality: 103 Quality: 103
UseHiResMotionVectors: 0 UseHiResMotionVectors: 1
UseJitteredMotionVectors: 0 UseJitteredMotionVectors: 0
UseMotionVectorsInNDC: 1 UseMotionVectorsInNDC: 1
UseExposureTexture: 0 UseExposureTexture: 0
UseResponsiveMask: 0 UseResponsiveMask: 0
UseAutoExposure: 0 UseAutoExposure: 1
EnableProfiling: 0 EnableProfiling: 0
InvertedDepth: 0 InvertedDepth: 0
VelocityScaleX: -2 VelocityScaleX: -2
VelocityScaleY: 2 VelocityScaleY: 2
JitterScaleX: 0 JitterScaleX: 1
JitterScaleY: 0 JitterScaleY: 1
ExposureScale: 1 ExposureScale: 1
MipMapBias: -1.45 MipMapBias: -1.64
--- !u!114 &1524480044783497712 --- !u!114 &1524480044783497712
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -176,8 +176,8 @@ 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: 4 quality: 3
v1settings: v1settings:
EnableEdgeDirection: 1 EnableEdgeDirection: 1
Mode: 1 Mode: 1
@ -187,8 +187,8 @@ MonoBehaviour:
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: 0 FiveSample: 1
Exposure_co_rcp: 1 Exposure_co_rcp: 0.1
--- !u!114 &2459758869679212578 --- !u!114 &2459758869679212578
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -501,7 +501,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.XESS13) if (asset.SuperResolution == ESuperResolution.XESS13 || asset.SuperResolution == ESuperResolution.GSR2)
{ {
colorDescriptor.graphicsFormat = GraphicsFormat.R16G16B16A16_SFloat; colorDescriptor.graphicsFormat = GraphicsFormat.R16G16B16A16_SFloat;
colorDescriptor.enableRandomWrite = true; // compute colorDescriptor.enableRandomWrite = true; // compute

View File

@ -278,7 +278,6 @@ namespace UnityEngine.Rendering.Universal
SuperResolutionParamSets.Instance.Get<float>("MipmapBias", ref ssMipBias); SuperResolutionParamSets.Instance.Get<float>("MipmapBias", ref ssMipBias);
float taaMipBias = Math.Min(cameraData.taaSettings.mipBias, ssMipBias); float taaMipBias = Math.Min(cameraData.taaSettings.mipBias, ssMipBias);
mipBias = Math.Min(mipBias, taaMipBias); mipBias = Math.Min(mipBias, taaMipBias);
// TODO: xyang Mip bias
cmd.SetGlobalVector(ShaderPropertyId.globalMipBias, new Vector2(mipBias, Mathf.Pow(2.0f, mipBias))); cmd.SetGlobalVector(ShaderPropertyId.globalMipBias, new Vector2(mipBias, Mathf.Pow(2.0f, mipBias)));
//Set per camera matrices. //Set per camera matrices.

View File

@ -135,6 +135,8 @@ namespace X.Rendering.Feature
public int Mode = 1; public int Mode = 1;
[SerializeField, Range(0.5f, 2.5f)] [SerializeField, Range(0.5f, 2.5f)]
public float Sharp = 2; public float Sharp = 2;
[SerializeField, Range(-5f, 2.5f)]
public float MipMapBias = 0;
[SerializeField] [SerializeField]
public Material GSRV1Material; public Material GSRV1Material;
} }
@ -176,6 +178,7 @@ namespace X.Rendering.Feature
cameraData.imageScalingMode = ImageScalingMode.None; cameraData.imageScalingMode = ImageScalingMode.None;
cameraData.upscalingFilter = ImageUpscalingFilter.None; cameraData.upscalingFilter = ImageUpscalingFilter.None;
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", v1settings.MipMapBias);
cmd.SetGlobalVector(ViewportInfoId, new Vector4(1.0f / pixW, 1.0f / pixH, pixW, pixH)); cmd.SetGlobalVector(ViewportInfoId, new Vector4(1.0f / pixW, 1.0f / pixH, pixW, pixH));
cmd.SetGlobalVector(GSR1ParamsId, new Vector4(v1settings.Mode, v1settings.Sharp, 0, 0)); cmd.SetGlobalVector(GSR1ParamsId, new Vector4(v1settings.Mode, v1settings.Sharp, 0, 0));
@ -256,13 +259,16 @@ namespace X.Rendering.Feature
private void UpscalePass(CommandBuffer cmdBuffer, RTHandle source, RTHandle destination) private void UpscalePass(CommandBuffer cmdBuffer, RTHandle source, RTHandle destination)
{ {
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", true);
var jitter = TemporalAA.CurrentJitter;
cmdBuffer.SetGlobalTexture("_PrevSceneColorTexture", prevSceneColorTexture1); cmdBuffer.SetGlobalTexture("_PrevSceneColorTexture", prevSceneColorTexture1);
cmdBuffer.SetGlobalTexture("_InputTexture", source); cmdBuffer.SetGlobalTexture("_InputTexture", source);
cmdBuffer.SetGlobalTexture("_MotionDepthClipAlphaBuffer", motionDepthClipAlphaBuffer); cmdBuffer.SetGlobalTexture("_MotionDepthClipAlphaBuffer", motionDepthClipAlphaBuffer);
cmdBuffer.SetGlobalMatrix("_clipToPrevClip", clipToPrevClip); cmdBuffer.SetGlobalMatrix("_clipToPrevClip", clipToPrevClip);
cmdBuffer.SetGlobalVector("_renderSizeParam", renderSizeParam); cmdBuffer.SetGlobalVector("_renderSizeParam", renderSizeParam);
cmdBuffer.SetGlobalVector("_outputSizeParam", outputSizeParam); cmdBuffer.SetGlobalVector("_outputSizeParam", outputSizeParam);
cmdBuffer.SetGlobalVector("_JitterOffset", GetJitter()); cmdBuffer.SetGlobalVector("_JitterOffset", jitter);
cmdBuffer.SetGlobalVector("_ScaleRatio", scaleRatio.xyxx); cmdBuffer.SetGlobalVector("_ScaleRatio", scaleRatio.xyxx);
cmdBuffer.SetGlobalFloat("_cameraFovAngleHor", cameraFovAngleHor); cmdBuffer.SetGlobalFloat("_cameraFovAngleHor", cameraFovAngleHor);

View File

@ -46,6 +46,7 @@ namespace X.Rendering.Feature
} }
Dictionary<string, bool> boolMap = new ();
Dictionary<string, int> intMap = new (); Dictionary<string, int> intMap = new ();
Dictionary<string, float> floatMap = new (); Dictionary<string, float> floatMap = new ();
Dictionary<string, string> stringMap = new (); Dictionary<string, string> stringMap = new ();
@ -72,6 +73,12 @@ namespace X.Rendering.Feature
map.TryGetValue(name, out value); map.TryGetValue(name, out value);
break; break;
} }
case bool v:
{
var map = boolMap as Dictionary<string, T>;
map.TryGetValue(name, out value);
break;
}
default: default:
throw new ArgumentException($"type err:{typeof(T)}"); throw new ArgumentException($"type err:{typeof(T)}");
} }
@ -97,6 +104,11 @@ namespace X.Rendering.Feature
stringMap[name] = v; stringMap[name] = v;
break; break;
} }
case bool v:
{
boolMap[name] = v;
break;
}
default: default:
throw new ArgumentException($"type err:{typeof(T)}"); throw new ArgumentException($"type err:{typeof(T)}");
} }

View File

@ -145,7 +145,7 @@ namespace X.Rendering.Feature
lastQuality = xess1ConfigParam.Quality; lastQuality = xess1ConfigParam.Quality;
} }
cameraData.NeedJitter = true; SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", 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

@ -36,6 +36,7 @@ namespace UnityEngine.Rendering.Universal
if (!hasActive) if (!hasActive)
{ {
superResolution = ESuperResolution.None; superResolution = ESuperResolution.None;
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", false);
} }
else else
{ {

View File

@ -301,8 +301,10 @@ namespace UnityEngine.Rendering.Universal
static internal Matrix4x4 CalculateJitterMatrix(ref CameraData cameraData, out Vector2 jitter) static internal Matrix4x4 CalculateJitterMatrix(ref CameraData cameraData, out Vector2 jitter)
{ {
Matrix4x4 jitterMat = Matrix4x4.identity; Matrix4x4 jitterMat = Matrix4x4.identity;
bool needJitter = false;
SuperResolutionParamSets.Instance.Get<bool>("NeedJitter", ref needJitter);
bool isJitter = cameraData.IsTemporalAAEnabled() || cameraData.NeedJitter; bool isJitter = cameraData.IsTemporalAAEnabled() || needJitter;
jitter = Vector2.zero; jitter = Vector2.zero;
if (isJitter) if (isJitter)
{ {

View File

@ -627,8 +627,6 @@ namespace UnityEngine.Rendering.Universal
&& postProcessEnabled; // No Postprocessing && postProcessEnabled; // No Postprocessing
} }
internal bool NeedJitter { get; set; }
/// <summary> /// <summary>
/// The sorting criteria used when drawing opaque objects by the internal URP render passes. /// The sorting criteria used when drawing opaque objects by the internal URP render passes.
/// When a GPU supports hidden surface removal, URP will rely on that information to avoid sorting opaque objects front to back and /// When a GPU supports hidden surface removal, URP will rely on that information to avoid sorting opaque objects front to back and