Crash NUM_BONES must be > 0 || <255 (material problem?)

I am getting thrown this error after attaching a spatial to a skeleton attachment node. The code works fine for other spatials, it is only one spatial in particular that the game is crashing, furthermore the spatial that is causing the crash had worked fine previously.

When I look in the material definition template that is being applied to the spatial’s mesh, indeed the number of bones is set to 0, however when I try to use /…/Light/Lighting.jm3 and set the number of bones to 1, then the material doesn’t show up at all, and the spatial is transparent.

Also maybe of note, the spatial looks fine and is textured properly before I “pick it up” (attach it to GUI Node) and all of the attachment process runs without fail, it’s only the update tick after the sword is attached to the bone attachment node that the game crashes.

SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
com.jme3.renderer.RendererException: compile error in: ShaderSource[name=Common/MatDefs/Light/Lighting.vert, defines, type=Vertex, language=GLSL100]
ERROR: 0:158: '' :    NUM_BONES must be between 1 and 255.

	at com.jme3.renderer.opengl.GLRenderer.updateShaderSourceData(GLRenderer.java:1269)
	at com.jme3.renderer.opengl.GLRenderer.updateShaderData(GLRenderer.java:1296)
	at com.jme3.renderer.opengl.GLRenderer.setShader(GLRenderer.java:1360)
	at com.jme3.material.logic.MultiPassLightingLogic.render(MultiPassLightingLogic.java:176)
	at com.jme3.material.Technique.render(Technique.java:166)
	at com.jme3.material.Material.render(Material.java:974)
	at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:614)
	at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:266)
	at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:305)
	at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:877)
	at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:779)
	at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1108)
	at com.jme3.renderer.RenderManager.render(RenderManager.java:1158)
	at com.jme3.app.SimpleApplication.update(SimpleApplication.java:253)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
	at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:197)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:232)
	at java.lang.Thread.run(Thread.java:748)

If there’s any more info you want me to provide please let me know.

Any insight is greatly appreciated!

So, I fixed the problem although I’m not sure what it was…
I fixed it by deleting my character model’s .j3o (which contained the attachment node) and reimporting it from the .blend file. So yeah I must’ve modified the .j3o somewhere? Any ideas how this might play into it?

There were some changes made (I believe between JME 3.1 and JME 3.2) to support models with >255 bones.

there was also a bug where numbone was sent to the attachement node shader with a 0 value. It’s been fixed in master. I even believe it was fixed in 3.1

1 Like