OgreKit: reading physics & skeletal animation from .blend

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
ecoumans
Kobold
Posts: 39
Joined: Mon Sep 12, 2005 10:07 am
Location: San Francisco
x 4

OgreKit: reading physics & skeletal animation from .blend

Post by ecoumans »

We just included the latest Ogre 1.7 trunk into our GameKit work:
http://code.google.com/p/gamekit/

Main feature is that it can extract any information straight from a Blender .blend file. Currently we are converting the following data into Ogre data:
  • triangle meshes, vertices, uv coordinates
  • embedded texture images, such as .jpg, .png etc
  • collision shape information and rigid body info (mass etc), rigid body constaints
  • skeleton (armatures), vertex weighting and animation curves
Some other features include:
  • Everything is open source under permissive BSD/MIT/Zlib licenses
  • Includes latest Bullet Physics SDK
  • full cmake build system support, including dependencies that build out-of-the-box under Windows, even if the DirectX SDK is missing (Linux/Mac builds will be fixed later)
  • static linking to avoid missing DLL issues
  • little and big endian .blend files, 32/64 bit support, forward and backward compatibility (Blender 2.5 Animato support under construction)
You can download source code and a small precompiled Win32 binary that loads and plays an animated Momo the Monkey from the YoFrankie project, straight from a Blender .blend file:

Image

Cheers,
Erwin
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: OgreKit: reading physics & skeletal animation from .blend

Post by dermont »

Just tried this on Linux, very impressive.

<edit>
The following warning is displayed when running the demo:

Code: Select all

WARNING: the mesh 'MeshMomo' includes vertices with more than 4 bone assignments. The lowest weighted assignments beyond this limit have been removed, so your animation may look slightly different. To eliminate this, reduce the number of bone assignments per vertex on your mesh to 4.
ecoumans
Kobold
Posts: 39
Joined: Mon Sep 12, 2005 10:07 am
Location: San Francisco
x 4

Re: OgreKit: reading physics & skeletal animation from .blend

Post by ecoumans »

Wait a second, isn't the Linux build supposed to be broken ;-) ?

Did you compile from SVN repo or source zipfile? Did you have to make any changes to the source code?
more than 4 bone assignments
Ogre has a limit of 4 bones per vertex (for skinning), and this particular .blend file has vertices with more than 4 bones.
Thanks,
Erwin
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: OgreKit: reading physics & skeletal animation from .blend

Post by dermont »

From the source zipfile, there were a few changes. Sorry didn't realise there was a OgreKit svn branch which looks like it has been updated to build on Linux. I'll try that out.

<edit>
The svn branch builds OK, but the demo only appears to demo run from the source directory, the blend file fails to load when running from an out-of-source build dir. Is there a forum or tracker for this?

Code: Select all

Index: Core/Engine/gkHash.h
===================================================================
--- Core/Engine/gkHash.h	(revision 126)
+++ Core/Engine/gkHash.h	(working copy)
@@ -27,6 +27,7 @@
 
 #include <stdlib.h>
 #include <stddef.h>
+#include <stdint.h>
 
 #include "gkCommon.h"
 
Index: Core/bParse/bCommon.h
===================================================================
--- Core/bParse/bCommon.h	(revision 126)
+++ Core/bParse/bCommon.h	(working copy)
@@ -21,6 +21,7 @@
 #include <vector>
 #include <assert.h>
 #include "bLog.h"
+#include <stdio.h>
 
 namespace bParse {

dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: OgreKit: reading physics & skeletal animation from .blend

Post by dermont »

dermont wrote: The svn branch builds OK, but the demo only appears to demo run from the source directory, the blend file fails to load when running from an out-of-source build dir.
It runs runs fine from the out-of-source build dir after copying across the blend file. :oops:
snailrose
Gnoblar
Posts: 3
Joined: Tue Aug 22, 2006 10:55 pm

Re: OgreKit: reading physics & skeletal animation from .blend

Post by snailrose »

I applied your patch, Thanks! Can you confirm whether it breaks on your end ?

A newer command line demo is in the works so it's not isolated to one blend file :)
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: OgreKit: reading physics & skeletal animation from .blend

Post by dermont »

Thanks, everything builds and runs fine here.l
User avatar
madmarx
OGRE Expert User
OGRE Expert User
Posts: 1671
Joined: Mon Jan 21, 2008 10:26 pm
x 50

Re: OgreKit: reading physics & skeletal animation from .blend

Post by madmarx »

I checked the source code, it seems a huge amount of work has already been done!
Do you develop it at your job, or as an exterior project ?
Tutorials + Ogre searchable API + more for Ogre1.7 : http://sourceforge.net/projects/so3dtools/
Corresponding thread : http://www.ogre3d.org/forums/viewtopic. ... 93&start=0
ecoumans
Kobold
Posts: 39
Joined: Mon Sep 12, 2005 10:07 am
Location: San Francisco
x 4

Re: OgreKit: reading physics & skeletal animation from .blend

Post by ecoumans »

OgreKit is mostly Charlie/snailrose work, although I've helped with the .blend parser and some suggestions here and there.
Charlie started this project a few years ago under a different name (echo), and we revived it.

My daily job at US R&D of Sony is leading a small team developing the open source Bullet physics SDK.
This OgreKit / gamekit stuff is one of the test and QA environments for Bullet, just like Blender etc.

If you have any feedback, please let us know,
Cheers,
Erwin
Temaruk
Gnoblar
Posts: 5
Joined: Wed Apr 23, 2008 1:04 pm

Re: OgreKit: reading physics & skeletal animation from .blend

Post by Temaruk »

Looks good! I will examine it at home! Will this eventually make it possible to integrate Ogre as a rendering engine in Blender? I mean, will there be an Ogre viewport in Blender?
ecoumans
Kobold
Posts: 39
Joined: Mon Sep 12, 2005 10:07 am
Location: San Francisco
x 4

Re: OgreKit: reading physics & skeletal animation from .blend

Post by ecoumans »

Some people already customized Blender 2.5 to start the gamekit from Blender, when pressing the P key.
(see http://blenderartists.org/forum/showthr ... 10&page=10 and http://www.pasteall.org/9494/python)

This saves a temporary .blend file and executes the external player, but no 3D viewport integration. A former project (echo plugin) did a more tight integration, with Ogre in the Blender viewport. This requires a lot of changes to the underlying Blender 'Ghost' library.

For now, we just stick with a separate 3D window on top. The largest effort right now it to show how to extract any information from the .blend file and convert it into Ogre (and Irrlicht) data structures.
Vectrex
Ogre Magi
Posts: 1266
Joined: Tue Aug 12, 2003 1:53 am
Location: Melbourne, Australia
x 1

Re: OgreKit: reading physics & skeletal animation from .blend

Post by Vectrex »

ecoumans wrote:Some people already customized Blender 2.5 to start the gamekit from Blender, when pressing the P key.
(see http://blenderartists.org/forum/showthr ... 10&page=10 and http://www.pasteall.org/9494/python)

This saves a temporary .blend file and executes the external player, but no 3D viewport integration. A former project (echo plugin) did a more tight integration, with Ogre in the Blender viewport. This requires a lot of changes to the underlying Blender 'Ghost' library.

For now, we just stick with a separate 3D window on top. The largest effort right now it to show how to extract any information from the .blend file and convert it into Ogre (and Irrlicht) data structures.
This is really nice. Could this be used for full scenes like .scene /collada?
btw doesn't irrlicht support ogre meshes anyway? Would make that bit a lot easier :)
ecoumans
Kobold
Posts: 39
Joined: Mon Sep 12, 2005 10:07 am
Location: San Francisco
x 4

Re: OgreKit: reading physics & skeletal animation from .blend

Post by ecoumans »

Vectrex wrote: This is really nice. Could this be used for full scenes like .scene /collada?
btw doesn't irrlicht support ogre meshes anyway? Would make that bit a lot easier :)
Yes, the .blend file format is very powerful and it contains all the worlds and scenes as created in Blender. See further details here.

In my opinion it has benefits over COLLADA files: .blend files are more compact binary (can be even compressed using zip), faster and easier to load, backwards and forwards compatible, extendible,
and it contains more information: apart from meshes, cameras, lights, particles, sound, collision and rigid body info, it contains soft body, fluids, scripting, embedded images such as png/jpg/tga etc.

It would be possible to write .blend file exporters and importers for Max and Maya (possibly based on the open source OpenCollada tools)
Cheers,
Erwin
ecoumans
Kobold
Posts: 39
Joined: Mon Sep 12, 2005 10:07 am
Location: San Francisco
x 4

Re: OgreKit: reading physics & skeletal animation from .blend

Post by ecoumans »

The latest trunk also builds OgreKit for Mac OSX out-of-the-box using cmake, with no hassle: source and statically linked cmake support for all external dependencies are included.

So instead of reading lots of 'how-to-install-Ogre' or seaching for the matching binary release of your dependencies, you can just run

Code: Select all

cmake . -G Xcode
Currently it creates a bundle app, with the momo .blend copied inside the bundle Resources folder.

A precompiled binary for Mac Intel 32bit is here: http://code.google.com/p/gamekit/downloads/list