How can I make the translator seen?

How come I can see through the object in the SceneEditorDemo.java in this tutorial…



http://www.jmonkeyengine.com/wiki/doku.php/scene_editor_course_and_programming_guide



while whenever I create myself a replica of it… even with the selectedObject.setLightCombineMode(LightCombineMode.Off);



it still looks like this…





instead of this…





please help…

Try changing the order of the nodes.  If, for example, you had:



rootNode.add(translatorGizmo);
rootNode.add(myBox);



change that to:


rootNode.add(myBox);
rootNode.add(translatorGizmo);

thanks for the quickie reply again sbook… anyway, I thought you might say that… but the translationNode is already on top of the order… what I thought was it was a problem on lights and renderstates, or I might be wrong… I dunno what to do

Have you looked into applying a ZBufferState to the axis rods? E.g. draw the axis rods last, and have a zbufferstate with a test function set to always?

actually I noticed that piece of code was unfamiliar… but when I tried to implement that ZBufferState to my translationNode… It didn’t show itself, its as if it didn’t render at all…



edit:



I tried adding this piece of code here… unfortunately… it doesn’t help me either


ZBufferState zbuffer = DisplaySystem.getDisplaySystem().getRenderer().createZBufferState();
   zbuffer.setEnabled(true);
   zbuffer.setFunction(ZBufferState.TestFunction.Always);// ersetzt immer jeden Pixel!
   translationNode.setRenderState(zbuffer);
   translationNode.setRenderQueueMode(Renderer.QUEUE_OPAQUE);

mhelz0001 said:

actually I noticed that piece of code was unfamiliar.... but when I tried to implement that ZBufferState to my translationNode... It didn't show itself, its as if it didn't render at all...

edit:

I tried adding this piece of code here... unfortunately... it doesn't help me either

ZBufferState zbuffer = DisplaySystem.getDisplaySystem().getRenderer().createZBufferState();
   zbuffer.setEnabled(true);
   zbuffer.setFunction(ZBufferState.TestFunction.Always);// ersetzt immer jeden Pixel!
   translationNode.setRenderState(zbuffer);
   translationNode.setRenderQueueMode(Renderer.QUEUE_OPAQUE);




What does the node hierarchy look like? E.g.

+ translationNode
|_
  |--AxisRods
  |--Box

Because you'd probably want to set the zbufferstate solely to the axis rods, and not the box/whatever the mesh is. Plus the order would still matter here (if it looks like above, then switch the ordering like sbook mentioned).

here is my objects hierarchy…



+root

  | +translationNode

  |  |- xArrow

  |  |- yArrow

  |  |- zArrow

  |- Box



the Box was rendered first… and then the translationNode was attached next…

bump



I still have this problem so I'm bumping in to it :wink:

As Starnick said, it has to do with the ZBufferstate.

Try to play with different values, maybe disable it for the axis rods.


That should have the same effect if I’m not mistaken. Anyways, in this case order matters a whole lot. If you draw the rods first (that hierarchy looks like it will - if you’re going from the first child to the last top-down), unless if you modify how your box is drawn, it’ll be drawn over it since the rods are inside the box.



It would really help if the RenderQueue had maybe a post-draw bucket, but you can use the transparent renderqueue bucket for this - since all opaque objects are drawn first then the transparent ones, so it’s essentially what I was looking for (not sure how this may play with transparent objects though). So regardless of your spatial order, if the mesh is opaque, it’ll be drawn first then the rods and depending on the zbufferstate, it’ll be drawn ontop of it!








        Box b=new Box("My box",new Vector3f(0,0,0),new Vector3f(10,10,10));
        b.setModelBound(new BoundingBox());
        b.updateModelBound();
        
        AxisRods rods = new AxisRods("rods", true, 10,1);
        rods.setLocalTranslation(5,0,5);
        ZBufferState zbuf = DisplaySystem.getDisplaySystem().getRenderer().createZBufferState();
        zbuf.setEnabled(true); //Can be on/off, doesn't really matter
        zbuf.setWritable(true);
        zbuf.setFunction(TestFunction.Always); //If enabled, should be always
        rods.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);
        rootNode.attachChild(b);
        rootNode.attachChild(rods);
        rods.setRenderState(zbuf);


thanks StarNick… that did it!!!.. it was the ZBufferState and  RenderQeueMode that fixed it… i was reading on it on the wiki just last day and tried to set a couple of values but couldn't get the hang of it… now with your it worked… thanks a lot!!!

mhelz0001 said:

thanks StarNick... that did it!!!... it was the ZBufferState and  RenderQeueMode that fixed it... i was reading on it on the wiki just last day and tried to set a couple of values but couldn't get the hang of it.... now with your it worked... thanks a lot!!!


If you can make the wiki guide that you were following any clearer where you got stuck I'm sure those following in your footsteps would be grateful :D

Glad you got your problem solved!