Android, Gamedev, Graphics

LibGDX, Blender and G3D Exporting

LibGDX is working on exporting your work from Blender or SoftImage (see the model-loaders) straight into a file format that it can handle; the file format that it has coined is G3D. Now, as far as I know the G3D file format has no specification, if you want to understand how the file format works then there is no better way than to just look straight at the implementation in the libgdx/extensions/model-loaders code (we check out this repository in step one).

This blog post explains a nice an easy way to install the Blender G3DT exporter on an OSX or Linux machine.

  1. The first step is to check out the libgdx source code which is a lovely git repository (thanks go out to the LibGDX team that recently changed it over from SVN to Git, it was a good move):
    git clone git://github.com/libgdx/libgdx.git
  2. When the source code is checked out you will need to symlink the files into your blender addons directory.
    On Mac OSX:

    cd /path/to/libgdx-read-only
    ln -s extensions/model-loaders/model-loaders/doc/blender/io_scene_g3dt /Applications/blender.app/Contents/MacOS/$(/Applications/blender.app/Contents/MacOS/blender --version | grep "^Blender" | cut -d  -f2)/scripts/addons

    On Linux:

    mkdir -p ~/.blender/$(blender --version | grep "^Blender" | cut -f2 -d  )/scripts/addons
    cd /path/to/libgdx-read-only
    ln -s extensions/model-loaders/model-loaders/doc/blender/io_scene_g3dt ~/.blender/$(blender --version | grep "^Blender" | cut -f2 -d  )/scripts/addons

    On Windows: Windows has the equivalent of Symlinks since Windows Vista. You can use the mklink command instead of the ln command to link the ‘extensions/model-loaders/model-loaders/doc/blender/io_scene_g3dt’ directory straight to your blender addons directory. That will work but unfortunately I do not have any instructions that I can guarantee will work for that; but you are pretty clever. You should be able to figure out how to use the mklink command.

  3. Now open Blender and navigate to File > User Preferences (Ctrl+Alt+U). Click on the Import-Export in the left hand side panel and then enable the G3DT Plugin by ticking the Check box next to the Import-Export: G3DT Exporter box.

    Click this simple box to activate the plugin.
    (Click on this image to get a large version of the button that you are supposed to press to activate the G3DT Exporter)

And now you are done. You can now export your blender files to the G3DT format for use with LibGDX. Not only that, but if you spot any problems with the G3DT Exporter and you manage to solve them then you can easily commit you code straight back to the larger project. You could contribute to libgdx just like that.

Advertisements