3
\$\begingroup\$

I'm playing a bit with LibGDX (OpenGL ES 2.0 wrapper for Android).

I found some sample code which used prepared files to load models and mipmap textures for them, e.g., at https://github.com/libgdx/libgdx/blob/master/demos/invaders/gdx-invaders/src/com/badlogic/gdxinvaders/RendererGL20.java it reads .obj file for the model and RGB565 format .png file to apply a mipmapped texture to it.

What is the best / easiest way for me to create these files?

I understand .obj files are generated by a bunch of tools (I installed Blender, Wings3D and Kerkythea so far), but which ones will be the most user friendly for someone unfamiliar with 3D modelling?

But more importantly, how do I produce a .png file with the mipmapped texture? The .png I looked at ( https://github.com/libgdx/libgdx/blob/master/demos/invaders/gdx-invaders/data/ship.png ) seems to include different textures for each of the faces, probably created with some tool. I browsed through the menus for the 3 tools I have installed but didn't find an option to export such a .png file. What am I missing?

\$\endgroup\$
4
  • \$\begingroup\$ libGDX will do the mipmap automatic for you. It will use your texture as the main one, and generate/use the optimized ones. I think what you want is a TexturePacker. \$\endgroup\$ Commented Nov 17, 2012 at 15:25
  • \$\begingroup\$ Yes, I know it can do multiple resized textures in one mipmap. But I think here something else has been done - the textures for all planes for a particular mesh have been stored in one .png. Are you sure TexturePacker tool does that? \$\endgroup\$
    – John M
    Commented Nov 17, 2012 at 22:55
  • 1
    \$\begingroup\$ that is exactly what is does. This tool packs many smalls ".png" into a single file. You can load each small piece as a sprite in libGDX. If you want to use the result texture in a 3D model, you will have to manually do the UV-Mapping with your favorite 3D modeler tool... \$\endgroup\$ Commented Nov 17, 2012 at 23:07
  • 1
    \$\begingroup\$ Ah, the UV-Mapping keyword is helpful. I somehow had missed it before. I will read some UV-Mapping tutorials for the tools I have installed, I think that is the method I'm looking for. \$\endgroup\$
    – John M
    Commented Nov 18, 2012 at 8:07

1 Answer 1

1
\$\begingroup\$

I've used Blender + GIMP for creating textures. After making the final model, select it, jump into edit mode, then press u (or Mesh-> UV Unwrap, on the lower menu bar) and select Smart UV Project and click OK. Then change the editor type to UV/Image editor (Blue arrow).

If nothing is displayed, make sure all faces are selected.

Now on the lower bar click UVs -> Export UV Layout. [GIMP magic happens there]. When you want to test testures, Alt+r refreshes, go back to 3D view and select textured display mode (red arrow).

I've read that the obj format isn't the best one for libgdx and that g3db is better. To obtain such a file, first download fbx-conv. In Blender click File -> Export -> Autodesk FBX, and save it in the folder with fbx-conv. then open command line\terminal and run:

fbx-conv.exe -f "filename.fbx"

Note that you must add to assets both the .png and .g3db I used AssetManager to load the model.

Where to click

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .