From 51e29b3d91edf8682b7142929feb252523c2b248 Mon Sep 17 00:00:00 2001 From: Kleber Garcia Date: Tue, 14 Sep 2021 18:21:50 -0400 Subject: [PATCH 1/2] Binding correct depth for lens flare. Depth bound was depth pyramid causing occlusion artifacts on depth transparent --- .../RenderPipeline/HDRenderPipeline.PostProcess.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs index 253c09549bc..ae44cd0f498 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs @@ -513,7 +513,7 @@ TextureHandle RenderPostProcess(RenderGraph renderGraph, // HDRP to reduce the amount of resolution lost at the center of the screen source = PaniniProjectionPass(renderGraph, hdCamera, source); - source = LensFlareDataDrivenPass(renderGraph, hdCamera, source); + source = LensFlareDataDrivenPass(renderGraph, hdCamera, source, depthBuffer); TextureHandle bloomTexture = BloomPass(renderGraph, hdCamera, source); TextureHandle logLutOutput = ColorGradingPass(renderGraph, hdCamera); @@ -3061,11 +3061,12 @@ class LensFlareData { public LensFlareParameters parameters; public TextureHandle source; + public TextureHandle depthBuffer; public HDCamera hdCamera; public Vector2Int viewport; } - TextureHandle LensFlareDataDrivenPass(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle source) + TextureHandle LensFlareDataDrivenPass(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle source, TextureHandle depthBuffer) { if (m_LensFlareDataDataDrivenFS && !LensFlareCommonSRP.Instance.IsEmpty()) { @@ -3075,6 +3076,7 @@ TextureHandle LensFlareDataDrivenPass(RenderGraph renderGraph, HDCamera hdCamera passData.parameters = PrepareLensFlareParameters(hdCamera); passData.viewport = postProcessViewportSize; passData.hdCamera = hdCamera; + passData.depthBuffer = depthBuffer; TextureHandle dest = GetPostprocessUpsampledOutputHandle(renderGraph, "Lens Flare Destination"); builder.SetRenderFunc( @@ -3083,6 +3085,8 @@ TextureHandle LensFlareDataDrivenPass(RenderGraph renderGraph, HDCamera hdCamera float width = (float)data.viewport.x; float height = (float)data.viewport.y; + ctx.cmd.SetGlobalTexture(HDShaderIDs._CameraDepthTexture, data.depthBuffer); + LensFlareCommonSRP.DoLensFlareDataDrivenCommon( data.parameters.lensFlareShader, data.parameters.lensFlares, data.hdCamera.camera, width, height, data.parameters.usePanini, data.parameters.paniniDistance, data.parameters.paniniCropToFit, From 029ae5d65502fc77a8ba7c6128f10615623c2834 Mon Sep 17 00:00:00 2001 From: Kleber Garcia Date: Tue, 14 Sep 2021 18:23:17 -0400 Subject: [PATCH 2/2] Changelog --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 51809acae69..4a9c233ddea 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed double camera preview. - Fixed the volumetric clouds cloud map not being centered over the world origin (case 1364465). - Fixed the emissive being overriden by ray traced sub-surface scattering (case 1364456). +- Fixed lens flare occlusion issues with transparent depth. It had the wrong depth bound (1365098) ### Changed - Visual Environment ambient mode is now Dynamic by default.