why DirectionalLight is not casting shadow?

605 Views Asked by At

Code:

Color color = new Color(1f,1f,1f,0.9f);
DirectionalLight directionalLight = new DirectionalLight(rayHandler,200,color,-90f);
directionalLight.setSoftnessLength(0);

Result: Screenshot

When light falls directly from above, why it is not casting shadows from boxes?

1

There are 1 best solutions below

2
dfour On BEST ANSWER

This could be caused by a few things. Some things to check:

  1. Check if your RayHandler is set to blur. Blurring with small objects can hide shadows.
  2. Check the Shadows are enabled in the ray handler.
  3. Check the ambient light is off or lower than the directional light. If ambient light is too high it may hide shadows.
  4. Check your objects are larger than 0.1f as this is the smallest distance box2dlights works with
  5. Check the light is not set to x-ray
  6. check softness length. lights with high softness will have their light bleed through small objects.