-
Notifications
You must be signed in to change notification settings - Fork 840
[URP] DepthCopy texture as a color #5369
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
Conversation
…be reverted later on)" This reverts commit 80af9be.
… shaders to accommodate that
…r ConfigureTarget
Hi! This comment will help you figure out which jobs to run before merging your PR. The suggestions are dynamic based on what files you have changed. URP VFX SRP Core Depending on the scope of your PR, you may need to run more jobs than what has been suggested. Please speak to your lead or a Graphics SDET (#devs-graphics-automation) if you are unsure. |
It appears that you made a non-draft PR! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good! Some minor comments
descriptor.depthBufferBits = 32; //TODO: do we really need this. double check; | ||
// descriptor.colorFormat = RenderTextureFormat.Depth; | ||
descriptor.graphicsFormat = GraphicsFormat.R32_SFloat; | ||
descriptor.depthBufferBits = 0; //TODO: do we really need this. double check; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks weird, not sure is needed
@@ -43,14 +43,15 @@ public void Setup(RenderTargetHandle source, RenderTargetHandle destination) | |||
public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData) | |||
{ | |||
var descriptor = renderingData.cameraData.cameraTargetDescriptor; | |||
descriptor.colorFormat = RenderTextureFormat.Depth; | |||
descriptor.depthBufferBits = 32; //TODO: do we really need this. double check; | |||
// descriptor.colorFormat = RenderTextureFormat.Depth; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the commented out line can be removed
@@ -31,6 +31,7 @@ public DepthOnlyPass(RenderPassEvent evt, RenderQueueRange renderQueueRange, Lay | |||
base.profilingSampler = new ProfilingSampler(nameof(DepthOnlyPass)); | |||
m_FilteringSettings = new FilteringSettings(renderQueueRange, layerMask); | |||
renderPassEvent = evt; | |||
useNativeRenderPass = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this pass not RP compatible anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this actually get's set later as there is a possibility that with depth prepass we are going to have the additional depth as depth. however, if we can use it as a color texture - it will get set to true
ClearFlag.None, | ||
ClearFlag.Depth, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't follow why we are changing this. Could this maybe introduce regression for users that might read depend on depth after final blit pass?
Adding @PaulDemeulenaere and @thomas-zeng for area review. |
please also update the changelog |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approve for the XR related changes. Please address other reviewer's feedback :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -271,7 +271,7 @@ void frag(ps_input i | |||
outSelection = float4(_ObjectId, _PassValue, 1.0, 1.0); | |||
#elif VFX_PASSDEPTH == VFX_PASSDEPTH_ACTUAL | |||
#ifndef WRITE_MSAA_DEPTH | |||
dummy = (float4)0; | |||
dummy = float4(i.VFX_VARYING_POSCS.z, 0,0,0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why we need to do this change but I think ™️ this value wasn't actually outputted, thus, it should be fine.
Purpose of this PR
Why is this PR needed, what hard problem is it solving/fixing?
This PR changes the behaviour of URP's DepthCopy pass to output R32_SFloat texture instead of a native depth texture.
Why? Because Native RenderPasses support only a single depth buffer and this copy buffer usually is the main offender on why RenderPasses get split.
This should also enable some features(f.e. SSAO, Decals and etc.) to be able to utilise RenderPass API as well, as a lot of them rely on additional depth texture. This would also mean that the depth could technically be framebuffer-fetched using this newly changed texture
Testing status
Yamato is as green as it can get (it seems, not sure), but QA pass definitely should be done, as this affects the whole URP. Manually checked all of the URP test suites and ran locally on mac editor.
Comments to reviewers
Notes for the reviewers you have assigned.