GLB shader compilation error

isee v3.5.1-stable

but how to intall this version?

the commit seems to be included since 3.4.0-alpha1
i dont use the SDK but i would guess you can replace the corresponding jars
if you switch to gradle you can just update the dependencies
can you show the output “OpenGL Renderer Information” when you start the app?
You dont strictly NEED the above commit because your graphics card should support the inverse function as well as the mat3 constructor, but the renderer seems to want to use an older version, do you use appSettings.setRenderer(…) ?

maybe appSettings.setRenderer(AppSettings.LWJGL_OPENGL3) is worth a shot, it should create a 3.2 core profile and then use the 150 version which will include the inverse and mat3 constructor)

i am not using setRenderer
how to use it correctly? example please

what libraries to replace and where?
my porject libs

engine folders

It’s been a long time since i did it like that so I might be wrong. “sources” are the sources so that you can open them with Control + left click on some object in the SDK and see the source code. “libs” are what you need to run your application.
Copy your project somewhere so you have a backup.
Download the version that you want to use, replace the .jars in the “lib” folder with you new jars. In case the download includes jme3-xxx-sources.jar files (i dont know, maybe you can download them separately) place them in the “sources” folder.
It is way easier using gradle

somewhere you probably have a main(String[] args) method that does something like

MyApplication app = new MyApplication();
AppSettings settings = new AppSettings(true);
...
app.setSettings(settings);
app.start();

or similar. simply add

settings.setRenderer(AppSettings.LWJGL_OPENGL3)

again the output of your application, where it says “OpenGL Renderer Information” would be interesting

ant -f /home/ivan/CastleClient -Dnb.internal.action.name=run run
init:
Deleting: /home/ivan/CastleClient/build/built-jar.properties
deps-jar:
Updating property file: /home/ivan/CastleClient/build/built-jar.properties
compile:
run:
мар. 27, 2022 10:54:12 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.3.0-stable

  • Branch: HEAD
  • Git Hash: 391e0dc
  • Build Date: 2021-04-05
    мар. 27, 2022 10:54:12 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
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by com.jme3.util.ReflectionAllocator (file:/usr/local/jmonkeyplatform/jmonkeyplatform/libs/jme3-core-3.3.0-stable.jar) to method sun.nio.ch.DirectBuffer.cleaner()
    WARNING: Please consider reporting this to the maintainers of com.jme3.util.ReflectionAllocator
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    мар. 27, 2022 10:54:12 PM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
    INFO: OpenGL Renderer Information
  • Vendor: Intel
  • Renderer: Mesa Intel(R) HD Graphics 2000 (SNB GT1)
  • OpenGL Version: 3.3 (Core Profile) Mesa 22.0.0 - kisak-mesa PPA
  • GLSL Version: 3.30
  • Profile: Core
    мар. 27, 2022 10:54:12 PM com.jme3.asset.AssetConfig loadText
    WARNING: Cannot find loader com.jme3.scene.plugins.blender.BlenderModelLoader
    мар. 27, 2022 10:54:12 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
    INFO: Audio Renderer Information
  • Device: OpenAL Soft
  • Vendor: OpenAL Community
  • Renderer: OpenAL Soft
  • Version: 1.1 ALSOFT 1.15.1
  • Supported channels: 64
  • ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_loopback
  • AL extensions: AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency
    мар. 27, 2022 10:54:12 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
    WARNING: Pausing audio device not supported.
    мар. 27, 2022 10:54:12 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
    INFO: Audio effect extension version: 1.0
    мар. 27, 2022 10:54:12 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
    INFO: Audio max auxiliary sends: 4
    SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.
    SLF4J: Defaulting to no-operation (NOP) logger implementation
    SLF4J: See SLF4J Error Codes for further details.
1 Like

I create gradle project
how to update libraries with gradle?

1 Like

In the dependencies section of your build script (“build.gradle” or “common.gradle” depending on the type of project) there will be entries for “jme3-core” and other libraries with names beginning with “jme3-”. Usually that’s where the versions are specified.

For instance, if your script has

dependencies { 
    implementation 'org.jmonkeyengine:jme3-core:3.3.0-stable'
}

then change it to

dependencies { 
    implementation 'org.jmonkeyengine:jme3-core:3.5.1-stable'
}

Sometime buildscripts have the JMonkeyEngine version in a variable like so:

dependencies {
    compile 'org.jmonkeyengine:jme3-core:' + jme3Version
    runtimeOnly "org.jmonkeyengine:jme3-desktop:${jme3Version}"
}

in which case you find where the jme3Version variable is set and change it there.

i update dependecies

plugins {
    id 'java'
    id 'application'
}

group 'com.mygame'
version '1.0'

sourceCompatibility = 1.8
mainClassName = "com.mygame.Main"

repositories {
    jcenter()
}

project.ext {
  jmeVer = '3.5.1-stable'
}

project(":assets") {
    apply plugin: "java"

    buildDir = rootProject.file("build/assets")

    sourceSets {
        main {
            resources {
                srcDir '.'
            }
        }
    }
}

dependencies {

  implementation "org.jmonkeyengine:jme3-core:$jmeVer"
  implementation "org.jmonkeyengine:jme3-desktop:$jmeVer"
  implementation "org.jmonkeyengine:jme3-lwjgl:$jmeVer"
  
}

jar {
    manifest {
        attributes 'Main-Class': "$mainClassName"
    }
}

now i have error:

SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
com.jme3.asset.AssetNotFoundException: /Models/main_scene.glb
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:385)
	at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:439)
	at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:444)
	at com.mygame.Main.simpleInitApp(Main.java:21)
	at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:240)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:139)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:221)
	at java.base/java.lang.Thread.run(Thread.java:834)
1 Like

1 Like

Before invoking loadModel(), either:

  1. tell JMonkeyEngine’s AssetManager to look in the “./assets” folder or else
  2. copy the “main_scene.glb” file to one of the locations where AssetManager looks, such as the classpath.

Taking the first approach:

     assetManager.registerLocator("./assets", FileLocator.class);
     Spatial mainScene = assetManager.loadModel("Models/main_scene.glb");

Attempting answer your next question, in order for JMonkeyEngine to load models in the non-native “GLB” format, you’ll need to add the “jme3-plugins” library to your “build.gradle” build script:

  implementation "org.jmonkeyengine:jme3-lwjgl:$jmeVer"
  implementation "org.jmonkeyengine:jme3-plugins:$jmeVer"

FileLocator doe’s not exists
can’t import for this file

My gradle file

plugins {
    id 'java'
    id 'application'
}

group 'com.mygame'
version '1.0'

sourceCompatibility = 1.8
mainClassName = "com.mygame.Main"

repositories {
    jcenter()
}

project.ext {
  jmeVer = '3.5.1-stable'
}

project(":assets") {
    apply plugin: "java"
    
    buildDir = rootProject.file("build/assets")

    sourceSets {
        main {
            resources {
                srcDir '.'
            }
        }
    }
}

dependencies {

  implementation "org.jmonkeyengine:jme3-core:$jmeVer"
  implementation "org.jmonkeyengine:jme3-desktop:$jmeVer"
  implementation "org.jmonkeyengine:jme3-lwjgl:$jmeVer"
  
  implementation "org.jmonkeyengine:jme3-plugins:$jmeVer"
    
}

jar {
    manifest {
        attributes 'Main-Class': "$mainClassName"
    }
}

if i add string implementation “org.jmonkeyengine:jme3-plugins:$jmeVer”
in my main class import stops working (dos not exists packages)

1 Like

Model load without errors
but invisible

in blender
6
in jmonkey black screen

1 Like

Did you add a light to your scene?

…you will also need a light probe for PBR materials or the ambient lighting will look dark. (You can either generate one or use a standard one.)

1 Like
 public void simpleInitApp() {
       assetManager.registerLocator("./assets", FileLocator.class);
       Spatial mainScene = assetManager.loadModel("Models/main_scene.glb");
       rootNode.attachChild(mainScene);  
       
       DirectionalLight sun = new DirectionalLight();
        sun.setColor(ColorRGBA.White);
        sun.setDirection(new Vector3f(-.5f,-.5f,-.5f).normalizeLocal());
        rootNode.addLight(sun);
    }

i add ligth but model invisible

can you test my glb model?

I dont have time to look into it but from what i remember

and

should result in version 150 being used, shouldnt it?

import com.jme3.asset.plugins.FileLocator;

Next thing to check is if the model is so huge that the camera starts inside of it.

Easiest way might be to print the world bound of the model.
System.out.println(mainScene.getWorldBound());

BoundingBox [Center: (-0.33333334, 0.51925063, 0.0) xExtent: 0.6666666 yExtent: 0.51925063 zExtent: 1.0]

flyCam.setEnabled(true);

in blender:


in jmonkey

why is the side wall black?

Hard to say… as mentioned before, ambient light will be messed up without a light probe so if that wall is not facing the light then it will be black.

It’s weird because you shouldn’t have to do that unless you disabled it before.