jMonkeyEngine / jMonkeyEngine/jmonkeyengine
ArrayIndexOutOfBoundsException when software skinning an imported glTF
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 14
Description
In current "master" branch, loading a model from https://github.com/capdevon/sharefile/blob/main/RPM_RandomAvatar.glb :
Mar 29, 2024 12:39:27 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.8.0-SNAPSHOT
* Branch: master
* Git Hash: 9452078
* Build Date: 2024-03-29
Mar 29, 2024 12:39:27 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.8.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
Mar 29, 2024 12:39:27 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
Mar 29, 2024 12:39:28 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
Mar 29, 2024 12:39:28 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
WARNING: Pausing audio device not supported.
Mar 29, 2024 12:39:28 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio effect extension version: 1.0
Mar 29, 2024 12:39:28 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio max auxiliary sends: 4
Mar 29, 2024 12:39:30 PM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.ArrayIndexOutOfBoundsException: Index 67 out of bounds for length 67
at com.jme3.anim.SkinningControl.applySkinningTangents(SkinningControl.java:659)
at com.jme3.anim.SkinningControl.softwareSkinUpdate(SkinningControl.java:453)
at com.jme3.anim.SkinningControl.controlRenderSoftware(SkinningControl.java:264)
at com.jme3.anim.SkinningControl.controlRender(SkinningControl.java:304)
at com.jme3.scene.control.AbstractControl.render(AbstractControl.java:126)
at com.jme3.scene.Spatial.runControlRender(Spatial.java:763)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:809)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:819)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:819)
at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:793)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1210)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1292)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:283)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:163)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:225)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:245)
at java.base/java.lang.Thread.run(Thread.java:829)
Here's the essence of the test app:
public void simpleInitApp() {
Spatial model = assetManager.loadModel("RPM_RandomAvatar.glb");
rootNode.attachChild(model);
Spatial child = ((Node) model).getChild(0);
SkinningControl skinningControl
= child.getControl(SkinningControl.class);
skinningControl.setHardwareSkinningPreferred(false);
}
A runtime check could easily be added to SkinningControl, like so:
int index = ib.get(idxWeights++);
if (index < 0 || index >= offsetMatrices.length) {
continue;
}
Matrix4f mat = offsetMatrices[index];
However, it would be even better for jme3-plugins to detect the out-of-range bone index while importing the model.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with SkinningControl.java, especially applySkinningTangents() and softwareSkinUpdate(), using the reported glTF model and test application to reproduce the out-of-range bone index. Check the jme3-plugins import path for where bone indices are handled. Done means software skinning no longer throws for this model, with invalid indices handled safely or rejected during import.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100