DepthTexture only mode
Opened this issue · 1 comments
JohannesDeml commented
I noticed, that the DepthTextureNormals are set and used even if the mode is set to DepthTexture.
The problem for that was this snippet:
if (occlusionSource == OcclusionSource.DepthTexture)
targetCamera.depthTextureMode |= DepthTextureMode.Depth;
if (occlusionSource != OcclusionSource.GBuffer)
targetCamera.depthTextureMode |= DepthTextureMode.DepthNormals;
(The second if is also true for depth texture).
The problem now is, that the shader does not really work with depth only:
It almost seems like the bright areas are the one's that should be dark and vice versa.
I will send you a pull request, hopefully you can figure out how to solve the shader problem.
TiliSleepStealer commented
Hi, in order for depth only mode to work you need to reconstruct your normals from the depth buffer.
I got it to work by adding this piece of code at line 109 in Obscurance.cginc
#if defined(SOURCE_DEPTH)
// reconstruct normal from view-space position
norm_o = normalize(cross(ddy(vpos_o), ddx(vpos_o)));
#endif
Hope this helps other people.