Hi, simple Question:
Is it possible to draw multiple textured quads at the same z position ?
I work on a 3d GUI. I use SimpleGame so the standard ZBUfferState is LessThenOrEqualTo…
My problem is that the quads are rendered very strange at the overlapping sections.
My first gui version worked with a multitexture solution but the performance was very ulgy…
Chris
To specify my problem:
Node n = new Node("gui test");
GraphicsTool.createZBufferState(n, ZBufferState.TestFunction.Always);
Quad q = new Quad("f", 10, 10);
q.setRenderState(GraphicsTool.createTextureState(TextureManager.loadTexture(new File("res/sonnenuntergang.jpg").toURI().toURL())));
n.attachChild(q);
Quad q2 = new Quad("f", 10, 10);
q2.getLocalTranslation().x = 5;
q2.setRenderState(GraphicsTool.createTextureState(TextureManager.loadTexture(new File("res/window.png").toURI().toURL())));
n.attachChild(q2);
n.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);
n.setModelBound(new BoundingBox());
n.updateModelBound();
rootNode.attachChild(n);
Sphere s = new Sphere("tt", 20, 20, 1);
s.setModelBound(new BoundingBox());
s.updateModelBound();
s.getLocalTranslation().z = 20;
rootNode.attachChild(s);
The problem is that the quads are drawn over the Sphere, which makes sense, because the QUEUE_TRANSPARENT is drawn at last... How can i solve my problem ?
The Quads must be at the same z position!
Chris
The problem is solved using the setPolygonOffset function.
But i think there is still the need for a ZBufferState, could someome help to make the transparency work ?
Which ZBufferState do i have to use ?
Chris
Is the ZBuffer addicted to the rotation of the camera ?
If i rotate the view the depth of the quads will change…
I use now the setPolygonOffset function to define the depth. But the function seems to be useless with objects in the transparent queue …
How can i solve that problem ?
Please help me! It's definitly not such a hard problem for an jme insider…
Greetings,
Chris
Hi,
its me again!
I solved every problem…
Now i use a RenderPass system to draw the items. Now everything runs great.
I think the problem was that the depth order ,setted by setPolygonOffset, is useless for the QUEUE_TRANSPARENT mode. Now i use the RenderPass system and draw the transparent items at the end.
For transparent objects i disabled the writeable option of the ZBufferState.
Chris