I’ve written a custom surface shader, which only receives shadows from a directional light but not from point lights, although if I put the standard shader on the same object at the same location it receives shadows from both types. How do I get a custom shader to receive point light shadows? Setting the standard shader as a fallback doesn’t solve the problem.
Further experimenting found that even the manual’s example of a custom shader w/ shadows doesn’t work with point lights, even if there isn’t any other type of light within range (the code I’m referring to is at: Unity - Manual: Custom shader fundamentals )
Anyone know what you need to do to get shadows from a point light in a custom shader?
Surely someone must have dealt with this problem before…
By custom, do you mean a vert frag shader, or a surface one?
As far as I remember you need a second pass in your shader with
Tags {“LightMode” = “ForwardAdd”}
and
#pragma multi_compile_fwdadd_fullshadows
(and your normal shadow stuff added to it)
Thank you, although I couldn’t get that to work, nor does there seem to be much online information about using the above.
You say surface shader on the topic, but the link you are showing is talking about vert frag shaders, which is quite different. Which one are you doing?
I’ve tried both. My shader is currently a surface shader, but I’ll take whichever method I can get to work and then rewrite my shader code if necessary.
In a surface shader you just need #pragma surface surf Standard fullforwardshadows in it. Then all lights should just work.
Thank you; that worked.