- Home /
Post FX is ignoring transparent shader
I'd like to get a custom fog gradient in my scene and I'm pretty new to shader coding. I followed this tutorial: https://grrava.blogspot.com/2018/08/stylistic-fog-from-firewatch-with.html and the post FX is working great! Only problem is that it's not affecting any transparent shaders.
Here are some things that I've tried:
1) Set PostProcessEvent to BeforeTransparent (that prevented the background object from rendering over my transparent shader, but the transparent shader was still unaffected by the PostFX fog.
2) Set up dithering on an opaque shader. This kind of worked. The dithered shader was getting affected by the PostFX fog, but the shadow pass (i think) was rendering on top of my dithered shader.
Any thoughts? Thanks!
Answer by Namey5 · Jun 16, 2019 at 11:59 AM
Unfortunately as it is, transparent objects don't write to the depth texture. Seeing as this effect is reliant on the depth texture (as it's the only information about the scene the shader has), it physically can't see transparent objects. The dithering approach you mentioned is a fantastic workaround to this problem, and the problem you are facing with that shader is very fixable. If you can post your dithering/discarding function, then we can create an appropriate shadowcaster pass for said shader. Alternatively, you could use a custom transparent shader that includes the fog function within it.
Your answer
Follow this Question
Related Questions
Transparent Blend by Shader Variant in Surface Shader 0 Answers
Transparent & reflective shader 1 Answer
Shader bug or code fault? 1 Answer
Twosided shader with transparent texture 1 Answer
weird shader problem (correct in editor, weird ingame) 2 Answers