How do I use Blender models in Java?

Garee picture Garee · Aug 20, 2010 · Viewed 23.7k times · Source

Just a general question really?

Let's say I am making a game and have made a character model in Blender. How would I use this model in Java?

Would I import it somehow?

Thanks.

Answer

udoprog picture udoprog · Jan 26, 2012

Generally when making models in blender you export the model in a format which allows you to later import it in the game engine of your choice, which format you use differ in requirements.

The export-import cycle is often referred to as the "Asset Pipeline", and you generally want to keep it as simple and automated as possible since it is something you or your artists will perform on a regular basis.

So if we look at a few specific graphics engines and platforms;

  • OGRE3D (or Ogre4J) supports it's own plain-text format (.scene, .mesh.xml, .material.xml) in order to load scenes, models and materials. It also has support for armature animations among other things, there is also some support for loading .blend-files directly. See their documentation for blender.
  • JmonkeyEngine has support for loading both OGRE3D .scene's and .blend's directly. It also has it's own binary j3o format which these can be converted into when you want to package the game. For specific examples, see their tutorials.

There are multiple formats you can take into consideration when deciding how you want to use your model. When it is imported however, the game engine of choice represents it in an internal structure which usually allows you to be decoupled from the exact format of choice.

Picking which to use is and should not be written in stone since requirements might change and if done properly it should not have a considerable effect on the project. This is also something you should take into consideration if you are writing your own engine.