Nifty-GUI drawn behind scene (JME2)


I’m having a peculiar problem.

Nifty-GUI is drawn behind my JME2-scene.

The scene objects are set up to use the opaque/transparent buckets, the skybox uses the skip bucket and the node to which nifty is attached uses the ortho bucket.

My frustum is set up as follows:

DisplaySystem.getDisplaySystem().getRenderer().getCamera().setFrustum(1.0f, 200000f, -0.55f, 0.55f, 0.4125f, -0.4125f);

Any ideas of what could be causing this problem?

Perhaps it’s the JME2-renderer for Nifty that isn’t working as it should?

Has anyone had similar problems using JME2 or JME3?

there has been a similar problem for JME3 few weeks ago

It looked like a frustum problem, but yours seems ok…

maybe you should try to experiment on the frustum

Thanks for the reply!

I’ve read that topic before, but the frustum doesn’t seem to be the problem (I’ve tried a number of different setups).

With a smaller test I find that if you attach anything to the rootNode after you’ve attached the NiftyNode the 3D objects render above Nifty and I can’t seem to get it to render above again.

This is despite the NiftyNode rendering in the ortho bucket and the 3D objects rendering in the opaque/transparent buckets and there being a ZBufferState in the rootNode (with ZBufferState.TestFunction.LessThanOrEqualTo).

It doesn’t seem to help to attach the 3D object to index 0 in the rootNode either.

I’m not quite sure what to do about this, do you have to remove Nifty, then add all 3D objects, then add Nifty back and do this every time a new 3D object is loaded? That seems strange and I hope there is another way.

Hah, I got it to work!

In the smaller test with a sphere and some nifty windows I got the same results as in the larger program, but I was able to make it work correctly by letting the NiftyNode be rendered outside of the rootNode of the scene.

So I tried that in the main program and it didn’t help.

Then I thought it could be related to the GameStates and I tried detaching the GUI when I attach another game state and then reattaching the GUI again and that did the trick!

A bit awkward, but at least now it works.