- Home /
Invisible object cast shadows.
Hi, I have recently upgraded to the FREE version of unity 4.2. I have a fps with the standard controller and want to implement shadows. Everything works fine except I want to layer a soldier on top of my regular capsule. It cast shadows but it gets in the way of the camera. Can I make invisible to the camera AND still cast shadows? Thanks.
Answer by CHPedersen · Sep 02, 2013 at 07:15 PM
How you're able to cast shadows with the free version of Unity, I don't know. It isn't supposed to be supported in Unity Free, but maybe I've misunderstood something in your question. ;)
Anyway, to have an invisible object cast shadows, you need a custom shader. I did a quick google and managed to dig one out here. Have a look at this:
http://answers.unity3d.com/questions/269292/having-an-invisible-object-that-casts-shadows.html
It looks like that does pretty much exactly what you need.
I cannot do shaders in unity free. BTW in unity 4.2 the free version can do shadows with directional lights.
Nonsense. :) Shaders are perfectly supported in both Free and Pro. See license comparison under Graphics:
Wonderful! But I can't seem to add one to the object.
Have you created the custom shader yet? If not, follow these steps:
Right-Click the project pane, select "Create" and "Shader". You will get a new shader file that has a shader stub in it. Open this file, and delete the shader stub. Copy-paste the short shadow-casting shader from manutoo's answer in that Unity Answers post I linked to. Save the file.
Next, create a new $$anonymous$$aterial, then choose the shader you've just created to render this material. It will be under the Transparent group. Put this new material on your first person (and make sure it's the only material on the character). It should now render invisibly, yet cast shadows, provided they work with the directional lights as you mention.
Your answer
![](https://koobas.hobune.stream/wayback/20220613113436im_/https://answers.unity.com/themes/thub/images/avi.jpg)