Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Draw On Top' doesn't work in URP when Unity does a 'CopyDepth' pass #1

Closed
kangaroo1234 opened this issue Oct 7, 2020 · 0 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@kangaroo1234
Copy link

The 'draw on top' option works fine EXCEPT when Unity does a 'CopyDepth' pass.

For example with these setting (depth texture enabled and MSAA off)

image

Then the 'draw on top' option does not work, the outlines will always be on top. This only happens in the game view.

When MSAA is enabled, the issue is not there or when the depth texture is disabled and post processing is also disabled on the camera, it's also fine.

I did some research and found that whether or not the 'draw on top' option works, is related to whether or not Unity does a 'CopyDepth' pass. The pass is here.

https://github.com/Unity-Technologies/Graphics/blob/716e8e06a2ba235052572dff41b98074e6065dee/com.unity.render-pipelines.universal/Runtime/Passes/CopyDepthPass.cs

And here in this script

https://github.com/Unity-Technologies/Graphics/blob/716e8e06a2ba235052572dff41b98074e6065dee/com.unity.render-pipelines.universal/Runtime/ForwardRenderer.cs

you see they do some logic like this

bool requiresDepthPrepass = requiresDepthTexture && !CanCopyDepth(ref renderingData.cameraData); requiresDepthPrepass |= isSceneViewCamera; requiresDepthPrepass |= isPreviewCamera; requiresDepthPrepass |= renderPassInputs.requiresDepthPrepass; requiresDepthPrepass |= renderPassInputs.requiresNormalsTexture;

which corressponds to the issue not being active when the scene view is active or when unity can't copy depth. So when unity does a deph prepass instead of the copy depth pass, all works fine..

@Snapchip Snapchip changed the title 'Draw On Top' doesn't work in URP 'Draw On Top' doesn't work in URP when Unity does a 'CopyDepth' pass Oct 7, 2020
@Snapchip Snapchip self-assigned this Oct 7, 2020
@Snapchip Snapchip added the bug Something isn't working label Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants