Shadows flickering in 3.1

I have another strange issue in 3.1. It looks like this is caused by my own code though as it doesn’t appear in a test case I wrote. Maybe you can still help me as it worked in 3.0. First of all here is a video showing the problem:

I didn’t have that issue with 3.0. The shadows start to “flicker” once I add a particle emitter to the scene (it flickers only once but the beam in the video is actually multiple particle emitters so it flickers the whole time). Now the strange thing: Once I remove the skybox, the issue is gone. I have no idea how the skybox could affect this honestly. The issue appears with the DirectionalLightShadowRenderer as well as with the filter.
Here are the relevant parts of the code:

private void initLightAndShadow() {
        DirectionalLight sun = new DirectionalLight();
        sun.setDirection((new Vector3f(0.5f, -0.5f, .3f)).normalizeLocal());
        sun.setColor(ColorRGBA.White.mult(1f));  //1.3

        AmbientLight ambient = new AmbientLight();

        DirectionalLightShadowRenderer dlsr = new DirectionalLightShadowRenderer(assetManager, 2560, 3);

    private void initSky() {
        Texture west = assetManager.loadTexture("Textures/sky/desertsky_lf.tga");
        Texture east = assetManager.loadTexture("Textures/sky/desertsky_rt.tga");
        Texture north = assetManager.loadTexture("Textures/sky/desertsky_ft.tga");
        Texture south = assetManager.loadTexture("Textures/sky/desertsky_bk.tga");
        Texture up = assetManager.loadTexture("Textures/sky/desertsky_up.tga");
        Texture down = assetManager.loadTexture("Textures/sky/desertsky_dn.tga");
        Spatial sky = SkyFactory.createSky(assetManager, west, east, south, north, up, down);

When the mouse button is clicked, I just attach a particle emitter and the shadows flicker one time.
As I said, I couldn’t replicate the issue in a testcase I created but I’m really running out of ideas. Were any changes made to the skyboxes or so? I still don’t get why the skybox affects the shadows in such a way (but only in my game, not in the test case??)

Not quite sure if this is a problem in my code or something in 3.1 (it worked in 3.0). I am thankful for any hint.

Okay really strange but this issue does not appear when I attach the sky in the sceneComposer. Hmmmm

Another thing I noticed that is not really annoying but definetely not the expected behaviour is that when adding a sky in the sceneComposer a collisionShape in the middle of the scene is created. One can easily fix this by setting the localtranslation of the sky but I don’t know why this is the case in the first place.

That’s really weird issue, looks like shadows are not render on the frame you attach the PE…but that’s just a wild guess.
Do you have the issue with the shadowFilter?

this is not a collision shape, it’s the actual mesh of the skybox. the skybox is actually a small sphere in the center of the scene, that is rendered from the inside on the far plane. Moving it anywhere should not cause any side effect.

Yeah the issue is there with the renderer as well as the filter.

Alright yeah there weren’t any side effect with moving it. Just wanted to calrify that this isn’t some bug :slight_smile:

I think the shadow is rendered in a complete different way from versions 3.0 to 3.1, but I maybe wrong.
Anyway, I dont know if helps, but I saw the same effect happening once in an particular pc, I think it was some feature the video card didnt have, but I could not remember witch one.
Did you try to run this same app in another computer ?

No not yet but I don’t think it has to do with the hardware as it only appears when I attach the skybox in code and when I attach in the sceneComposer the issue doesn’t appear. But I could try though when I have a testing machine around.

nope, it didn’t change globally. There has been some optimizations, but it’s still pretty much the same