Hi,
I’m relatively new to game development, and especially jMonkeyEngine, and experiencing a strange problem when importing a glTf model:
The textures of some surfaces become transparent and show strange patterns, that probably resemble the shadows the surfaces should receive.
The picture above shows the current output of a minimalistic sample program i created to narrow down the error(right), the rendered blender output (middle) and the model as it appears in blender layout mode(left). The sample program that produces the image shown above:
public class PbrSceneTest extends SimpleApplication {
public static void main(String[] args) {
PbrSceneTest app = new PbrSceneTest();
app.start();
}
private DirectionalLight dl;
@Override
public void simpleInitApp() {
getRenderManager().setPreferredLightMode(TechniqueDef.LightMode.StaticPass);
getRenderManager().setSinglePassLightBatchSize(10);
viewPort.setBackgroundColor(ColorRGBA.DarkGray);
dl = new DirectionalLight();
dl.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
rootNode.addLight(dl);
dl.setColor(ColorRGBA.White);
ChaseCameraAppState chaser = new ChaseCameraAppState();
chaser.setDragToRotate(true);
chaser.setMinVerticalRotation(-FastMath.HALF_PI);
chaser.setMaxDistance(1000);
chaser.setInvertVerticalAxis(true);
getStateManager().attach(chaser);
chaser.setTarget(rootNode);
flyCam.setEnabled(false);
rootNode.attachChild(loadScene());
}
private Node loadScene() {
Node level = (Node) assetManager.loadModel("Scenes/tree_house/scene.gltf");
level.setLocalScale(5);
return level;
}
}
What puzzles me even more is, that if i open the model in blender, similar behavior can be observed in the layout-view, when rendering, everything looks as it should 'though.
I also get the following warning when loading the model:
“The texture Scenes/tree_house/textures/Trees_metallicRoughness.png has linear color space, but the material parameter LightMap specifies no color space requirement, this may lead to unexpected behavior.”
I am pretty the cause of this warning is not the cause of the observed behavior, as assigning a linear color space to LightMap does not change anything on the observed behavior.
I have tried jme-3.2.4 and 3.3.0, and everything i could to figure out where the error might be, but failed.
Do you have any Idea what might cause the strange rendering effects, or even how to fix it?