Shadows passing through meshes

Can anyone give me some pointers on why I have shadows that pass through objects, and also appear on the underside of floors/ceilings even though casting object is on the other side?

Hope I’m just missing some culling or material flag somewhere :slight_smile:

class Main extends hxd.App {

  static function main() {
    new Main();
  }

  public function new() {
    super();
  }

  override function init() {
    super.init();

    var cubeA = new h3d.prim.Cube(10,10,1,true);
    cubeA.unindex();
    cubeA.addNormals();
    var meshA = new h3d.scene.Mesh(cubeA, s3d);
    meshA.material.mainPass.enableLights = true;
    meshA.material.shadows = true;

    var cubeB = new h3d.prim.Cube(5,5,1,true);
    cubeB.unindex();
    cubeB.addNormals();
    var meshB = new h3d.scene.Mesh(cubeB, s3d);
    meshB.material.mainPass.enableLights = true;
    meshB.material.shadows = true;
    meshB.z = 5;

    var cubeC = new h3d.prim.Cube(1,1,1,true);
    cubeC.unindex();
    cubeC.addNormals();
    var meshC = new h3d.scene.Mesh(cubeC, s3d);
    meshC.material.mainPass.enableLights = true;
    meshC.material.shadows = true;
    meshC.z = 8;

    var shadow = s3d.renderer.getPass(h3d.pass.DefaultShadowMap);
    shadow.power /= 10;

    // light from behind, angled down
    var light = new h3d.scene.fwd.DirLight(new h3d.Vector(0,0.25,-1), s3d);
    light.color.load(new h3d.Vector(1,1,1));

    s3d.camera.zNear = 1;
    s3d.camera.zFar = 1000;
    s3d.camera.fovY = 45;
    s3d.camera.pos.set(0, 10, 30);
    s3d.camera.target.set(0, 0, 0);

    new h3d.scene.CameraController(s3d).loadFromCamera();
  }
}

I’m really late to this post but if anyone have the same problem, try those settings:

shadow = s3d.renderer.getPass(h3d.pass.DefaultShadowMap);
shadow.size = 2048;
shadow.power = 200;
shadow.blur.radius = 0;
shadow.bias *= 0.1;
shadow.color.set(0.7, 0.7, 0.7);

The shadow color is applied on the whole pass

*Thanks NewKrok