A new importer plugin

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
widarr
Gnoblar
Posts: 7
Joined: Fri Jan 22, 2010 8:05 pm

A new importer plugin

Post by widarr »

Hi!

Im currently working on a little game project where I already have all the resources.
My problem is, that there are no suitable importers for the model format I want to use so I started
to write an importer plugin for Ogre myself.
The plugin is already load- and unloadable, so I just wanted to have a few hints, where I can go from here.
For example:
Where can I tell Ogre to use the 3d geometry and material data I loaded into the plugin?
Can I convert it internally to *.mesh format?

Sorry for the stupid questions but I've just began to learn the architecture of Ogre3d :wink:

Greetings,
widarr
Transporter
Minaton
Posts: 933
Joined: Mon Mar 05, 2012 11:37 am
Location: Germany
x 110

Re: A new importer plugin

Post by Transporter »

Hi!
widarr wrote:Where can I tell Ogre to use the 3d geometry and material data I loaded into the plugin?
Can I convert it internally to *.mesh format?
I don't think theses are stupid questions. Of course you can create your own import plugin and create meshs on the fly. You can find examples at the Ogre Procedural plugin. A second method is to use an universal importer like OgreAssimpConverter if your format is supportet by assimp.
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58

Re: A new importer plugin

Post by CABAListic »

In general I think it is a better idea to convert your format to Ogre's mesh format offline, i.e. with a separate tool, and then use the converted .mesh with Ogre. Unless you absolutely need the ability to load your format on the fly, of course.
widarr
Gnoblar
Posts: 7
Joined: Fri Jan 22, 2010 8:05 pm

Re: A new importer plugin

Post by widarr »

Thank you for the replies.

I'm afraid, writing a load plugin is the only solution I have, because the format the models are in is pretty old and obscure.
There is a converter plugin for Blender, but its not working for now and the developer doesn't seem to put much efford in it to get it working...
I'm going to look into the procedural plugin.

Thanks again :)
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58

Re: A new importer plugin

Post by CABAListic »

No, I mean instead of writing a load plugin it is probably easier to write a converter to Ogre's mesh format (or more specifically, the mesh.xml format) that you run once, and then use the converted meshes with Ogre. Loading the old format on the fly is going to require some extra code I'd imagine, and generally Ogre's mesh format is optimised for engine handling, so I don't know what the performance implications would be.
widarr
Gnoblar
Posts: 7
Joined: Fri Jan 22, 2010 8:05 pm

Re: A new importer plugin

Post by widarr »

Hm, ok.
Is there somewhere a complete specification of the mesh format?
TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin
x 65

Re: A new importer plugin

Post by TheSHEEEP »

There are exporters for Ogre for Max, Maya and Blender.
Can you not use one of those?
My site! - Have a look :)
Also on Twitter - extra fluffy
widarr
Gnoblar
Posts: 7
Joined: Fri Jan 22, 2010 8:05 pm

Re: A new importer plugin

Post by widarr »

The problem is I can't IMPORT it in either of those programs.

I'm now working on an exporter rather than a plugin.
User avatar
madmarx
OGRE Expert User
OGRE Expert User
Posts: 1671
Joined: Mon Jan 21, 2008 10:26 pm
x 50

Re: A new importer plugin

Post by madmarx »

Look in the source at :
Ogre_src\Tools\XMLConverter\docs
it contains the dtd for the xml format. then you can use either the ogrexmlconverter executable to produce .mesh, or use the ogrexmlconverter C++ class to transform such xml string into a mesh file. This is how (all?) ogre exporters to mesh work inside.
Tutorials + Ogre searchable API + more for Ogre1.7 : http://sourceforge.net/projects/so3dtools/
Corresponding thread : http://www.ogre3d.org/forums/viewtopic. ... 93&start=0
Transporter
Minaton
Posts: 933
Joined: Mon Mar 05, 2012 11:37 am
Location: Germany
x 110

Re: A new importer plugin

Post by Transporter »

It would be nice if you can write an importer for assimp. If you can read your meshs with assimp you can use jacmoe's OgreAssimpConverter to convert the files to ogre meshs.
User avatar
Zonder
Ogre Magi
Posts: 1173
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 76

Re: A new importer plugin

Post by Zonder »

Did you check assimps formats to ensure it isn't already there as well? you never know :)

http://assimp.sourceforge.net/lib_html/index.html
There are 10 types of people in the world: Those who understand binary, and those who don't...
widarr
Gnoblar
Posts: 7
Joined: Fri Jan 22, 2010 8:05 pm

Re: A new importer plugin

Post by widarr »

Thanks for all the help :)

The Format is not listed on the Assimp page, so i guess i'll look into it to write it for this converter