I’ve been doing some work on the HUD for my game, and everything works fine when I use “flat” nodes in the hud - that is, when everything I want to display has no “depth” in the Z axis. Quads with no Z translation work, but if they are translated in the Z axis they disappear. A Sphere is invisible, unless I show polygons, in which case I see a ring which looks like the cross section of the Z=0 plane and the sphere.
Here’s a screenshot of a section of the HUD which should have a quad, a sphere and a rotated open ended cylinder (in polygon render mode):
You can see the quad in the center, which is fine, but the sphere becomes a circle, and the cylinder becomes two lines where it intersects Z=0. The stuff in the bottom right is just a non-hud mesh.
The hud node is just attached to my root node, and set up with the following code:
//Create alpha state to blend using alpha
AlphaState as = display.getRenderer().createAlphaState();
as.setBlendEnabled(true);
as.setSrcFunction(AlphaState.SB_SRC_ALPHA);
as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);
as.setTestEnabled(false);
as.setEnabled(true);
//Create disabled light state, hud nodes will be displayed
//as unlit colour
LightState ls = display.getRenderer().createLightState();
ls.setEnabled(false);
setRenderState(as);
setRenderState(ls);
//Node uses ortho rendering
setRenderQueueMode(Renderer.QUEUE_ORTHO);
//Never cull hud items
setCullMode(Spatial.CULL_NEVER);
Does anyone have any ideas as to how I can display orthographically projected 3D meshes in a HUD? I want to use it for stuff like dials, etc. (the old-style ones made from a rotating cylinder with numbers printed around the outside, spinning around the X axis of the screen).
(Edit) I just tried scaling the sphere/mesh and if they have very low scale in the Z axis they are visible.