OgreAssimpConverter

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

OgreAssimpConverter

Post by jacmoe »

I made a crude but effective command-line tool called OgreAssimpConverter:
ogreassimpconverter.jpeg
It takes a model and spits out mesh/skeleton/material.

The 'aniSpeed' parameter is not handled yet.
And the list of parameters should of course include the parameters AssImp uses.

I still haven't gotten animations to work properly, but hopefully someone (or even me) will be able to fix it.
It's better than before, but it's not completely solved.

('Before' meaning this topic: MeshMixer)

The code is up at Bitbucket here:
https://bitbucket.org/ogreaddons/ogreassimp
License: MIT

It even imports .blend files... :)
Last edited by spacegaier on Wed Mar 11, 2015 9:31 am, edited 2 times in total.
Reason: Repository moved to Bitbucket
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99
Contact:

Re: OgreAssimpConverter

Post by Wolfmanfx »

Nice! Have to try this when i am in compile mode :)
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: OgreAssimpConverter

Post by jacmoe »

This is Bob:
bob_fine.jpg
He's a happy watchman of MD5 origin.

He doesn't feel that good when I animate him:
bob_bad.jpg
To be solved ...
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Re: OgreAssimpConverter

Post by betajaen »

You monster! What have you done to poor Bob.


Apart from your sick fantasy about Bob, very nice work Jacmoe. It's likely I'll use this in my project of mine.
dudeabot
Gnome
Posts: 334
Joined: Thu Jun 28, 2007 2:12 pm
Location: Brazil
x 5
Contact:

Re: OgreAssimpConverter

Post by dudeabot »

i feel sry for Bob :P

this is particular useful for tools like model viewers and scene editors and i guess one day it could eliminate the use of exporting plugins
User avatar
Zonder
Ogre Magi
Posts: 1168
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 73

Re: OgreAssimpConverter

Post by Zonder »

dudeabot wrote:i feel sry for Bob :P

this is particular useful for tools like model viewers and scene editors and i guess one day it could eliminate the use of exporting plugins
yeah this is a great tool. the assimp project has more maintainers than all our plugin maintainers put together I think lol
There are 10 types of people in the world: Those who understand binary, and those who don't...
User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
x 218
Contact:

Re: OgreAssimpConverter

Post by Jabberwocky »

What a tremendously useful tool!
1. It's easier than exporting from a modeling tool, especially for us dumb programmers. :P
2. It circumvents the (sometimes prohibitively expensive) need to purchase 3dsmax/maya/etc to export models in those formats.
Thumbs up!
Image
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: OgreAssimpConverter

Post by jacmoe »

Thanks, dudes! :D

It's a bit early in development, but since it's open sauce, I hope that we can make it one of the most useful tools for Ogre.
It's amazing what the Assimp guys supports, so why not make them maintain importers for all the various formats and save the hazzle?
Then we only need to worry about handling the Assimp scene format. :)

Lots to do, especially fixing the issues with animation and multi-pass materials, but it's a start, isn't it?

It's a perfect tool for me, because I am not an artist - and I really don't have the patience to really learn the nooks and crannies of Blender and/or other tools.
And command-line means that I can write a script for it. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
nevarim
Gnoll
Posts: 675
Joined: Mon Jul 05, 2010 6:16 pm
Location: Pavia Italy
x 4
Contact:

Re: OgreAssimpConverter

Post by nevarim »

very useful tool 8)
i'm a noob until proven otherwise :D
used in my project ;) and thanks to everyone :D
Ogre 3d
Mygui
Skyx
Hydrax
MOC
CCS
User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
x 218
Contact:

Re: OgreAssimpConverter

Post by Jabberwocky »

About the bad animations, this may be a useful debugging aid:
  • load the exported .mesh and .skeleton in OgreMeshy
  • click the "show bones" button
  • ensure the bones are properly positioned, scaled, and aligned with the mesh
Also, play some animations, and watch how the bones move.

In my experience, a lot of broken animations are caused by the bones not being aligned properly with the mesh. An example:
  • the modeller creates a model
  • the modeller scales the model x10
  • the animator animates the model (at 10x scale)
  • the model is exported, but for some reason the scaling factor isn't applied to the mesh during the export, so your skeleton is 10x bigger than the mesh, breaking the animations.
This can also happen with other transforms, such as a rotation or translation instead of a scale. You'll see a ton of references to this exact problem with 3dsMax exports by searching the forums for "reset transform".

I'm not sure about the division of labor between OgreAssimpConverter and the assimp library. So it quite likely might be an assimp bug. But narrowing down the issue might at least help report the issue to the assimp devs.
Image
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: OgreAssimpConverter

Post by jacmoe »

I fixed Bob so that he's almost normal. :)
Need to pick a time scale factor, though. The animations are generally way too slow.

And maybe a size scale factor, although that doesn't matter much, as we can use MeshMagick for that.

I can't see that the bones are misaligned, but I suspect that sometimes the wrong bone is chosen to be the root (not sure).

I also have a feeling that I need to apply a scale factor to bones for the animation frame (not sure here either).

I'll keep trying. :)

This dwarf has a good skeleton:
dwarf_skeleton.jpg
It goes haywire when animated:
dwarf_skeleton_ani.jpg
It's strange, because the skeleton seems to work 'on the vertical local scale' - it follows him, even when he lies/dies down.
It looks squashed from both sides..
Probably something simple?
Like a different animation technique?
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: OgreAssimpConverter

Post by jacmoe »

Bob is fine:
good_bob.jpg
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
nevarim
Gnoll
Posts: 675
Joined: Mon Jul 05, 2010 6:16 pm
Location: Pavia Italy
x 4
Contact:

Re: OgreAssimpConverter

Post by nevarim »

nice cap :lol:
i'm a noob until proven otherwise :D
used in my project ;) and thanks to everyone :D
Ogre 3d
Mygui
Skyx
Hydrax
MOC
CCS
User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
x 218
Contact:

Re: OgreAssimpConverter

Post by Jabberwocky »

My thoughts here may be stating the obvious, but I'll jot them down anyway.
jacmoe wrote:It looks squashed from both sides..
Probably something simple?
Like a different animation technique?
Tough to say. Normally my next step would be to open the dwarf in the modeling tool it was designed in, and have a look. Ideally you, or someone helping you, will have some basic competence in that modeling tool.

OgreMeshy is giving you a vague idea of what to look for. The rig, model, and bone weighting appear fine to me. As you noted, something is messing up the animations themselves. Maybe there is some kind of sketchy X-coord (width) scaling going on?

If you can find a different model built using the same modeling tool that exports properly, it can be helpful to look for differences between the good model and the broken model.

One last thought. Using OgreXMLConverter to convert the .skeleton to a .skeleton.xml file, then visually inspecting the .skeleton.xml file can sometimes help track down the bug.
Image
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: OgreAssimpConverter

Post by jacmoe »

I am using the stock Assimp test models, so I know they're supposed to work(ish)
I use assimp-viewer and Ogre-Meshy and my own custom viewer.
It seems to work okay in the assimp-viewer, so it must be something in the ogreassimp code.
Most probably something really simple. :)

I am trying with most animated models in a sequence, so that I am not making the mistake of fixing it for one model and breaking it for all other models. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
x 218
Contact:

Re: OgreAssimpConverter

Post by Jabberwocky »

Gotcha. My unfamiliarity with assimp may mean I'm giving some silly advice.

Would it help to export the dwarf using a different exporter, something that handles the export properly? Then compare the skeleton.xml files and see what's different? You could look at things like the bone heirarchy, and the individual rotations and scaling for a specific animation.
Image
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: OgreAssimpConverter

Post by jacmoe »

A good idea to compare the xml-ed skeleton files.
I'll do that. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Svenstaro
Greenskin
Posts: 115
Joined: Fri Dec 15, 2006 1:30 pm
Location: Germany
x 3
Contact:

Re: OgreAssimpConverter

Post by Svenstaro »

jacmoe are you intending to contribute this back to upstream? I mean, a separate tool is alright but why have that when it could as well go upstream as an exporter? They already have some exporters in their svn and yours would make an excellent addition.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: OgreAssimpConverter

Post by jacmoe »

Isn't this beyond the scope of AssImp?
Besides, this is not much more than a half-working hack at the moment. :)
I'd love to see animations working, and multi-meshes and complete scenes too.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
tdev
Silver Sponsor
Silver Sponsor
Posts: 244
Joined: Thu Apr 12, 2007 9:21 pm
Location: Germany
x 14

Re: OgreAssimpConverter

Post by tdev »

using parts of your work in http://code.google.com/p/ogre-meshtool/ :)

sorry, found this thread later than the MeshMixer thread, so i posted there first but the post certainly belongs here.

Svenstaro wrote:jacmoe are you intending to contribute this back to upstream? I mean, a separate tool is alright but why have that when it could as well go upstream as an exporter? They already have some exporters in their svn and yours would make an excellent addition.
i also think that should go in there :)
inzero
Kobold
Posts: 33
Joined: Sun Dec 19, 2010 9:55 am

Re: OgreAssimpConverter

Post by inzero »

This interests me, because I know almost nothing about modelling and exporting. I have seen the Blender exporter for Ogre, but really I'm so terrible with modelling programs (and the Blender GUI is a complex mess even for my poor programming brain) so I can't export anything more than a cube correctly. Since I'm not a modeller and I don't know anyone who is yet, I would like to use a variety of free models for testing, generated from as many modelling packages as I can so I'm not limited to just Blender, and I'm not going to pay for a Max to Ogre exporter or something.

So I have some questions:

1. OgreAssimpConverter, by itself, would allow me to take a model created in a wide variety of packages (Max, Maya, Blender, etc.) and magically convert it to an Ogre mesh that can be used immediately? I know there are animation bugs still, but this is the purpose of the program, yes?

2. MeshMixer is simply a nice looking GUI for OAC so I don't have to use a command-line interface? Possibly allowing drag'n'drop of some .max file or whatever that will then spit out a shiny working Ogre .mesh?

3. If the above questions are true, shouldn't this become a standard Ogre tool that is regularly maintained so us non-modellers can get stuff into our games without jumping through hoops or paying for exporters?
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: OgreAssimpConverter

Post by jacmoe »

The idea is that you can just drag and drop models in various formats on the executable and it will give you mesh/skeleton/material, yes. :)
If you want more control, then give it some arguments from either a script or through the command prompt.
But that's basically it.
Like the OgreXMLConverter, but for any model format supported by Assimp.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Svenstaro
Greenskin
Posts: 115
Joined: Fri Dec 15, 2006 1:30 pm
Location: Germany
x 3
Contact:

Re: OgreAssimpConverter

Post by Svenstaro »

jacmoe wrote:Isn't this beyond the scope of AssImp?
Besides, this is not much more than a half-working hack at the moment. :)
I'd love to see animations working, and multi-meshes and complete scenes too.
Isn't this exactly the scope of assimp? You should definitely try to get your stuff upstream.
cloud
Gremlin
Posts: 196
Joined: Tue Aug 08, 2006 6:45 pm
x 14

Re: OgreAssimpConverter

Post by cloud »

Don't know if this helps or not but I tried to clean up the code a bit and added callbacks to customise the creation the material and/or scene data, setup codes a bit like

Code: Select all

		
OgreAssimp::Loader assLoader;
assLoader.setCustomMaterialExportCallback(boost::bind(&OgreAssimp::LoaderCustomisation::scriptMaterialExportCallback, _1, _2, _3));
assLoader.setSceneExportCallback(boost::bind(&OgreAssimp::LoaderCustomisation::dotSceneExportCallback, _1, _2));
assLoader.convert("/Ogre/assimp--2.0.863-sdk/test/models-nonbsd/MD5/Bob.md5mesh", "", OgreAssimp::Loader::LP_GENERATE_SINGLE_MESH);
The setSceneExportCallback obviously isn't needed if exporting a single mesh, and the same default as before will be used if setCustomMaterialExportCallback isn't called.

This might not be useful in the context of command tool, but I thought I might as well post it anyway and let you decide.

The root node still seems to be a problem for me, with certain model formats (I think it was collada) in grabBoneNamesFromNode, if I comment out first two occurances of flagNodeAsNeeded it seems to work, some oddity going on there.

http://www.pearsonp.force9.co.uk/OgreAssimpLoader.zip
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: OgreAssimpConverter

Post by jacmoe »

The root node is a complete mystery. :)
If you have any problem models, send then this way.
I'll check out your code - I'll pick it up again shortly as I've gotten my grubby hands on some juicy code which just might fix the animation issues too.. :wink:

<edit>
Really cool to see that you are using GOOF - I thought no one remembered it now. :)

Do you have a real name I can attribute you with?
OgreAssimp owe you a lot.
</edit>
Svenstaro wrote:You should definitely try to get your stuff upstream.
Not now, later. :)
I don't feel like dealing with their exporter interface right now - at least not until everything works.
It's far easier to have Ogre around to help out than a pure code approach.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Post Reply