From ace41b82170be4bdb09639824491c18aa53c77b2 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Thu, 22 Feb 2024 04:47:18 +0000 Subject: [PATCH] [Port] [2023.2] UUM-61466 Set depth format for cameras with motion vectors JIRA: UUM-61466 When motion vectors are required and a depth-less offscreen texture is used as the camera target, a default depth format should be provided to motion vectors. --- .../Runtime/UniversalRenderer.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs index 082074734ea..79e1a8bd82f 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs @@ -1555,6 +1555,10 @@ void CreateCameraRenderTarget(ScriptableRenderContext context, ref RenderTexture depthDescriptor.depthStencilFormat = k_DepthStencilFormat; RenderingUtils.ReAllocateIfNeeded(ref m_CameraDepthAttachment, depthDescriptor, FilterMode.Point, TextureWrapMode.Clamp, name: "_CameraDepthAttachment"); cmd.SetGlobalTexture(m_CameraDepthAttachment.name, m_CameraDepthAttachment.nameID); + + // update the descriptor to match the depth attachment + descriptor.depthStencilFormat = depthDescriptor.depthStencilFormat; + descriptor.depthBufferBits = depthDescriptor.depthBufferBits; } }