The background that you see is supposed to extend all the way to the bottom, but I made it half so you can see what I am talking about. You can see how the GUI is not covered, but for some reason the model is.
I’ve created the panel like this:
QuadBackgroundComponent fullbg = new QuadBackgroundComponent(assetManager.loadTexture("Textures/inflicted.png"));
Panel bgWindow = new Panel(width,height/1.5f, ColorRGBA.Blue);
bgWindow.setLocalTranslation(0f, (float) height, -20);
That’s because JME’s GUI ViewPort is in front of the 3D ViewPort. So it will always be drawn on top.
If you need 3D objects in front of 2D UI then you can try placing a 2D ViewPort behind the regular scene, or more commonly place a 3D ViewPort in front of the GUI ViewPort.
It’s not really a Lemur-specific issue as this would affect anything in the guiNode/gui ViewPort. Once you get your ViewPorts sorted out then things should work.
Note: managing a custom view port requires some extra stuff since you’ll have to call updateLogicalState() and updateGeometricState() yourself on the ViewPort’s root(s). An AppState is the best way to handle this and there have been several examples on the forum before.
Edit: and also note, if you need Lemur’s picking in the new ViewPort there is an easy method on GuiGlobals (I think) to add new viewports and/or root nodes. If it’s not there then it’s on the MouseEventState.
Awesome, that got me pretty far. For now, I just did a “hack” by attaching the 3d model to the guiNode and scaling it differently. However, now it is semi-transparent in some sense. Like, parts they shouldn’t be seen are seen:
I’m now trying to create a new 3d viewport to put over the gui layer, but I’m struggling:
Camera cam2 = cam.clone();
ViewPort top3d = renderManager.createMainView("top 3d layer", cam2);
I’m having real difficulty finding documentation for adding viewports. From what I gathered, I add a camera and then create a viewport using that camera. But how do I ensure that this 3d viewport is over the GUI? Where is the “order” of the layers determined?