I am attempting to create a game, mostly for fun but also for learning. The specifics of how the game works are very unlikely to be necessary. However, if you need to know then please ask. There is one terrain object that is randomly generated at runtime via a custom Perlin Noise like implementation along with an Ambient Light, a DirectonalLight, a DirectionalLightShadowRenderer, DirectionalLightShadowFilter, and a SSAOFilter. Both filters are added to the same FilterPostProcessor. There are no other objects added to the RootNode at all.
I am using IntelliJ Idea Community Edition since I prefer it over JME’s SDK. I have all JME3 libraries added to the classpath along with the testdata. When the IDE builds the project, it simply extracts all of JME3’s jars into the application’s final jar to simplify deployment (although that will almost certainly never happen).
I have the following code to initialize the lighting:
AmbientLight ambientLight = new AmbientLight();
ambientLight.setColor(ColorRGBA.White.mult(1.5f));
balloonWars.getRootNode().addLight(ambientLight);
DirectionalLight sun = new DirectionalLight();
sun.setDirection(SUN_DIR);
sun.setColor(ColorRGBA.White.mult(1.2f));
balloonWars.getRootNode().addLight(sun);
FilterPostProcessor filterPostProcessor = new FilterPostProcessor();
DirectionalLightShadowFilter directionalLightShadowFilter = new DirectionalLightShadowFilter(balloonWars.getAssetManager(), SHADOWMAP_SIZE, 3);
directionalLightShadowFilter.setLight(sun);
directionalLightShadowFilter.setEnabled(true);
filterPostProcessor.addFilter(directionalLightShadowFilter);
SSAOFilter ssaoFilter = new SSAOFilter();
filterPostProcessor.addFilter(ssaoFilter);
balloonWars.getViewPort().addProcessor(filterPostProcessor);
DirectionalLightShadowRenderer directionalLightShadowRenderer = new DirectionalLightShadowRenderer(balloonWars.getAssetManager(), SHADOWMAP_SIZE, 3);
directionalLightShadowFilter.setLight(sun);
balloonWars.getViewPort().addProcessor(directionalLightShadowRenderer);
This code produces the following stacktrace:
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NullPointerException
at com.jme3.material.Material.<init>(Material.java:120)
at com.jme3.post.ssao.SSAOFilter.initFilter(SSAOFilter.java:150)
at com.jme3.post.Filter.init(Filter.java:234)
at com.jme3.post.FilterPostProcessor.initFilter(FilterPostProcessor.java:165)
at com.jme3.post.FilterPostProcessor.reshape(FilterPostProcessor.java:447)
at com.jme3.post.FilterPostProcessor.initialize(FilterPostProcessor.java:149)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:955)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1029)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:252)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:745)
This is running on Ubuntu 14.04 LTS x64 on a Toshiba Satellite laptop with Intel Integrated Graphics. I have found that SSAO works fine in other games written in IntelliJ Idea on the same computer, however I am unaware of anything I did differently in those games that could have any effect on this.
The code to setup lighting is executed in an AppState, however when executed in simpleInitApp() the same issue occurs.