I’m trying to use 3D models that I got off of Sketchfab in a BasicGame(In the SDK)
This is the model: M16 Assault Rifle - Download Free 3D model by Mateusz Woliński (@jeandiz) [339d0f7] - Sketchfab
I checked my download and there is no issues with the model.
This is the code that I am using
protected Spatial rifle;
...
public some method(){
rifle = createRifle();
rootNode.attach(rifle);
}
}
// ignore variable naming
protected createRifle(){
// Create spatial
Spatial checkpoint = assetManager.loadModel("Models/m16_assault_rifle/scene.j3o");
checkpoint.scale(1.0f);
// Location
checkpoint.setLocalTranslation(10.0f, 10.0f, 10.0f);
// Create light for spatial
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));
checkpoint.addLight(sun);
return checkpoint;
}
This is what happens when I attempt to attach the model to the scene
Uncaught exception thrown in Thread[jME3 Main,5,main]
RendererException: compile error in: ShaderSource[name=Common/MatDefs/Light/PBRLighting.frag, defines, type=Fragment, language=GLSL110]
ERROR: 0:207: GLSL 110 does not allow sub- or super-matrix constructors
ERROR: 0:208: Use of undeclared identifier 'wToLocalRot'
ERROR: 0:208: Use of undeclared identifier 'wToLocalRot'
ERROR: 0:221: Use of undeclared identifier 'wToLocalRot'
ERROR: 0:222: Use of undeclared identifier 'rayLs'
ERROR: 0:225: Use of undeclared identifier 'wToLocalRot'
ERROR: 0:229: Use of undeclared identifier 'rayLs'
ERROR: 0:230: Use of undeclared identifier 'rayLs'
ERROR: 0:231: Use of undeclared identifier 'firstPlaneIntersect'
ERROR: 0:231: Use of undeclared identifier 'secondPlaneIntersect'
ERROR: 0:232: Use of undeclared identifier 'furthestPlane'
ERROR: 0:232: Use of undeclared identifier 'furthestPlane'
ERROR: 0:232: Use of undeclared identifier 'furthestPlane'
ERROR: 0:234: Attempt to use 'distance' as a variable
ERROR: 0:235: Use of undeclared identifier 'intersectPositionWs'
I’m thinking that this has something to do with my GLSL version not being the best version, but I don’t know of a way to solve this. Every site that I visited said that I could not update OpenGL(which I assume will also update GLSL) but I cannot do that since “Apple deprecated OpenGL in favor of metal”.
Is there any workaround to this? Or are Mac users unable to use imported models in JMonkey. It could also be my faulty code.
Further information about my GLSL etc.
INFO: OpenGL Renderer Information
* Vendor: Apple
* Renderer: Apple M1
* OpenGL Version: 2.1 Metal - 76.3
* GLSL Version: 1.20
* Profile: Compatibility
INFO: Running on jMonkeyEngine 3.3.0-stable
* Branch: HEAD
* Git Hash: 391e0dc
* Build Date: 2021-04-05
May 17, 2022 12:19:04 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.3 context running on thread jME3 Main
* Graphics Adapter: null
* Driver Version: null
* Scaling Factor: 1
Full error(it’s quite long so I attached a google doc): Full error for imported GLTF Model JMonkeyEngine - Google Docs
Sorry for the long post, previous commenters advised me to provide more information to help you guys. Appreciate your help!