On the shadow problem

        // 阳光
        DirectionalLight sun = new DirectionalLight();
        sun.setName("sun");
        sun.setDirection(new Vector3f(-1, -2, -3).normalizeLocal());
        sun.setColor(ColorRGBA.White);
        rootNode.addLight(sun);
    //    System.out.println(rootNode.getLocalLightList().get(1).getName()+"灯光");
        // 定向光影子
        DirectionalLightShadowRenderer dlsr = new DirectionalLightShadowRenderer(assetManager, 1024, 4);
        dlsr.setLight(sun);// 设置定向光源
        dlsr.setEdgeFilteringMode(EdgeFilteringMode.PCFPOISSON);
        viewPort.addProcessor(dlsr);

I added this code but the shadow didn’t appear

How does SimpleApplication get loaded lights in BaseAppState

For example, I can use a SimpleApplication. GetRootNode().getChildren() to obtain model.
light how to obtain?

Is your object marked to cast shadows? Is our ground marked to receive shadows?

Were you working from an example that worked? What is the difference between your code and the working example?

2 Likes

This seems to be something I missed. Thank you for the tip

1 Like