0

Toggle for "Opacity Clip On Shadows Only", same for dithering

Kit 8 years ago updated by behealed 8 years ago 1

My Designer colleagues have trouble getting the right combination of smooth transparency and accurate shadows out of Shaderforge.


It was easy for myself to mock something up in Shaderforge then browse through the code and delete clip() from the Forward passes, leaving it in ShadowCaster only.


A similar scenario arrises when using Dithered alpha. Sometimes i can get a nice blurry shadow by applying dithered alpha to my shadows, but need to maintain 8bit alpha for my Forward passes.


to do this, add a code node to your shader. In the code node, add something like this:


#if defined(UNITY_PASS_SHADOWCASTER)
return SHADOW_ALPHA_CLIP;

#else
return MAIN_ALPHA_CLIP;
#endif


And then connect that code node into the alpha clip input of the main node.

And give the code node those two variables, SHADOW_ALPHA_CLIP and MAIN_ALPHA_CLIP.

And then input whatever you want into each.