Problem with TextureState and AlphaState

Hi



I want to make a net over a gamefield. I have a 3d-model from blender. In jme i make a simple texture over this 3d-Model.



        _netztexture = _renderer.createTextureState();
        _netztexture.setTexture(TextureManager.loadTexture(NetBallTextureManager.class.getClassLoader().getResource(NETZ_TEXTURE), Texture.MM_LINEAR_LINEAR, Texture.MM_LINEAR_LINEAR));
        _netztexture.getTexture().setWrap(Texture.WM_WRAP_S_WRAP_T);
        _netztexture.getTexture().setScale(new Vector3f(2, 2, 2));
        _netztexture.getTexture().setEnvironmentalMapMode(Texture.EM_OBJECT_LINEAR);

        StaticPhysicsNode spielfeldnetz = _physik.createStaticNode();
        converter.setProperty("mtllib", netzurl);
        converter.setProperty("texdir", netzurl);
        streamObjFile = new ByteArrayOutputStream();
        converter.convert(netzurl.openStream(), streamObjFile);
        spielfeldnetzmesh = (TriMesh)BinaryImporter.getInstance().load(new ByteArrayInputStream(streamObjFile.toByteArray()));
        spielfeldnetzmesh.setLocalScale(5);
        spielfeldnetzmesh.setRenderState(_netztexture); // Textur hinzufuegen
   spielfeldnetzmesh.setRenderState(_netztransparenz);    // Transparenz hinzufuegen
        spielfeldnetz.attachChild(spielfeldnetzmesh);
        spielfeldnetz.setLocalTranslation(0, -50, 0);
        spielfeldnetz.generatePhysicsGeometry(true);
        _spielfeld.attachChild(spielfeldnetz);



Then i create an AlphaState for the net.


        _netztransparenz = _renderer.createAlphaState();
        _netztransparenz.setBlendEnabled(true);
        _netztransparenz.setSrcFunction(AlphaState.SB_SRC_ALPHA);
        _netztransparenz.setDstFunction(AlphaState.SB_ONE_MINUS_SRC_ALPHA);
        _netztransparenz.setTestEnabled(true);
        _netztransparenz.setTestFunction(AlphaState.TF_GREATER);



My Problem is, that under the net i have spheres. When i zoom out the gamefield, then i can't see the Spheres. The Texture or the AlphaState isn't correct setup. But what can i do, to make this effect better?

Thanks for your help.

Although I’m a total noob with jME at this point, I’ve noticed that you may be missing a few settings on your texture object (for the net) to allow any geometry underneath from showing. Take a look at the “power-up” example in the alpha state wiki: http://www.jmonkeyengine.com/wiki/doku.php?id=alphastate

It’s basically a sphere underneath a transparent box, I’d say close to what you’re trying to do. Help this helps.