diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 2ede615c790..e0c671ed1ed 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed a warning when enabling tile/cluster debug. - Fix recursive rendering transmittance over the sky (case 1323945). - Fixed specular anti aliasing for layeredlit shader. +- 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. 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 336a676ce04..f63bb36538e 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,