So, ATM I’m focusing on designing the GUI for my strategy game, and I decided to mix Nifty GUI and vanilla guiNode. I load 3D models on guiNode and place them on top of the Nifty GUI’s panels to “kinda” merge the two. I know I can do it in another way (I think it’s related to FrameBuffers), but I want to try and see if it works well for me.
The problem is, when loading the model, weird stuff happens (don’t worry about the position of the models):
I know that this is happening due to using Hardware Skinning, instead of Software Skinning. I think Blender didn’t export correctly or something, but that is an issue that I’ll fix later. For now, I set the models to use Software Skinning.
However, in the guiNode, it seems it’s not working, even if I’m setting that option on the SceneExplorer. So to make the model look normal, I have to manually change the skinning method in the code. Doing that fixes the model’s look:
But that is just part of the problem. When I rotate the model, I realise it’s depth is not being calculated, as if DepthWrite was deactivated (which is not):
I try and fix this the same way I fixed the Hardware Skinning problem:
public static void enableDepthWrite(Spatial spat) {
if(spat instanceof Node) {
Node n = (Node)spat;
for(Spatial s : n.getChildren()) {
enableDepthWrite(s);
}
} else if(spat instanceof Geometry) {
Geometry g = (Geometry)spat;
g.getMaterial().getAdditionalRenderState().setDepthWrite(true);
g.getMaterial().getAdditionalRenderState().setDepthTest(true);
}
}
But it doesn’t work. I recall a long time ago loading 3D models on the GUI and I never have had this issue before. Did any of this happen to you? How do I fix it?
Thanks,
Ev1lbl0w