BlendState

Hi i have some problems with the transparancy of an importet .obj.





                BlendState bs = display.getRenderer().createBlendState();
      bs.setBlendEnabled(true);
      bs.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
      bs.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
      bs.setTestEnabled(true);
      bs.setTestFunction(BlendState.TestFunction.GreaterThan);
      bs.setEnabled(true);
      
      
          objectStar.setRenderState(bs);
          objectStar.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);

              rootNode.attachChild(objectStar);



I'm using this in a GameState that extends BasicGameState. From 3 directions the star looks right, from 1 I have a black outline. When i rotate the model, the wrong side rotates too (wrong modeled?).

It looks to me like you have a similar problem to the one in this thread:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=7963.0



Renase sums up the problem near the end, although I think it’s JME1 code.



In short try

  • Adding a zbuffer state with writing disabled. This will stop one part from totally occluding the other.
  • Consider using 4 quads instead of one model. This should allow the depth sorting to work.

Adding a zbuffer state with writing disabled fixed this problem, thx.