- Home /
Problems with Depth Normals and variable CullMode
Short question: How can I change shader property values of a custom Depth Normals shader?
The problem: In our software we allow users to enable/disable back face culling for each model. The setting is passed to the model shader as a property, and used like this: Cull [_Cull]
However, on some models (with face culling disabled) Screen Space Ambient Occlusion ends up looking weird. The SSAO effect uses the depth normals texture, and since the depth normals shader by default uses back face culling I get cases where I render a wall but the depth normals texture has the depth of the objects behind the wall (because the wall's triangles were culled).
How can I solve this problem? I can create my own depth normals shader by changing the default shader under "Built-in Shader Settings" in the Graphics Settings window. In this shader, I can change the default cull mode. However, I need the cull mode to be user-settable, but I can't find a way to pass shader properties to the shader. Since the depth normals pass doesn't seem to use a normal material, I don't know how to set shader property values.
Your answer
Follow this Question
Related Questions
Manual shaders in URP/HDRP 1 Answer
[Deferred Decals] Add simple specular channel to deffered decals 0 Answers
Reading from Depth Texture in Unity 2021.1.7f1 0 Answers
How to render one object on top of another in URP? 0 Answers
Material with custom shader black on Android (Lightweight Render Pipeline) 0 Answers