Box – Transparent Texture Problem

Hey guys, :slight_smile:



+++The original problem of this topic is already solved - It was an issue when generating a mesh+++



Anyway, I’ve still got the test case for this problem, in which the cube has these “black holes”:

http://img7.imagebanana.com/img/78indyrc/jME3BoxTextureIssue.jpg



This is the code:

[java]package mygame;

import com.jme3.app.SimpleApplication;

import com.jme3.light.AmbientLight;

import com.jme3.material.Material;

import com.jme3.math.ColorRGBA;

import com.jme3.renderer.queue.RenderQueue.Bucket;

import com.jme3.scene.Geometry;

import com.jme3.scene.shape.Box;

import com.jme3.texture.Texture;

public class TextureTest extends SimpleApplication {

public static void main(String[] args){

TextureTest app = new TextureTest();

app.start();

}

@Override

public void simpleInitApp() {

viewPort.setBackgroundColor(ColorRGBA.White);

Box boxMesh = new Box(2, 2, 2);

Geometry box = new Geometry(“TheBox”, boxMesh);

Material materialBox = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);

Texture texture = assetManager.loadTexture(“Textures/water.png”);

materialBox.setTexture(“ColorMap”, texture);

box.setMaterial(materialBox);

box.setQueueBucket(Bucket.Transparent);

rootNode.attachChild(box);

AmbientLight ambientLight = new AmbientLight();

ambientLight.setColor(ColorRGBA.White);

rootNode.addLight(ambientLight);

flyCam.setMoveSpeed(40);

}

}[/java]



This is the texture, that I’ve used:

http://img7.imagebanana.com/img/kaewyz79/water_test.png



Bu the mesh of your box class should be ok, I guess. :smiley:



destro :slight_smile:

[java]mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);[/java]

In this case, the holes are transparent, but they’re still there.

have you tried

[java] mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);[/java]

?

for a color transparent:

[java] Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

mat.setColor("m_Color", new ColorRGBA(2, 2, 1, 0.60f));

mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);

node.setMaterial(mat);

node.setQueueBucket(Bucket.Transparent);[/java]

this work for me, for a texture worked too(but it was before update when Bucket.Transparent was other named - for now i dont know).

i really don’t know, but i had png image and it worked