New material editor/Texture browser flips textures sometimes

Hi! I used textures in new Material editor and texture browser flips sometimes textures. But the textures are not flipped when i open them in image viewer. Is it bug?



http://img864.imageshack.us/i/14446117l.png





Uploaded with ImageShack.us







Uploaded with ImageShack.us







Thanks.

The texture browser loads the image data from a texture it creates first, the image viewer and editor just display the images with AWT… So apparently the normal map gets flipped in the texture, don’t know if thats a problem or w/e tho. What exactly do you mean by “sometimes”?

As I noticed now… This is not a problem of your Material Editor. The problem is in assetManager or in the Engine. I’ve got a mesh, a duffuse textureand my MatDef.



I load the mesh:

[java]

Spatial char_boy = assetManager.loadModel (“Models/guy/guy.mesh.j3o”);

mat = new Material(assetManager, “MatDefs/ma.j3md”);

mat.setTexture(“DiffuseMap”, assetManager.loadTexture(“Models/guy/guy.png”));

mat.setFloat(“m_Shininess”, 20.0f);

char_boy.setMaterial(mat);

rootNode.attachChild(char_boy);



[/java]



Result is:

http://img856.imageshack.us/i/18107343.png





Uploaded with ImageShack.us





It’s ok. But if I copy a texture (click+ctrl) i’ll get guy_1.png. Then I change a texture in the code:

[java]

Spatial char_boy = assetManager.loadModel (“Models/guy/guy.mesh.j3o”);

mat = new Material(assetManager, “MatDefs/ma.j3md”);

mat.setTexture(“DiffuseMap”, assetManager.loadTexture(“Models/guy/guy_1.png”));

mat.setFloat(“m_Shininess”, 20.0f);

char_boy.setMaterial(mat);

rootNode.attachChild(char_boy);



[/java]



Result is flipped:

http://img34.imageshack.us/i/42214843.png





Uploaded with ImageShack.us





You can grab the guy: http://www.mediafire.com/?9jrxyv1v0c5mgsf

The same problem happens when i copy textures to existing folder. Some textures can be flipped in the engine…

Yeah, thats what I was saying ^^

cool, but will it be possible to fix?

It would break import for many models that work now I guess. Maybe we’ll be able to untangle this flipping issue, but it seems to me this confusion is universal :confused: The exporters just do different things…

the problem is more painful. For example, diffuse map could be flipped, but normal and specular map could be not flipped. It randomly flips textures. As I think it does not depend on mesh exporter in this case…



In my case, normal map looks ok, but diffuse and specular are flipped:





Uploaded with ImageShack.us

I found the way how to fix textures. right-click on a texture, Edit Texture, then press a flip vertically button. That’s all. :slight_smile:

But I doubt that it will work in the case of dds textures…

mifth said:
But I doubt that it will work in the case of dds textures...

It will work if the edit texture function works by using AssetManager and ImageFlipper

Example code, please!!! You are as always rocks!



For example, how to flip guy.png?:



[java]

Spatial char_boy = assetManager.loadModel ("Models/guy/guy.mesh.j3o");

mat = new Material(assetManager, "MatDefs/ma.j3md");

mat.setTexture("DiffuseMap", assetManager.loadTexture("Models/guy/guy.png"));

[/java]

Create a TextureKey and then use it to load the texture with assetManager.loadAsset(). The flipY parameter in the TextureKey constructor specifies if the image should be flipped or not.

Thanks a lot!!!

Momoko_Fan said:
Create a TextureKey and then use it to load the texture with assetManager.loadAsset(). The flipY parameter in the TextureKey constructor specifies if the image should be flipped or not.

Why does the "DiffuseMap: Flip path/to/texture.jpg" not work?