I have a streetlight model I am using in a scene, which is set up as a StaticMeshActor blueprint, with all components set to Static mode (ie: not stationary and not moveable). One of the components is a spotlight that emits an orange light.
However, the spotlight will not cast shadows at all. If I create a spotlight instance in the scene with the exact same settings, it casts a shadow no problem (as does a default spotlight). Is there some fundamental problem with the StaticMeshActor blueprint (or blueprints in general) that makes it impossible for spotlights to cast shadows?
NOTE: I am using dynamic lighting and shadows only. IE: I have disabled the Allow Static Lighting setting, and turned on the setting “Force No Precomputed Lighting”
Hey ,
Static lights work with the light builds. The build calculates things like shadows after running a light build. By disabling static lighting and forcing no precomputed lighting you have eliminated the ability to run a lighting build and allow UE4 to process the lights information. I suggest either switching back to static lights and turning back on allow for static lighting or changing your lights from static over to Movable or Stationary.
Okay, I am going to take that as meaning that when I use dynamic lighting only, the spotlights in blueprints need to be either stationary or moveable. Okay then. The spotlight has been set to stationary (since it won’t be moving around), and it still does not cast any shadows. Same with setting it to Moveable. Restarting the editor doesn’t fix anything either.
Have you enabled Generate Mesh Distance Fields in the Render section of the Project settings?
Thats the only thing I think I turned on differently.
In response to another question I posted, I was told NOT to use that because it was causing other problems with shadowing.
EDIT: My apologies, I was thinking of the raytraced mesh distance fields property. Turning on Generate Mesh Distance Fields has fixed my problem.
Well, in just the past minute, based on your feedback, I think I’ve resolved every single problem I was having with shadows. Now I need to figure out how to properly do dynamic reflections…
Well essentially what mesh distance fields does is calculate the distance a mesh is from the source of a light. Thereby calculating how intense a shadow should be, how much falloff it has and a slew of other things to give you a more accurate shadow. Also at a certain point it won’t calculate due to lod’s and that saves you memory and precious power that increases FPS. Also you could have the lights set up the way you do as long as you have the blueprint set to movable as opposed to static.
When setting up lighting it’s important to give like inputs together. IE static lighting build with static blueprints. Movable with movable and so on. Technically you should not have been able to set up a static blueprint with a movable light because that light will always take precedence in a hierarchy. So UE4 calculates the light first and then the mesh. It says oh I have a movable light i’m looking for a movable mesh.
So switch mesh distance fields on and see if that helps. You will have to restart UE4 so save before you do that.
If that doesn’t work try the other direction and go to your original set up and change the blueprint and light to movable.