diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 1bd570e18c3..c5743c00864 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -40,6 +40,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed display of LOD Bias and maximum level in frame settings when using Quality Levels - Fixed an issue when trying to open a look dev env library when Look Dev is not supported. - Fixed shader graph not supporting indirectdxr multibounce (case 1294694). +- Fixed the planar depth texture not being properly created and rendered to (case 1299617). ### Changed - Removed the material pass probe volumes evaluation mode. diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs index 56148b3878d..bc0be083191 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs @@ -294,17 +294,22 @@ void ExecuteWithRenderGraph(RenderRequest renderRequest, for (int viewIndex = 0; viewIndex < hdCamera.viewCount; ++viewIndex) { BlitFinalCameraTexture(m_RenderGraph, hdCamera, postProcessDest, backBuffer, viewIndex); - - if (target.targetDepth != null) - { - BlitFinalCameraTexture(m_RenderGraph, hdCamera, prepassOutput.resolvedDepthBuffer, m_RenderGraph.ImportTexture(target.targetDepth), viewIndex); - } } if (aovRequest.isValid) aovRequest.PushCameraTexture(m_RenderGraph, AOVBuffers.Output, hdCamera, postProcessDest, aovBuffers); } + // This code is only for planar reflections. Given that the depth texture cannot be shared currently with the other depth copy that we do + // we need to do this seperately. + for (int viewIndex = 0; viewIndex < hdCamera.viewCount; ++viewIndex) + { + if (target.targetDepth != null) + { + BlitFinalCameraTexture(m_RenderGraph, hdCamera, prepassOutput.resolvedDepthBuffer, m_RenderGraph.ImportTexture(target.targetDepth), viewIndex); + } + } + // XR mirror view and blit do device EndCameraXR(m_RenderGraph, hdCamera); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Utilities/HDRenderUtilities.cs b/com.unity.render-pipelines.high-definition/Runtime/Utilities/HDRenderUtilities.cs index 752ac579c43..1a4937ac46e 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Utilities/HDRenderUtilities.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Utilities/HDRenderUtilities.cs @@ -341,13 +341,15 @@ public static void Render( [Obsolete("Use CreateReflectionProbeRenderTarget with explicit format instead", true)] public static RenderTexture CreateReflectionProbeRenderTarget(int cubemapSize) { - return new RenderTexture(cubemapSize, cubemapSize, 1, GraphicsFormat.R16G16B16A16_SFloat) + RenderTexture rt = new RenderTexture(cubemapSize, cubemapSize, 1, GraphicsFormat.R16G16B16A16_SFloat) { dimension = TextureDimension.Cube, enableRandomWrite = true, useMipMap = true, autoGenerateMips = false }; + rt.Create(); + return rt; } /// @@ -358,13 +360,15 @@ public static RenderTexture CreateReflectionProbeRenderTarget(int cubemapSize) /// The texture to use as reflection probe target. public static RenderTexture CreateReflectionProbeRenderTarget(int cubemapSize, GraphicsFormat format) { - return new RenderTexture(cubemapSize, cubemapSize, 1, format) + RenderTexture rt = new RenderTexture(cubemapSize, cubemapSize, 1, format) { dimension = TextureDimension.Cube, enableRandomWrite = true, useMipMap = true, autoGenerateMips = false }; + rt.Create(); + return rt; } /// @@ -375,13 +379,15 @@ public static RenderTexture CreateReflectionProbeRenderTarget(int cubemapSize, G /// The texture used as planar reflection probe target public static RenderTexture CreatePlanarProbeRenderTarget(int planarSize, GraphicsFormat format) { - return new RenderTexture(planarSize, planarSize, 1, format) + RenderTexture rt = new RenderTexture(planarSize, planarSize, 1, format) { dimension = TextureDimension.Tex2D, enableRandomWrite = true, useMipMap = true, autoGenerateMips = false }; + rt.Create(); + return rt; } /// @@ -391,13 +397,15 @@ public static RenderTexture CreatePlanarProbeRenderTarget(int planarSize, Graphi /// The texture used as planar reflection probe target public static RenderTexture CreatePlanarProbeDepthRenderTarget(int planarSize) { - return new RenderTexture(planarSize, planarSize, 1, GraphicsFormat.R32_SFloat) + RenderTexture rt = new RenderTexture(planarSize, planarSize, 1, GraphicsFormat.R32_SFloat) { dimension = TextureDimension.Tex2D, enableRandomWrite = true, useMipMap = true, autoGenerateMips = false }; + rt.Create(); + return rt; } ///