I made a model using Blender 2.79, and have exported it into jme sdk in fbx and obj. When I run the program with the model (in fbx), it is stretched awkwardly and there are gaps in the model that were not there previously.
When running with obj or j3o, the model is fine, except there are some faces that will disappear when looking at the right angle.
The model looks fine in Blender, and I haven’t done anything unusual with the model (unless you count uv unwrapping or vertex extending unusual) or in the code. I opened the models in SceneComposer, and it’s the same as running the program.
Spatial kart = assetManager.loadModel("Models/Karts/StandardKart.fbx");
kart.setLocalTranslation(0, 0, 0);
Material kartMat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
kartMat.setTexture("DiffuseMap", assetManager.loadTexture("Models/Karts/StandardKart.png"));
kart.setMaterial(kartMat);
rootNode.attachChild(kart);
Edit: does it have anything to do with awkwardly bending faces?
I fixed the stretching problem. The model was scaled in object mode, and it probably didn’t register with fbx. I scaled it in edit mode to fix it, but I’m still having troubles with sides disappearing.
99% of the time, stuff like this can be because modifiers weren’t applied before exporting. And since your second post already confirms that you didn’t… that would be the first place to start.
WARNING: FBX model isn’t using correct forward axis sign. Orientation could be incorrect
Apr 24, 2021 10:38:17 AM com.jme3.scene.plugins.fbx.misc.FbxGlobalSettings fromElement WARNING: FBX model isn’t using meters for world units. Scale could be incorrect.
Apr 24, 2021 10:38:17 AM com.jme3.scene.plugins.IrUtils triangulate WARNING: N-gon encountered, ignoring. The mesh may not appear correctly. Triangulate your model prior to export.
Apr 24, 2021 10:38:17 AM com.jme3.scene.plugins.IrUtils triangulate
Blender displays faces using double-sided materials. JME materials default to single-sided. So I wonder if some of the model faces have flipped normals. A quick fix might be to make the applied materials double-sided in JME, using material.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off).
The fact that it’s dynamic based on camera position makes me think of culling.
Culling makes me think of odd transforms that make the bounding shape fall outside of the camera view even when the should be in view.
Odd transforms makes me think of “applying transforms”… which from the first post we already know wasn’t done because of the bit about “object mode scaling”.
…but sometimes formats are weird, too. And the only time I’ve had a problem like this with gltf was related to weird animation. (see thread about chicken) And I generally distrust the less supported formats like fbx. OBJ should have been ok, though, if transforms were applied.