Hello again JME3 community
I’m working on a PoC, but having a problem when using DirectionalLightShadowFilter
In the SceneComposer, it does render normally, without any problems.
But when I try to start the application
@Override
public void simpleInitApp() {
Node mainScene = new Node("Main Scene");
Spatial stage1 = assetManager.loadModel("Scenes/demo.j3o");
stage1.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
mainScene.attachChild(stage1);
AmbientLight al = new AmbientLight();
al.setColor(ColorRGBA.DarkGray.multLocal(0.1F));
mainScene.addLight(al);
flyCam.setMoveSpeed(10);
cam.setFrustumPerspective(45f, (float) cam.getWidth() / cam.getHeight(), 0.001f, 1000f);
int degree = 16;
renderer.setDefaultAnisotropicFilter(degree);
FilterPostProcessor processor = (FilterPostProcessor) assetManager.loadAsset("Filters/DemoFilter.j3f");
viewPort.addProcessor(processor);
rootNode.attachChild(mainScene);
}
It throws the following error:
java.lang.NullPointerException: Cannot invoke "com.jme3.material.Material.setTexture(String, com.jme3.texture.Texture)" because the return value of "com.jme3.post.Filter.getMaterial()" is null
at com.jme3.post.Filter.setDepthTexture(Filter.java:310)
at com.jme3.post.FilterPostProcessor.initFilter(FilterPostProcessor.java:190)
at com.jme3.post.FilterPostProcessor.reshape(FilterPostProcessor.java:510)
at com.jme3.post.FilterPostProcessor.initialize(FilterPostProcessor.java:169)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1179)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1287)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:278)
at com.jme3.system.lwjgl.LwjglWindow.runLoop(LwjglWindow.java:628)
at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:717)
at java.base/java.lang.Thread.run(Thread.java:833)
It seems that some material that I’m using is causing the issue. But I checked each one of them, deleted and applied just one simple Lighting material with grey texture to the whole scene and the problem persists. I even updated the SDK and JME3 version and the problem persists.
I feel that is something very simple which I’m missing here.
Does anyone have a guess about what might be the cause?
Thanks in advance