Error when using 3D GLTF model(On MacOS X)

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();
// ignore variable naming
protected createRifle(){
   // Create spatial
  Spatial checkpoint = assetManager.loadModel("Models/m16_assault_rifle/scene.j3o");

  // 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));
  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! :slight_smile:

1 Like

Hi there, opg!

I am a noob here but thought I might try to help you out a bit anyway –
I tried running your code but I got a lot of red errors and wasn’t sure exactly how you had it set up. If you feel like it you could try this stuff and see if you run into problems.

Set this up in a basic game project and replace my mace file with your gun file and see if you can get it to load? I am not sure what your goals are with the gun, if you are trying to put it on the ground or put it in a hand or if you’re just trying to get it to load in a scene. I would work backwards or start with the most simple and just see if you can get it loaded into a scene and then start adding stuff and see when/if you run into something. This should get you loaded in a scene!

package mygame;

import com.jme3.light.DirectionalLight;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;

public class Main extends SimpleApplication {
    //set your weapon up here
    private Spatial mace;

    public static void main(String[] args) {
        Main app = new Main();

    public void simpleInitApp() {
        //add some light!
        DirectionalLight sun = new DirectionalLight();
        sun.setDirection(new Vector3f(-.5f,-.5f,-.5f).normalizeLocal());
        // Load mace! (or gun)
    mace = assetManager.loadModel("Models/mace.j3o");

The MacOS support was improved in the latest releases of the engine, last one being; Release jMonkeyEngine 3.5.2-stable · jMonkeyEngine/jmonkeyengine · GitHub

You can use it with gradle in your favorite editor (see Maven Artifacts :: jMonkeyEngine Docs note: you should use jme3-lwjgl3 for apple m1 ).

Your specific error was patched by this commit

but your version of the SDK seems to be based on an older release.

Pinging @SDK_Developers to see if they can point you to a newer version or give a workaround.

1 Like

Gradle is the workaround. The latest SDK offers you the Gradle basic game template. That is the easiest way to get newer engine versions in use to your project. It is also really the best way to handle any type of project anyway.

We are in the process of creating new SDK releases. But there is no dates set for that.