Hi everyone,
I am exchanging Objects in my scene, and change lights and shadows. So everytime I change something, I remove the processors from the viewport, make a new one, and add it to the view port.
I do it this way, because just changing the contents of the scene does not seem to remove the shadow rendering of the previous objects, and the game gets very slow after a while. After removing all processors with [java]ViewPort.removeProcessors()[/java] everything at first seems fine, but when creating new processors and adding them to the ViewPort, this also seems to add the “old” processors / shadows, overlaying the different shadows.
Since viewport.removeProcessors() does not seem to be the right way to actually remove the DSLR, what would be the right way?
Thanks for any suggestions!
Here’s the code how I add the DLSR:
[java]DirectionalLightShadowRenderer dlsr = new DirectionalLightShadowRenderer(assetManager, shadowMapSize,
dlsr.setLight(sun);
dlsr.setShadowZExtend(distanceFromCamera);
dlsr.setShadowIntensity(shadowIntensity);
dlsr.setShadowZFadeLength(fadingOutOver);
dlsr.setEdgeFilteringMode(EdgeFilteringMode.PCFPOISSON);
viewPort.addProcessor(dlsr);[/java]