Hi,
first…sorry for my bad english, im a german guy
but I have a problem to load a .xml file with transparency.
I have exported the model (in blender) with OGRE Meshes and Ogre Scene with textures.
But if I want to load the model with the code below, the texture isn’t transparent.
the transparent part turns to black…!!
Here is a part of the code I use
[java]
…
assetManager.registerLocator(“files.zip”, ZipLocator.class.getName());
World = assetManager.loadModel(“World/main.scene”);
rootNode.attachChild(World);
…
[/java]
Is there a possibility to load the texture with transpareny without loading the texture seperate so like thisone
[java]
…
Material mat_brick = new Material(assetManager,“Common/MatDefs/Misc/SimpleTextured.j3md”);
mat_brick.setTexture(“m_ColorMap”, assetManager.loadTexture(“Textures/Wall.jpg”));
…
[/java]
thanks
Inside Blender3D, under the materials tab, ensure that “ZTransp” is selected for all materials with transparent textures.
ok “Ztransp” is now selected but I have still the same problem
thanks
please create new material file (.j3m) with transparency enabled and link your ogre mesh to jme material which you have created. , your material file may should like this
Material tree : Common/MatDefs/Light/Lighting.j3md {
Transparent On
MaterialParameters {
DiffuseMap : Models/trees_pack_3ds/tree_texture.png
AlphaDiscardThreshold : 0.5
UseMaterialColors : true
Ambient : .5 .5 .5 .5
Diffuse : 0.7 0.7 0.7 1
Specular : 0 0 0 1
Shininess : 16
NormalMap : Models/trees_pack_3ds/tree_texture_normal.png
VertexLighting : true
}
AdditionalRenderState {
Blend Alpha
AlphaTestFalloff 0.50
FaceCull Off
}
}
ZTransp should work, are you exporting rendering materials by the way? Can you post your .material file here?
@eriqadams
i will try it but it is a bit circuitous because i have many material files
@Momoko Fan
of course here is the material file
[xml]material NW_NATURE_BRANCH_01
{
receive_shadows on
technique
{
pass
{
ambient 0.500000 0.500000 0.500000 1.000000
diffuse 0.069020 0.072157 0.003137 1.000000
specular 0.500000 0.500000 0.500000 1.000000 12.500000
emissive 0.000000 0.000000 0.000000 1.000000
texture_unit
{
texture NW_Nature_Branch_01.tga
tex_address_mode wrap
filtering trilinear
colour_op alpha_blend
}
}
}
}
material NW_NATURE_BRANCH_02
{
receive_shadows on
technique
{
pass
{
ambient 0.500000 0.500000 0.500000 1.000000
diffuse 0.062745 0.065882 0.003137 1.000000
specular 0.500000 0.500000 0.500000 1.000000 12.500000
emissive 0.000000 0.000000 0.000000 1.000000
texture_unit
{
texture NW_Nature_Branch_02.tga
tex_address_mode wrap
filtering trilinear
colour_op alpha_blend
}
}
}
}
material NW_CITY_IVY_BORDER_01
{
receive_shadows on
technique
{
pass
{
ambient 0.500000 0.500000 0.500000 1.000000
diffuse 0.128627 0.125490 0.062745 1.000000
specular 0.500000 0.500000 0.500000 1.000000 12.500000
emissive 0.000000 0.000000 0.000000 1.000000
texture_unit
{
texture NW_City_Ivy_Border_01.tga
tex_address_mode wrap
filtering trilinear
colour_op alpha_blend
}
}
}
}
material NW_NATURE_LEAVE_03
{
receive_shadows on
technique
{
pass
{
ambient 0.500000 0.500000 0.500000 1.000000
diffuse 0.072157 0.072157 0.021961 1.000000
specular 0.500000 0.500000 0.500000 1.000000 12.500000
emissive 0.000000 0.000000 0.000000 1.000000
texture_unit
{
texture NW_Nature_Leave_03.tga
tex_address_mode wrap
filtering trilinear
colour_op alpha_blend
}
}
}
}
material OW_NATURE_BUSH_02
{
receive_shadows on
technique
{
pass
{
ambient 0.500000 0.500000 0.500000 1.000000
diffuse 0.150588 0.147451 0.106667 1.000000
specular 0.500000 0.500000 0.500000 1.000000 12.500000
emissive 0.000000 0.000000 0.000000 1.000000
texture_unit
{
texture OW_Nature_Bush_02.tga
tex_address_mode wrap
filtering trilinear
colour_op alpha_blend
}
}
}
}[/xml]
These materials are not correct.
Are you using Blender 2.49 or 2.57? Make sure you’re using the latest export script
im using 2.49b and the latest export script
Please see my sample material & ogre mesh file here :
http://code.google.com/p/pathmachine/source/browse/#svn%2Ftrunk%2Fpathmachine%2Fassets%2FModels%2Ftrees_pack_3ds
Its not enough to select “ZTransp” in the material tab, you have to also select “Alpha” under the texture’s “Map To”, also under the material tab.
Hint: if the model in Blender does not appear transparent, then it won’t appear transparent in jME3 either.
I tried it on another mesh and it works
thanks Momoko_Fan and eriqadams