Some questions about shadow filter files

Hi guys.
I have previously found that it is possible to browse shadow filter files in real time in the SDK visualization. But when I use the code to load the Filter file, the material object of one of the filters is null, the situation is as follows:
This is to view the shadow filter file in the SDK visual editor:

everything is normal.
But when I use the code to load this Filter, I get an error that the null pointer is abnormal.
The stack error is as follows:

The specific error seems to be caused by the material object of the DirectionalLightShadowFilter class being null.
I noticed that there are two constructors, one of which does not handle anything. Is it because of this constructor that the material object is not initialized? This is just my guess. Due to my limited ability, I can only hope that the SDK maintainer has time to fix this bug. I am using SDK 3.2.4.

Thank you.

The no-arg constructor for DirectionalLightShadowFilter is intended for serialization only, not for use by applications. As indicated in the javadoc:
jmonkeyengine/ at 8291d6192ba11c83255191cd270cbc379327cf1e · jMonkeyEngine/jmonkeyengine · GitHub

1 Like

Oh, ok, but my problem is that the Material object of the DirectionalLightShadowFilter is null when the .j3f file is loaded in Java code, but it is normal to browse the j3f file directly in the SDK editor. :worried:

If you use the no-args constructor that will happen. You need to use the constructors that require you passing the asset manager instance to the filter.

1 Like