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

DepthBuffer? #3

Open
SiriusRU opened this issue Feb 5, 2021 · 2 comments
Open

DepthBuffer? #3

SiriusRU opened this issue Feb 5, 2021 · 2 comments

Comments

@SiriusRU
Copy link

SiriusRU commented Feb 5, 2021

Hi. I use DepthBuffer for some post-processing effects and as far as I understand current shader implementation does not fully write anything there, although in the shader itself I see a "DepthOnly" pass:

image
image

Is there any way to fix that?

@SiriusRU
Copy link
Author

SiriusRU commented Feb 5, 2021

Hmm. After some research seems like issue was somehow caused by URP ScreenSpaceAmbientOcclusion RenderFeature set to DepthNormal mode. When set to just Depth or disabled - there is nothing wrong with Depth. So issue on Unity side I guess.

@SiriusRU SiriusRU closed this as completed Feb 5, 2021
@Cyanilux
Copy link
Owner

Cyanilux commented Feb 6, 2021

URP10+ introduces an additional DepthNormals Pass/LightMode tag which, looking at the ForwardRenderer & DepthNormalOnlyPass code, it appears this pass is required in the shader to support rendering the depth & normals textures during the DepthNormal mode for the ScreenSpaceAmbientOcclusion feature.

Unlike the DepthOnly which returns 0, as the DepthNormals name suggests it's supposed to calculate normals and output them in the fragment too. e.g. The Lit.shader uses this in v10.3.1. (Of note, it's also changed again in the master branch (v11?) due to added deferred support and apparently it stays in world space rather than converting to view??? I guess for now this can be ignored since that version isn't published but wow that's annoying...)

Also if I recall correctly the normal isn't completely accurate to the grass blade direction. The blades all have normals facing directly upwards (/original vertex normal direction?) so that the lighting behaves nicely. Unsure if that'll be a problem but something to be aware of.

I might look into this further at some point and update this GrassGeometryShader example, but until then I'll reopen the issue so it'll be easier for others to see it if they are having the same problem. Thanks!

@Cyanilux Cyanilux reopened this Feb 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants