Uv problem

I made the mesh of a zombie in 3ds max, made the texture and unwrapped it. in 3ds max it all looks fine, but in jme the texture just doesnt fit.

its 2048x2048, power of two.

I tried to flip or repeat the texture but it doesnt work. here a screenshot:

http://www.imagebanana.com/view/y0fxrqks/_.jpg

do someone has an idea?

It doesn’t look like the texture is actually uv-mapped… Are you sure you applied the uv texture coordinates to the mesh (in the 3d editor)?

I applied it. there is only the skin modifier left, I attached the unwrap uvw modifier to the model and it looks correkt in the 3d editor.

How do you create the material and load the textures?

I tried to create the material in the jme material editor, same result as if I load the texture and assign it to a material in the code:

Material mat2 = new Material(assetManager, “Common/MatDefs/Light/Lighting.j3md”);

Texture tex02= assetManager.loadTexture(“Models/zombie/zombie_02.jpg”");

mat2.setTexture(“m_DiffuseMap”, tex02);

model.setMaterial(mat2);

Uh, why do you use the m_ prefix for the material parameter name? It seems your jME3 version is ancient.

Product Version: jMonkeyEngine SDK 3.0beta

doesnt make a difference if there is a m_ I guess.

Okay, still, the model doesn’t look UV-mapped at all, I am almost sure you can see a long seam somewhere on the back or smth. I don’t know your 3D editor but I know theres many ways the model can look different in the editor. Are you really 100% sure the UV data has been written to the actual mesh, like every vertex has a texture coordinate? Can you post the ogre material file?

do I need .material file? I thought the uv koordinates are in the .mesh.xml file.

heres the file:

http://maxim6394.bplaced.net/zombie.mesh.xml

the .material file is almost empty.



I also applied a texture for checking, it isnt distorted at all, so the koordinates must be there.

No, I mean the material file. If the texture is properly assigned it will export with the model. The fact that its “almost empty” further hints at the texture not being applied properly in the editor.

heres the material file:



material 02-Default

{

technique

{

pass

{

ambient 0.588235 0.588235 0.588235 1

diffuse 0.588235 0.588235 0.588235 1

specular 0 0 0 1 10



texture_unit

{

texture zombie_02.jpg

}

}



}



}

If your “normal” texture isn’t distorted then the mesh definitely has no UV coords for the UV map.

why are there hundrets of uv koordinates in the .mesh.xml file then?

Because the exporter applies some wrapping? I am not trying to prove you wrong I am trying to help you with what occurs to me. Its not like importing UV coordinates was broken or anything, everybody else gets it done.

now Im enrage. I tried to mirror the damn texture and suddenly after mirroring it vertically, it fits perfectly. what the hell is wrong with the uv koordinates? why were they mirror inverted?

I thought you already tried flipping it :roll:

no I just tried cheking “flip” in the material editor wich didnt work. now I flipped the actual texture.



another little question: is there a way to display collision shapes?

In your code you did not use any j3m file, you either do that and edit it in the material editor or you set the texture manual in which case you have to care for flipping and setting mipmaps etc yourself. I guess you look for physicsSpace.enableDebug(): https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:physics

bulletAppState=new BulletAppState();

stateManager.attach(bulletAppState);

bulletAppState.getPhysicsSpace().enableDebug(assetManager);



no this doesnt work, I dont see any difference.

are your physics collision shapes set-up correctly ? If they are wrong, or not there, you won’t see any difference.