Aka Can I have a 3d scene that is in front of the main scene without it being clipped.
Aka The front of my weapon keeps getting hidden by the scene in my game
Situation
I have a 3d scene, rendered by JMonkey, and additionally have 3d weapons held by the player. Additionally the player may stand so close to walls that they may (if treated realistically) stick the end of their gun through the wall. This means that if the gun is placed "by dead reckoning" in the scene so it looks right the end of the gun gets clipped off and looks stupid.
Because this is a 3d object (that may be rotated or moved) I can't just use a 2d image and put it in the gui layer
Create an additional camera and view port to support these additional graphics
In JMonkeyEngine its possible to have more than one viewport and layer them on top of each other to provide the described effect. Each viewport is internally 3d, but the view ports themselves layer over the top of each other.
Code example
Main class to get things set up
An UnderGui layer, that has a 3d scene between the gui layer and the main 3d scene
This can also be used for any "ability to see through walls" overlay
Alternative bad solution; setDepthTest
You can also just put the weapon in the main scene and set
geometry.getMaterial().getAdditionalRenderState().setDepthTest(false);. However this is a less good option because it requires the weapon to constantly be moved as the camera changes position and direction and can only cope with "simple" 3D overlays as if 1 part of the weapon is in front of another part (e.g. the stock is in front of the trigger) which bit is rendered is random, as you've asked JME not to do any depth testing