Shadows Poking Through Viewmodel Shader

Hello, I’m currently working on a viewmodel shader which uses custom projection matrices to have a viewmodel that is effected by lighting.

It mostly works, it draws above world geometry and projects at a different fov, but I’ve run into a bit of a problem, the shadows seem to be peering through the viewmodel now. Here are some screenshots to show what I mean:

As you can see above the shadow is at least partially showing up though the model.

I am accomplishing my viewmodel shader by setting a custom projection matrix for the material (which is just the unity standard material with a custom include). This is what those processes look like:

I’m not exactly sure where I’ve gone wrong and suspect it may be the result of a bug. I’ve attached the files necessary if anyone wants to take a look.

8168159–1062875–Viewmodel.shader (12.7 KB)
8168159–1062884–UnityShaderUtilities.txt (2.37 KB)

Worth noting I forgot to include a file, this includes the UnityShaderUtilities to do the custom projection matrix.

8168819–1062980–ViewmodelInclude.txt (43.3 KB)