This tutorial was made using Blender version 2.43. It is a start to finish example of exporting a simple UV textured sphere.
1. hit spacebar add→mesh→icosphere
2. hit 'numpad 1' for front view then hit 'a' to deselect all then 'ctrl' + 'tab'→edges to enter edge select mode
3. hit 'b' for box select then drag selection box over the middle ring of the sphere to select edges, like the equator
4. hit 'ctrl' + 'e' →mark seam
5. right click on top of window and choose split area to split the window vertically and in the right window open the 'UV/image Editor' window
6. in left window enter 'UV face select mode' make sure all faces are selected then hit 'u'→unwrap this should show the unwrapped mesh in the right window
7. in right window click UVs→Scripts→Save UV Face Layout use the default options and click 'ok' and save it to disk
8. Open the image in gimp or photoshop then edit your image and save it WITHOUT RLE COMPRESSION. In gimp click 'save as…' and uncheck box RLE compression
9. click Image→Open select the .tga and click 'Open Image' the new image should appear in right window and on the object in left window
TODO: This procedure will change for imminent version 2.46 of Blender. The UV Face Select Mode is gone– you now Unwrap directly from normal Edit mode. You must create the ME to TE link before it will let you save the UV Face Layout (only need to create the TE object. Doesn't make sense to assign the file path until later). They've also fixed the external editor invocation, so Blender will invoke Gimp or Photoshop directly after creating the Face Layout file, if you wish.
10. Click the Material Button then 'Add New' to create a new material
11. Click the Texture Button then 'Add new' then select Texture Type→Image
12. In the Image tab click the up/down arrows and select your image, it should show up in the preview tab
13. Click the material Button again and on the far right in the Map Input tab click UV, the image should look better in the preview tab
14. Click File→Export→Wavefront .obj
15. I use these options for exporting… listed by buttons selected.
Context
Selection Only
Extra Data
edges, normals, high quality normals, UVs, materials
Grouping
objects
Object Prefs
apply modifiers, rotate X90
18.Now make sure you have texture, .obj, and .mtl files in right place and use this test to load into JME:
public class TestObjJmeWrite extends SimpleGame {
public static void main(String[] args) {
TestObjJmeWrite app = new TestObjJmeWrite();
app
.setDialogBehaviour(AbstractGame.FIRSTRUN_OR_NOCONFIGFILE_SHOW_PROPS_DIALOG);
app.start();
}
protected void simpleInitGame() {
ObjToJme converter = new ObjToJme();
try {
URL objFile = TestObjJmeWrite.class.getClassLoader().getResource(
"your_model_name.obj");
converter.setProperty("mtllib", objFile);
converter.setProperty("texdir",objFile);
ByteArrayOutputStream BO = new ByteArrayOutputStream();
System.out.println("Starting to convert .obj to .jme");
converter.convert(objFile.openStream(), BO);
//load as a TriMesh if single object
TriMesh model = (TriMesh) BinaryImporter.getInstance().load(
new ByteArrayInputStream(BO.toByteArray()));
//load as a node if multiple objects
//Node model=(Node)BinaryImporter.getInstance().load(
// new ByteArrayInputStream(BO.toByteArray()));
model.setModelBound(new BoundingSphere());
model.updateModelBound();
rootNode.attachChild(model);
} catch (IOException e) {
e.printStackTrace();
}
display.getRenderer().setBackgroundColor(ColorRGBA.gray);
input = new FirstPersonHandler(cam, 3, 1);
//needed for specular lighting(reflective light)
lightState.setSeparateSpecular(true);
}
}
Model must be made of triangles or you must click the 'triangles' button when exporting. The icosphere is already made of triangles so no worries, but if you wanted to export a cube or whatever, you must either do ctrl+T (in edit mode) which converts quads to triangles or click the 'triangles' button when exporting.
Blender
Blender wikibooks
good luck