TriMeshs get hidden but they should not

I searched the forums, but found no entry that would solve my question. I am having problems with displaying objects.



I have a position, where the objects behave like they should (the nearest hides the ones behind). If i turn the camera around the objects and make the farest the nearest, then it does not hide the ones behind.

For better understanding watch the pictures attached. I tried to used CullState but it did not work for any adjust i made.





how can i solve this problem?


starting point turned 180°

Looks like you are need a ZBufferState with the test set to <=


        ZBufferState zb = renderer.createZBufferState();
        zb.setFunction(ZBufferState.CF_LEQUAL);
        zb.setEnabled(true);
        rootNode.setRenderState(zb);



Unfortunately this snippet did not solve the problem. It looks still as on the images above. Maybe it helps to name the renderstates my rootNode (and the attached cityNode) have.


rootNode:
- zbuf state as described above
- nothing more

cityNode:
- alphastate enabled (Blend enabled, SB_SRC_ALPHA to DB_ONE_MINUS_SRC_ALPHA, no test)


thats all.

have you updated the render states?

sure, i did.





edit: oops, i found the problem. One time i had a zBuffer test in a method and i just forgot to delete it. I commented it out and now it works.



Thanks.

Okay, i have one more problem, that's kinda similar to the first one.



I have meshes that are from one side transparent, but not from the other side. How can i solve this?

i have a rootNode and a cityNode attached to it and the following states attached:



cityNode:

  • Alphastate(blend enable, test enable, test function TF_GREATER, src funtion SB_SRC_ALPHA, dst_function, DB_ONE_MINUS_SRC_ALPHA, alphastate enabled)
  • RenderQueueMode(QUEUE_SKIP)
  • ZBufferState(function CF_LEQUAL, zubufferstate enabled)
  • setCullMode(SceneElement.CULL_DYNAMIC)
  • setLightCombineMode(LightState.REPLACE)



    rootNode:
  • CullState(CullState.CS_BACK)





    The TriMeshs are attached to the citynode and thus use the alphastate of citynode. they get a materialstate with ambient color set to different values of blue (alpha set to 0.75f) and diffuse color of (.5f, .5f, .5f, .5f). materialstate  is enabled and updated.





    thank in advance for you help and solution suggestions




wathing from front watching from the side

Did you try putting the geometry into the transparent queue?



Node.setRenderQueueMode( Renderer.QUEUE_TRANSPARENT );

okay, that helped for this problem, but the next is coming with this change:



objects "flicker" when turning around the camera … maybe a screenshot can help describing it … sometimes the shapes and colors are clearly printed, sometimes they are not.




any suggestions to solve the problem above? i hope this will be my last qeustion.

hmm, it might be z-fighting…



are your buildings 'right' next to each other?  if so try nudging them apart just a bit, or playing with the z-offset (hint: if you use the z-offset make a new pass by extending renderPass).

Okay, it helped for me to put those meshes a little bit away from each other, but there is one problem left. thing disappear but they should not at this point - seems to be a thing of zBuffer or of cullstate/mode


starting point moved cam position some ticks down (blue trimeshs should still be in foreground)

Does it help at all to toggle two sided transparency in the RenderQueue?

how did you draw this coordinate plane? can you give me a hint?

Seems like a sorting issue, transparent objects are rendered back-to-front. The green boxes are large so sometimes the box will be closer to the camera than the object but the distance to the center will be farther.

Ah, before you start wondering what i want to do with a teapot, a pyramid, a torus etc… it's just an easy example - I'm having the same problem in a more complex scene (3D-car model…)  :lol:



Any idea - if it's an sorting issue - how to fix this prob? ://

To the jME guys: I know a lot of what is going on here is a classic problem with all 3D development. I found some really interesting articles on the nvidia site about Depth Peeling in order to resolve it (just google for it). I'm not sure you'd want to implement something like that though, as it can be very costly to performance.

also things suddenly disappear, if they don't have a BoundingBox or the bounding is somehow wrongly scaled or something like that. (press 'b' in simplegame)