DirectionalLights derive from the Camera class and use an OrthographicLens to render the shadow maps. In order to see shadows, you need to configure the film size and near/far of the lens. Film size determines the width and height of the lens, and near/far determines the minimum and maximum distance that the lens will render. The default film size on a DirectionalLight is way too small to render any shadow maps.
You can do this with dlight.node().getLens().setFilmSize(x, y)
and dlight.node().getLens().setNearFar(near, far)
.
You can also visualize the lens with dlight.node().showFrustum()
.
Note that a larger film size will result in blockier shadow maps, and a larger near/far will reduce the precision of the depth buffer and might result in shadow acne.
Also, to prevent specific nodes from casting shadows, you can give the DirectionalLight camera a unique bit, and any node that you don’t want casting shadows can be hidden from the camera.
Example:
dlight.node().setCameraMask(BitMask32.bit(1))
render.show(BitMask32.bit(1)) # entire scene will be visible to the dlight camera
node.hide(BitMask32.bit(1)) # this particular node will not be visible to the dlight camera