Skip to content

Commit c443f1f

Browse files
gmitrano-unityEvergreen
authored andcommitted
Reduce Banding on FSR Upscaled Render Target
The previous code was using the same graphics format for the scaling setup and FSR upscaled RTs. When FSR is active, we use a unorm format on the EASU input RT (scaling setup's output) to avoid banding since its content is gamma2 encoded. We were unnecessarily using this format for the final upscaled RT as well which contains linearly encoded color data and can safely use the pipeline's standard color format. In this case, the unnecessary format modification was making the banding more visible. Before: ![image](https://media.github.cds.internal.unity3d.com/user/4435/files/6107cf5e-e26e-4590-96ae-15e151bee4dd) After: ![image](https://media.github.cds.internal.unity3d.com/user/4435/files/7e595fa3-bd24-4bf2-b124-ef0966e44ed5)
1 parent 676f90a commit c443f1f

File tree

7 files changed

+738
-2
lines changed

7 files changed

+738
-2
lines changed

Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPass.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1769,7 +1769,9 @@ void RenderFinalPass(CommandBuffer cmd, ref RenderingData renderingData)
17691769
{
17701770
m_Materials.easu.shaderKeywords = null;
17711771

1772-
var upscaleRtDesc = tempRtDesc;
1772+
var upscaleRtDesc = cameraData.cameraTargetDescriptor;
1773+
upscaleRtDesc.msaaSamples = 1;
1774+
upscaleRtDesc.depthBufferBits = 0;
17731775
upscaleRtDesc.width = cameraData.pixelWidth;
17741776
upscaleRtDesc.height = cameraData.pixelHeight;
17751777

Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcessPassRenderGraph.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1801,9 +1801,13 @@ public void RenderFinalPassRenderGraph(RenderGraph renderGraph, ContextContainer
18011801
tempRtDesc.graphicsFormat = UniversalRenderPipeline.MakeUnormRenderTextureGraphicsFormat();
18021802

18031803
var scalingSetupTarget = UniversalRenderer.CreateRenderGraphTexture(renderGraph, tempRtDesc, "scalingSetupTarget", true, FilterMode.Point);
1804-
var upscaleRtDesc = tempRtDesc;
1804+
1805+
var upscaleRtDesc = cameraData.cameraTargetDescriptor;
1806+
upscaleRtDesc.msaaSamples = 1;
1807+
upscaleRtDesc.depthBufferBits = 0;
18051808
upscaleRtDesc.width = cameraData.pixelWidth;
18061809
upscaleRtDesc.height = cameraData.pixelHeight;
1810+
18071811
var upScaleTarget = UniversalRenderer.CreateRenderGraphTexture(renderGraph, upscaleRtDesc, "_UpscaledTexture", true, FilterMode.Point);
18081812

18091813
var currentSource = source;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!21 &2100000
4+
Material:
5+
serializedVersion: 8
6+
m_ObjectHideFlags: 0
7+
m_CorrespondingSourceObject: {fileID: 0}
8+
m_PrefabInstance: {fileID: 0}
9+
m_PrefabAsset: {fileID: 0}
10+
m_Name: BandingMaterial
11+
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
12+
m_Parent: {fileID: 0}
13+
m_ModifiedSerializedProperties: 0
14+
m_ValidKeywords: []
15+
m_InvalidKeywords: []
16+
m_LightmapFlags: 4
17+
m_EnableInstancingVariants: 0
18+
m_DoubleSidedGI: 0
19+
m_CustomRenderQueue: -1
20+
stringTagMap:
21+
RenderType: Opaque
22+
disabledShaderPasses:
23+
- MOTIONVECTORS
24+
m_LockedProperties:
25+
m_SavedProperties:
26+
serializedVersion: 3
27+
m_TexEnvs:
28+
- _BaseMap:
29+
m_Texture: {fileID: 2800000, guid: 5f951043386624d62a1d57cf247df28f, type: 3}
30+
m_Scale: {x: 0.1, y: 4}
31+
m_Offset: {x: 0, y: 0}
32+
- _BumpMap:
33+
m_Texture: {fileID: 0}
34+
m_Scale: {x: 1, y: 1}
35+
m_Offset: {x: 0, y: 0}
36+
- _DetailAlbedoMap:
37+
m_Texture: {fileID: 0}
38+
m_Scale: {x: 1, y: 1}
39+
m_Offset: {x: 0, y: 0}
40+
- _DetailMask:
41+
m_Texture: {fileID: 0}
42+
m_Scale: {x: 1, y: 1}
43+
m_Offset: {x: 0, y: 0}
44+
- _DetailNormalMap:
45+
m_Texture: {fileID: 0}
46+
m_Scale: {x: 1, y: 1}
47+
m_Offset: {x: 0, y: 0}
48+
- _EmissionMap:
49+
m_Texture: {fileID: 0}
50+
m_Scale: {x: 1, y: 1}
51+
m_Offset: {x: 0, y: 0}
52+
- _MainTex:
53+
m_Texture: {fileID: 2800000, guid: 5f951043386624d62a1d57cf247df28f, type: 3}
54+
m_Scale: {x: 0.1, y: 4}
55+
m_Offset: {x: 0, y: 0}
56+
- _MetallicGlossMap:
57+
m_Texture: {fileID: 0}
58+
m_Scale: {x: 1, y: 1}
59+
m_Offset: {x: 0, y: 0}
60+
- _OcclusionMap:
61+
m_Texture: {fileID: 0}
62+
m_Scale: {x: 1, y: 1}
63+
m_Offset: {x: 0, y: 0}
64+
- _ParallaxMap:
65+
m_Texture: {fileID: 0}
66+
m_Scale: {x: 1, y: 1}
67+
m_Offset: {x: 0, y: 0}
68+
- _SpecGlossMap:
69+
m_Texture: {fileID: 0}
70+
m_Scale: {x: 1, y: 1}
71+
m_Offset: {x: 0, y: 0}
72+
- unity_Lightmaps:
73+
m_Texture: {fileID: 0}
74+
m_Scale: {x: 1, y: 1}
75+
m_Offset: {x: 0, y: 0}
76+
- unity_LightmapsInd:
77+
m_Texture: {fileID: 0}
78+
m_Scale: {x: 1, y: 1}
79+
m_Offset: {x: 0, y: 0}
80+
- unity_ShadowMasks:
81+
m_Texture: {fileID: 0}
82+
m_Scale: {x: 1, y: 1}
83+
m_Offset: {x: 0, y: 0}
84+
m_Ints: []
85+
m_Floats:
86+
- _AddPrecomputedVelocity: 0
87+
- _AlphaClip: 0
88+
- _AlphaToMask: 0
89+
- _Blend: 0
90+
- _BlendModePreserveSpecular: 1
91+
- _BumpScale: 1
92+
- _ClearCoatMask: 0
93+
- _ClearCoatSmoothness: 0
94+
- _Cull: 2
95+
- _Cutoff: 0.5
96+
- _DetailAlbedoMapScale: 1
97+
- _DetailNormalMapScale: 1
98+
- _DstBlend: 0
99+
- _DstBlendAlpha: 0
100+
- _EnvironmentReflections: 1
101+
- _GlossMapScale: 0
102+
- _Glossiness: 0
103+
- _GlossyReflections: 0
104+
- _Metallic: 0
105+
- _OcclusionStrength: 1
106+
- _Parallax: 0.005
107+
- _QueueOffset: 0
108+
- _ReceiveShadows: 1
109+
- _Smoothness: 0.5
110+
- _SmoothnessTextureChannel: 0
111+
- _SpecularHighlights: 1
112+
- _SrcBlend: 1
113+
- _SrcBlendAlpha: 1
114+
- _Surface: 0
115+
- _WorkflowMode: 1
116+
- _ZWrite: 1
117+
m_Colors:
118+
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
119+
- _Color: {r: 1, g: 1, b: 1, a: 1}
120+
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
121+
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
122+
m_BuildTextureStacks: []
123+
m_AllowLocking: 1
124+
--- !u!114 &5016658129403020143
125+
MonoBehaviour:
126+
m_ObjectHideFlags: 11
127+
m_CorrespondingSourceObject: {fileID: 0}
128+
m_PrefabInstance: {fileID: 0}
129+
m_PrefabAsset: {fileID: 0}
130+
m_GameObject: {fileID: 0}
131+
m_Enabled: 1
132+
m_EditorHideFlags: 0
133+
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
134+
m_Name:
135+
m_EditorClassIdentifier:
136+
version: 9

Tests/SRPTests/Projects/UniversalGraphicsTest_PostPro/Assets/Scenes/108_UpscalingFilters/BandingMaterial.mat.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)