jMonkeyEngine / jmonkeyengine

A complete 3-D game development suite written in Java.
http://jmonkeyengine.org
BSD 3-Clause "New" or "Revised" License
3.78k stars 1.12k forks source link

IllegalArgumentException while loading GLTF model #2136

Closed stephengold closed 10 months ago

stephengold commented 10 months ago

When I try to load the "CesiumMan" model using TestGltfLoading, I get an exception:

Oct 28, 2023 6:55:20 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.7.0-SNAPSHOT
 * Branch: master
 * Git Hash: b86310b
 * Build Date: 2023-10-28
Oct 28, 2023 6:55:21 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.5 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:/home/sgold/NetBeansProjects/jmonkeyengine/jme3-core/build/libs/jme3-core-3.7.0-SNAPSHOT.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
Oct 28, 2023 6:55:21 PM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
 * Vendor: NVIDIA Corporation
 * Renderer: GeForce GT 545/PCIe/SSE2
 * OpenGL Version: 3.2.0 NVIDIA 390.157
 * GLSL Version: 1.50 NVIDIA via Cg compiler
 * Profile: Core
Oct 28, 2023 6:55:21 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
Oct 28, 2023 6:55:21 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
WARNING: Pausing audio device not supported.
Oct 28, 2023 6:55:21 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio effect extension version: 1.0
Oct 28, 2023 6:55:21 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio max auxiliary sends: 4
Oct 28, 2023 6:55:21 PM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
com.jme3.asset.AssetLoadException: An error occurred loading CesiumMan/glTF/CesiumMan.gltf
    at com.jme3.scene.plugins.gltf.GltfLoader.loadFromStream(GltfLoader.java:181)
    at com.jme3.scene.plugins.gltf.GltfLoader.load(GltfLoader.java:107)
    at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:274)
    at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:390)
    at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:441)
    at jme3test.model.TestGltfLoading.loadModel(TestGltfLoading.java:234)
    at jme3test.model.TestGltfLoading.loadModel(TestGltfLoading.java:229)
    at jme3test.model.TestGltfLoading.simpleInitApp(TestGltfLoading.java:146)
    at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:240)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:142)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:224)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalArgumentException: Material parameter is not defined: alpha
    at com.jme3.material.Material.checkSetParam(Material.java:474)
    at com.jme3.material.Material.setParam(Material.java:490)
    at com.jme3.scene.plugins.gltf.MaterialAdapter.setParam(MaterialAdapter.java:106)
    at com.jme3.scene.plugins.gltf.GltfLoader.readMaterial(GltfLoader.java:660)
    at com.jme3.scene.plugins.gltf.GltfLoader.readMeshPrimitives(GltfLoader.java:473)
    at com.jme3.scene.plugins.gltf.GltfLoader.readNode(GltfLoader.java:252)
    at com.jme3.scene.plugins.gltf.GltfLoader.readChild(GltfLoader.java:301)
    at com.jme3.scene.plugins.gltf.GltfLoader.readChild(GltfLoader.java:309)
    at com.jme3.scene.plugins.gltf.GltfLoader.readChild(GltfLoader.java:309)
    at com.jme3.scene.plugins.gltf.GltfLoader.readScenes(GltfLoader.java:218)
    at com.jme3.scene.plugins.gltf.GltfLoader.loadFromStream(GltfLoader.java:155)
    ... 11 more

I have reason to believe this is a recent regression. I'll attempt to pin it down.

stephengold commented 10 months ago

The regression appears to be caused by PR #2084. @codex128 could you please take a look?

tonihele commented 10 months ago

Looks easy enough. I can take this. I'm already tampering with the model loading...

stephengold commented 10 months ago

Thanks, @tonihele.