Skip to content

Commit 56b7b16

Browse files
[Fogbugz # 1365098] correct depth transparent lens flare (#5658)
* Binding correct depth for lens flare. Depth bound was depth pyramid causing occlusion artifacts on depth transparent * Changelog Co-authored-by: sebastienlagarde <[email protected]>
1 parent 6e17908 commit 56b7b16

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
4646
- Fixed a warning when enabling tile/cluster debug.
4747
- Fix recursive rendering transmittance over the sky (case 1323945).
4848
- Fixed specular anti aliasing for layeredlit shader.
49+
- Fixed lens flare occlusion issues with transparent depth. It had the wrong depth bound (1365098)
4950

5051
### Changed
5152
- Visual Environment ambient mode is now Dynamic by default.

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ TextureHandle RenderPostProcess(RenderGraph renderGraph,
513513
// HDRP to reduce the amount of resolution lost at the center of the screen
514514
source = PaniniProjectionPass(renderGraph, hdCamera, source);
515515

516-
source = LensFlareDataDrivenPass(renderGraph, hdCamera, source);
516+
source = LensFlareDataDrivenPass(renderGraph, hdCamera, source, depthBuffer);
517517

518518
TextureHandle bloomTexture = BloomPass(renderGraph, hdCamera, source);
519519
TextureHandle logLutOutput = ColorGradingPass(renderGraph, hdCamera);
@@ -3061,11 +3061,12 @@ class LensFlareData
30613061
{
30623062
public LensFlareParameters parameters;
30633063
public TextureHandle source;
3064+
public TextureHandle depthBuffer;
30643065
public HDCamera hdCamera;
30653066
public Vector2Int viewport;
30663067
}
30673068

3068-
TextureHandle LensFlareDataDrivenPass(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle source)
3069+
TextureHandle LensFlareDataDrivenPass(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle source, TextureHandle depthBuffer)
30693070
{
30703071
if (m_LensFlareDataDataDrivenFS && !LensFlareCommonSRP.Instance.IsEmpty())
30713072
{
@@ -3075,6 +3076,7 @@ TextureHandle LensFlareDataDrivenPass(RenderGraph renderGraph, HDCamera hdCamera
30753076
passData.parameters = PrepareLensFlareParameters(hdCamera);
30763077
passData.viewport = postProcessViewportSize;
30773078
passData.hdCamera = hdCamera;
3079+
passData.depthBuffer = depthBuffer;
30783080
TextureHandle dest = GetPostprocessUpsampledOutputHandle(renderGraph, "Lens Flare Destination");
30793081

30803082
builder.SetRenderFunc(
@@ -3083,6 +3085,8 @@ TextureHandle LensFlareDataDrivenPass(RenderGraph renderGraph, HDCamera hdCamera
30833085
float width = (float)data.viewport.x;
30843086
float height = (float)data.viewport.y;
30853087

3088+
ctx.cmd.SetGlobalTexture(HDShaderIDs._CameraDepthTexture, data.depthBuffer);
3089+
30863090
LensFlareCommonSRP.DoLensFlareDataDrivenCommon(
30873091
data.parameters.lensFlareShader, data.parameters.lensFlares, data.hdCamera.camera, width, height,
30883092
data.parameters.usePanini, data.parameters.paniniDistance, data.parameters.paniniCropToFit,

0 commit comments

Comments
 (0)