Clouds versus blending

Hello,



Having some difficulty here. I have a greyscale cloud texture that I am trying to apply to a quad, but I don’t seem to have the blending quite right (see screenshot):







Code is here:


      Quad newQuad = new Quad("test", 1000, 1000);
      newQuad.setLocalTranslation(20, 100, 20);
       
        Texture tex = TextureManager.loadTexture(imageBuf,
                Texture.MinificationFilter.BilinearNearestMipMap,
                Texture.MagnificationFilter.Bilinear, 1, false);
         TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
        ts.setTexture(tex);
       
        BlendState as = DisplaySystem.getDisplaySystem().getRenderer().createBlendState();
      as.setBlendEnabled(true);
      as.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
      as.setDestinationFunction(BlendState.DestinationFunction.One);
      as.setTestEnabled(true);
      as.setTestFunction(BlendState.TestFunction.GreaterThan);
      
      newQuad.setRenderState(ts);
      newQuad.setRenderState(as);
      newQuad.updateRenderState();
      World.rootNode.attachChild(newQuad);
      World.rootNode.updateRenderState();



So what am I doing wrong? Do I also need to be using a materialstate?

-Prime


Well, I'm not the most experienced in these graphical matters, but shouldn't


as.setDestinationFunction(BlendState.DestinationFunction.One);


be

as.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);

?

It seems more logical to me.
Perhaps you could try that.

You can also use Scene Monitor to try out settings.

Figured it out - setRenderQueueMode(Renderer.QUEUE_TRANSPARENT)



Thanks for the info, and Scene Monitor looks like exactly what I need :slight_smile:



-Prime