Alpha Blending Does not work and uv messed up

Hi,

1 - as i am loading a j3o (made with blender 2.66a), the transparent textures are not displayed as transparent in my jme game
in blender it show up correctly, but i had to set it to “Blender Game” to have the “Game Settings” panel, to enable alpha

[the texture i use HAS an alpha chanel]

2 - i decided to create a jme material and assign it to my geometry, but so far everytime i do that, even with non transparent textures,
the uv are completely messed up

Material My Material : Common/MatDefs/Light/Lighting.j3md {
     MaterialParameters {
        DiffuseMap : Textures/Container_diffuse.png
        UseAlpha : true
     }
    AdditionalRenderState {
      Blend Alpha
      FaceCull Back
    }
}

[java]
propNode= (Node) assetManager.loadModel(“Models/Container.j3o”);

Spatial glass = propNode.getChild(“Glass”);
Geometry geo = (Geometry) ((Node)glass).getChild(0);

// this does not enable alpha
//Material material = geo.getMaterial();
//material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);;

// this does enable alpha for every faces, even the one where triangles are positioned on non alpha part of the texture
// and ruins the uv mapping
Material material =assetManager.loadMaterial(“Materials/Container.j3m”);
geo.setMaterial(material);

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

i am using the latest nightbuild version of jme3

what do i do wrong ?

I guess you have to flip the texture
in your J3m replace

  DiffuseMap : Textures/Container_diffuse.png

by

DiffuseMap : Textures/Container_diffuse.png flip
<cite>@nehon said:</cite> I guess you have to flip the texture in your J3m replace [code] DiffuseMap : Textures/Container_diffuse.png [/code] by [code] DiffuseMap : Textures/Container_diffuse.png flip [/code]

thx

it fixes the uv indeed

but what about the alpha not working ?

“alpha not working” how? I didn’t really understand that part.

<cite>@pspeed said:</cite> "alpha not working" how? I didn't really understand that part.

well it is not displayed as transparent
althought i use a texture with alpha chanel
althought it is correctly setup and displayed in blender
althought use geo.setQueueBucket(Bucket.Transparent); material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
or use this material

Material My Material : Common/MatDefs/Light/Lighting.j3md { MaterialParameters { DiffuseMap : Textures/Container_diffuse.png UseAlpha : true } AdditionalRenderState { Blend Alpha FaceCull Back } }

Verify that the png really has alpha.

Then please post the actual setup code as it exists now. It’s tough to figure out what’s wrong when we only see one correct line here and one correct line there. We have to assume a lot… but clearly something is wrong or it would work.

<cite>@pspeed said:</cite> Verify that the png really has alpha.

Then please post the actual setup code as it exists now. It’s tough to figure out what’s wrong when we only see one correct line here and one correct line there. We have to assume a lot… but clearly something is wrong or it would work.

the whole code is up there in the first entry of my post :slight_smile:
and as i already mentioned, the texture has alpha, i made it myself with gimp

<cite>@pspeed said:</cite> Verify that the png really has alpha.

Then please post the actual setup code as it exists now. It’s tough to figure out what’s wrong when we only see one correct line here and one correct line there. We have to assume a lot… but clearly something is wrong or it would work.

ok it is working now

the alpha was present but messed up in the texture…
thx anyway