Does anyone know how to solve this issue? I’ve never had this happen in JME 3.0.
java.lang.UnsupportedOperationException: Material instances cannot be shared when hardware skinning is used. Ensure all models use unique material instances.
at com.jme3.animation.SkeletonControl.controlRenderHardware(SkeletonControl.java:258)
at com.jme3.animation.SkeletonControl.controlRender(SkeletonControl.java:299)
at com.jme3.scene.control.AbstractControl.render(AbstractControl.java:135)
at com.jme3.scene.Spatial.runControlRender(Spatial.java:756)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:723)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:733)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:733)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:733)
at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:712)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1086)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1145)
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:193)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:232)
at java.lang.Thread.run(Unknown Source)
I don’t think I can: the stack trace does not display a single class of mine for some reason. As I’ve mentioned in the original post, this hasn’t occured in JME 3.0.
This is because you to clone materials for different spatials.
EXAMPLE:
Material mat0=new Material();
geom0.setMaterial(mat0);
geom1.setMaterial(mat0.clone()) //if you don’t clone() the material and you’re using hardware skinning,application crashes.
The reason is that JME 3.0 didn’t automatically enable hardware skinning.
You can continue by disabling Hardware Skinning but the Perfomance will suck.
Btw: There, where you call spatial.clone() is an overloaded method where you can specify a boolean called alsoCloneMaterial or something.
Even though I’ve gone through every class containing animated spatials and made sure to enter basically this method “mesh.setMaterial(mat.clone())” the app still crashed throwing the same exception.