Hello, I’m using that code for Shadows:
[java] DirectionalLightShadowRenderer pssmShadow = new DirectionalLightShadowRenderer
(assetManager, 1024, 3);
game.getViewPort().addProcessor((SceneProcessor) pssmShadow);
pssmShadow.setLight(sun);
pssmShadow.setLambda(0.5f);
DirectionalLightShadowFilter pssmFilter = new DirectionalLightShadowFilter
Generally you should use a shadow filter or a shadow renderer, but not both. TestDirectionalLightShadow.java is confusing in this regard because it creates both but only enables one at a time.
To make the filter effective, you would have to invoke viewPort.addProcessor(fpp);
It’s also possible you have the shadow intensity set to 0. Try adding pssmX.setShadowIntensity(1f);
By the way, it’s confusing to put “pssm” in the instance’s name, because PSSM refers to a yet another shadow technique, now deprecated in jME3.
Could you post a short (<200 lines) test program which does not depend on any non-public assets? In other words, a complete app that I can run and debug?
I ask because it’s difficult to debug a problem when you can only see 1% of code. Chances are the bug is not in the 1% you’ve posted, but involves some interaction with the other 99%.
Have you confirmed that your shadow code is even getting executed?
Try setting the rootNode to .CastAndRecieve - right now it looks like everything is set to receive a shadow, but nothing is told to cast a shadow. If you see shadows after that, you know its working, and can set about giving each object the correct shadowmode. I’m not sure if the tutorials mention, but it’s usually best to set the terrain to receive only - no point in calculating a shadow being cast below the terrain - which you won’t even see anyway.
First, your light is pointing upward, which is probably not what you want. Then you have to choose between the shadowProcessor and the ShadowFilter, don’t use both.
@Skatty said:
No. My light is like sun in upper corner and it cast light in good angle/direction
I think @nehon has a valid point:
[java]
new Vector3f(40f, 48f, 20f).normalizeLocal()
[/java]
generates a vector with a positive y-component; it is more upwards than downwards. This appears to be the direction which your directional light is propagating.