*** UPDATE -RESOLVED ***
Removed Skybox, shadows now work.
Put Skybox back and:
spSky.setShadowMode(RenderQueue.ShadowMode.Off);
Shadows now work again!
I normally set the rootNode to Recieve and Cast and then set the ground to Recieve only, which works well, so maybe Skyboxes should not inherit shadowMode, but default to Off ?
**
I wrote a little prototype game and shadows work just fine, I started another one and I just can’t seem to get shadows to work, starring at the lines of code for hours doesn’t seem to work
Here are the important bits of code and a screenshot. I’ve stripped everything down, so it’s just “Lighting.j3md” basic materials applied to simple Blender-made geometry. The ‘walls’ should be casting a shadow on the floor and the cylinders should be casting onto themselves and the floor.
I’ve tried DirectionalLightShadowRenderer and DirectionalLightShadowFilter…
*Note: ‘Universe’ has a reference to things like root (rootNode) and the AssetManager (assman)
Universe.root.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
sun = new DirectionalLight();
sun.setColor(new ColorRGBA(1f, 1f, 0.90f, 0f).multLocal(0.5f));
sun.setDirection(new Vector3f(-0.9f, -1.0f, -0.5f).normalizeLocal());
Universe.root.addLight(sun);
viewPort.clearProcessors();
final int SHADOWMAP_SIZE = 2048;
shadow = new DirectionalLightShadowRenderer(Universe.assman, SHADOWMAP_SIZE, 4);
//shadow = new DirectionalLightShadowFilter(Universe.assman, SHADOWMAP_SIZE, 4);
shadow.setShadowIntensity(0.95f);
shadow.setEnabledStabilization(true);
shadow.setLight(sun);
shadow.setEdgeFilteringMode(EdgeFilteringMode.Nearest); //tried others
shadow.setShadowZExtend(10000); //world is only 20m square
viewPort.addProcessor(shadow);
//tried to use Filter instead of Renderer...
//FilterPostProcessor fpp = new FilterPostProcessor(Universe.assman);
//fpp.addFilter(shadow);
//viewPort.addProcessor(fpp);
I’ve probably forgot something right? Something really stupid like:
makeShadowsWork=true;
Here’s what I get: Screenshot
GPU: Nvidia Quadro K2200 on Xubuntu Linux…Maven build using InteliJ