Is it possible to create shadows from a DirectionalLight?
If I use SpotLight then I see a shadow, but if I use DirectionalLight it doesn’t work.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, you most definitely can use directional lights to cast shadows. You need to make sure you are not using
MeshBasicMaterialas they don’t support shadows. UseMeshLambertMaterialorMeshPhongMaterialinstead.You need to enable shadows for the renderer with something along these lines:
And then you must enable shadow casting and shadow receiving per object and per light so you would have
Then, if the light and objects are placed at appropriate positions.
dirLightwill cause the shadow ofobjectto be cast againstotherObject.[EDIT]: Here is a working demo for anyone looking to do something similar.