Hello,
-I having been attempting to create a simple mesh cube, assign it a texture, then export to jme. When I render this object in Blender, the texture works fine. When I export is via ogre mesh exporter, to my /Models directory (where the texture JPG lives), I generate the j3o and open it, but the cube shows up as gray, with no texture.
I’ve documented the whole process I am going through at this below link (please view).:
Untitled document - Google Docs
-On a side note, I’ve read through two other threads here on this same issue, neither of which solved my problem. It seems that others simply had the problem of file naming consistency. I’ve also gone through all of the guides on this topic.
-I realize I could assign the texture in Java (and I have) , but I’d really like to learn how to do it this way
-I’ve been spinning my wheels on this for about a week now, any help is greatly appreciated.
Thanks!
Keith
the material name must be the same as mesh name. then if you export to j3o you have a texture(if texture is included in file dir)
if this all is ok, then maybe you have for example .mesh not .mesh.xml. Look at all. there should be name.mesh.xml and name.material and texture you need. AND YOU NEED TO EXPORT TEXTURE TOO IN MATERIAL
i use the same verion of blender and it was working for me
Ohhh and i rememer: sometimes i bad configure export and i had to edit material file manually changing one line name to textureunit… somethin
this one work:
material Book2C.001
{
receive_shadows on
technique
{
pass
{
ambient 0.500000 0.500000 0.500000 1.000000
diffuse 0.285490 0.197647 0.144314 1.000000
specular 0.500000 0.500000 0.500000 1.000000 12.500000
emissive 0.000000 0.000000 0.000000 1.000000
lighting off
texture_unit
{
texture book2.png
}
}
}
}
BTW you should use j3m
if you want to use lighting/etc you should create j3m files
Hmm
-I do have the mesh and material under the same name i.e. Cube.mesh.xml and Cube.material
-When exporting via ogre mesh exporter, I have the “export textures” button clicked
-Okay, I tried to edit the material file. Interestingly, it didn’t have a texture { } section in it. It still won’t work when manually adding it though:
material Material
{
receive_shadows on
technique
{
pass
{
ambient 0.500000 0.500000 0.500000 1.000000
diffuse 0.640000 0.640000 0.640000 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 white-tile-texture.jpg
}
}
}
}
keith said:
but jme won’t let me rename the extension of Cube.material to Cube.material.xml
And it shouldn't. The material isn't a xml file. Also, make sure you are saving the images in memory as image files. Make sure you are using the right version of ogre exporter for your blender. Does it work if you copy the texture files to jmp manually?
tried to add “lighting off”? i dont see it in you material example and i had it in my working example.
and i dont know what exacly dont work: object is black or “grey”?
BTW if you will want lighting, then you should try j3m
And in ogremax packet there is ogre mesh/scene viewer which you can test that exported mesh have all needed information (uv:s, normals). Does texture show when you enable “Game Engine Materials”?
And of course meshes, textures and material file are in the same directory.
-Tried to add “lighting off”, same thing unfortunately
-Tried “enable game engine materials”, same thing (grey box w/o texture)
-I realized immediately after typing the above that the material isn’t xml–so I should still be okay there.
-I downloaded the ogremax mesh/scene viewer. What file format do you save when in blender to use this? I tried exporting the .scene file, but then I get an error “Cannot locate Cube.mesh”. Of course, I have the ability to export the Cube.mesh.xml file, but I’m not sure that this is what it’s looking for.
Material file isnt xml. It is just .material.
Forgot that OgreMaxViewer.exe reads only binary meshes (not .xml ones) (I tested that I edited my .scene file that it finds .xml mesh and didnt work), but you can convert them to binary with http://www.ogre3d.org/tikiwiki/OgreXmlConverter
(but these binary files (.mesh files) does not work in jmp (I think) so dont delete your .xml files).
Just remembered that I had some problems with blender 2.59 with texturing, but I got these to work when I create material, then new texture, then there I setup that texture file… (but dont remember was this required with .blend file loader or .scene loader).
And later when you can textures work, if you only use .scene light infos only, you must read them and add to rootNode (I think objects are first, then lights, objects does not rendered at all). Like this (threads last post):
http://hub.jmonkeyengine.org/groups/import-assets/forum/topic/scene-fileformat/
-Okay I will try converting to binary, and see if I can get the ogremax viewer to work
-To answer your question, I am using Ogre Mesh Exporter version 1.4, so I think I am okay there.
The problem is that you have to use UV texture coordinates, you cannot use generated coordinates
I myself use blender 2.59 and newest blender2ogre (from svn/hg) and it works just fine. (time to update your blender ? )
larda said:
I myself use blender 2.59 and newest blender2ogre (from svn/hg) and it works just fine. (time to update your blender ;) ? )
I just read the document where he described how he exported the model and then I noticed that UV texture coordinates were not used, so the texturing was definitely not gonna work
Momoko fan,
- I am setting up the UV coordinates now, I will let you know when I have this working.
- Is there a certain guide you would recommend for doing the UV texture mapping for my purposes?
- It isn’t still necessary to do this for plane meshes is it? I haven’t had any success with textures on planes either.
Thanks.
There are lots of tutorials online on how to use UV mapping with blender. You have to use UV for any textured material, yes.
i thinked you set uv coords so this is blender topic
and remember: In blender SET ON TexFace OPTION! if you will have done texcoords
To use UV coordinates in Blender 2.49, go to your Material settings, then select in the “Map Input” tab the “UV” option
blender 2.49 is so tedious to configure :P.
Okay! Problem fixed, finally!
Solution:
- As Momoko said, it is necessary to use the UV texture mapping.
For guide see: http://en.wikibooks.org/wiki/Blender_3D:Noob_to_Pro/UV_Map
- It was necessary to export as “Game Engine Materials”.
So glad to finally figure this out…talk about trial and error.
Thanks to everyone for the help.
-Keith