Assimp -> Ogre adaptor

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
User avatar
Aiden
Halfling
Posts: 54
Joined: Fri Jul 14, 2017 3:16 pm
x 3

Assimp -> Ogre adaptor

Post by Aiden » Sun Jul 23, 2017 12:36 pm

I succeeded in making an adapter that will load any file supported with Assimp into Ogre.
I use the latest assimp and ogre 1.10 (Ogrecave).
Feel free to checkout the code on github and also offer improvement where there are enhancements or bug fixes.

UPDATE:We are now using OgreAssimp as the base .
Github[Assimp -> Ogre adaptor]


Enjoy....
Last edited by Aiden on Mon Sep 04, 2017 6:20 pm, edited 7 times in total.
0 x

User avatar
Aiden
Halfling
Posts: 54
Joined: Fri Jul 14, 2017 3:16 pm
x 3

Re: Assimp -> Ogre adaptor

Post by Aiden » Mon Jul 24, 2017 11:28 pm

I've fixed the bug. Now the code is able to load models without breaking them, where it can't load it will display only a portion o the model.
This is now where am at.
If you think you can fix it, it will be good for the community, it's good to help ogre grow by making it easier for new users. :D

UPDATE:We are now using OgreAssimp as the base .
Github[Assimp -> Ogre adaptor]
Last edited by Aiden on Mon Sep 04, 2017 6:16 pm, edited 2 times in total.
0 x

User avatar
Aiden
Halfling
Posts: 54
Joined: Fri Jul 14, 2017 3:16 pm
x 3

Re: Assimp -> Ogre adaptor

Post by Aiden » Tue Jul 25, 2017 10:06 pm

Still making slow progress.
This time I can load models abit better but complex ones get abit shreded.
We are going to make this into a plugin so it maybe easier for new users to add alot of models, after this we begin working with texture loading.

UPDATE:We are now using OgreAssimp as the base .
Github[Assimp -> Ogre adaptor]


Image
Last edited by Aiden on Mon Sep 04, 2017 6:17 pm, edited 2 times in total.
0 x

frostbyte
Orc Shaman
Posts: 737
Joined: Fri May 31, 2013 2:28 am
x 14

Re: Assimp -> Ogre adaptor

Post by frostbyte » Thu Jul 27, 2017 9:18 am

double posting is never a good thing, especially when you don't bother to read your "old" ones
there is already a very good ogre assimp converter, i don't thing there is a need for a new one...
http://www.ogre3d.org/tikiwiki/OgreAssi ... ture=Tools

tip: ogre is so ancient and have a huge ecosystem, better search the forum, wiki, github/bitbucket/sourceForge google before you start
after 5 years of using ogre, i'm still discovering useful new-old projects/code
i suggest you start by scanning the wiki...
0 x
the woods are lovely dark and deep
but i have promises to keep
and miles to code before i sleep
and miles to code before i sleep..

coolest videos link( two minutes paper )...
https://www.youtube.com/user/keeroyz/videos

User avatar
Aiden
Halfling
Posts: 54
Joined: Fri Jul 14, 2017 3:16 pm
x 3

Re: Assimp -> Ogre adaptor

Post by Aiden » Sat Jul 29, 2017 2:49 pm

This isn't a second post. It's the main post for the new plugin (AssimpOgre-Adaptor) I intend on making. If I'll manage to make it work that is.
The OgreAssimpConverter is just an external converter. I haven't found a way of integrating the code to import 3d scenes into ogre without first having to write to them to file.

As a plugin it should be easy to import objects into ogre via assimp without manually converting it first. I may even use OgreAssimpConverter code if I understand how it works for this type of functionality.

This should allow the plugin to be actively developed since it will have to be compatible with future versions of ogre. And as assimp grows and extends it's supported files, Assimp will also grow within Ogre as a plugin and not as an external app(converter).

If you believe this feature to have been already implemented elsewhere, kindly show me how(code) or where it is(link). I may stop or delete this thread if necessary.
EDIT:I've also created a cookbook for this(Assimp->Ogre Adaptor) Cookbook, if I manage to load materials and animations with this code. Then i'll make a repo on github, delete the cookbook and replace it with A plugin page.
0 x

frostbyte
Orc Shaman
Posts: 737
Joined: Fri May 31, 2013 2:28 am
x 14

Re: Assimp -> Ogre adaptor

Post by frostbyte » Sat Jul 29, 2017 7:32 pm

The OgreAssimpConverter is just an external converter. I haven't found a way of integrating the code to import 3d scenes into ogre without first having to write to them to file.
ah, yes...sorry for the confusion, i just assumed that since your new on forum you might have skipped it...
about a year a go i actually tried( for a couple of hours ) to make ogreassimp work as an importer, but since i decided its much more efficient( for reoccurring uses ) to load ogre binary mesh i ditched the importer idea ( try converting a 300m .dae file every time you want to load your scene and you'll see what i'm talking about )

by now i'm using 3 converters and i'm still not satisfied...in my desperation i'm actually considering on adding blender+ogreKIT( it has an ogre blender importer inside ) as a dependency just for converting some formats :?
anyway, good luck..
Last edited by frostbyte on Thu Aug 03, 2017 12:19 am, edited 1 time in total.
0 x
the woods are lovely dark and deep
but i have promises to keep
and miles to code before i sleep
and miles to code before i sleep..

coolest videos link( two minutes paper )...
https://www.youtube.com/user/keeroyz/videos

User avatar
Aiden
Halfling
Posts: 54
Joined: Fri Jul 14, 2017 3:16 pm
x 3

Re: Assimp -> Ogre adaptor

Post by Aiden » Sun Jul 30, 2017 9:58 am

When my importer fails to work I'll have to consider looking into the ogreassimp converter seriously . I'll center all my work towards making the importer work as a plugin.
I've managed to improve the code a bit and it can now import simple models.
I wish we had someone experienced with ogre's internal mesh format to assist us in this. I'm sure it would only take half a days work to get things working right. Then we can consider adding texture's and animation later on.

Thanks for responding anyways, It's hard to get response from this site nowadays.

EDIT:After skimming through the code of ogreaassimp, it seems that they have exposed meshPtr and skeletonPtr. As for MaterialPtr I see it's already attached to the mesh from the code. This means that ogreassimp may actually provide the functionality i'm looking for, I'll keep researching and update. I think i'm closing in on a solution.

I think I'll use ogreassimp to create the plugin if all goes well.
0 x

frostbyte
Orc Shaman
Posts: 737
Joined: Fri May 31, 2013 2:28 am
x 14

Re: Assimp -> Ogre adaptor

Post by frostbyte » Mon Jul 31, 2017 1:13 am

I'm sure it would only take half a days work to get things working right
:lol:
Thanks for responding anyways, It's hard to get response from this site nowadays.
yes, especially when your posts are about mesh formats, something cg devs like to stay away from( for a good reason )
As for MaterialPtr I see it's already attached to the mesh from the code
i recall there is a small bug, with some models ogreassimp breaks when trying to create submeshes with the same material name, my fast dirty fix was to add the submesh index to the end of the submesh material name
I think I'll use ogreassimp to create the plugin if all goes well.
good call, ogreassimp is very well written, high standard code from ogre-veterans
you can also take look at fxOgreFBX code for more references on the topic ( also an impressive work ), i actually use this one as an importer
0 x
the woods are lovely dark and deep
but i have promises to keep
and miles to code before i sleep
and miles to code before i sleep..

coolest videos link( two minutes paper )...
https://www.youtube.com/user/keeroyz/videos

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1063
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 82

Re: Assimp -> Ogre adaptor

Post by xrgo » Mon Jul 31, 2017 2:12 am

frostbyte wrote:in my desperation i'm actually considering on adding blender+ogreKIT( it has an ogre blender importer inside )
I do this in my engine, I actually use blender as my mesh/scene/material/physics editor and I am pretty satisfied. While ago I did some tests and the loading speed was the same as loading the .mesh file
0 x

User avatar
EricB
Gnome
Posts: 316
Joined: Fri Apr 09, 2010 5:28 am
Location: Florida
x 105
Contact:

Re: Assimp -> Ogre adaptor

Post by EricB » Mon Jul 31, 2017 2:23 am

xrgo wrote:
frostbyte wrote:in my desperation i'm actually considering on adding blender+ogreKIT( it has an ogre blender importer inside )
I do this in my engine, I actually use blender as my mesh/scene/material/physics editor and I am pretty satisfied. While ago I did some tests and the loading speed was the same as loading the .mesh file
Practically the same advice me and Joey gave him (Aiden) on IRC. (Although I leave it our subcontractor if they want to use Blender or Easy Ogre Exporter...)
0 x
Image

frostbyte
Orc Shaman
Posts: 737
Joined: Fri May 31, 2013 2:28 am
x 14

Re: Assimp -> Ogre adaptor

Post by frostbyte » Mon Jul 31, 2017 4:01 pm

EricB wrote:
xrgo wrote:
frostbyte wrote:in my desperation i'm actually considering on adding blender+ogreKIT( it has an ogre blender importer inside )
I do this in my engine, I actually use blender as my mesh/scene/material/physics editor and I am pretty satisfied. While ago I did some tests and the loading speed was the same as loading the .mesh file
Practically the same advice me and Joey gave him (Aiden) on IRC. (Although I leave it our subcontractor if they want to use Blender or Easy Ogre Exporter...)
hi guys, just wanted to ask whats few questions about ogreKit
whats the status of the ogreKit blender importer, what .blend version is supported, whats working/whats not( pose/blendShape animation? etc... ), other problems?
i guess you carved out the code and fitted it to your engine( unless your engine is based on ogreKit )
i'm wondering how hard would it be to turn it into a clean ogre plugin( without the rest of ogreKIT ) with its own github repo. it could be helpful for all ogre users, and also easier to maintain( share the load... :wink: )
if you have helpful code/tips please share :)

btw...if Aiden is wondering why not use assimp to load .blend files....it does'nt work( couldn't even load a cube )
assimp is an amazing effort and really cool software, but lots of formats are broken or half-baked( missing features.... )
blender seems to enjoy better importers since every major company want blender artists on its side
but for some reason most of blenders "non native format" exporters are crap( don't know the status of ogre exporter )
hence using blenders .blend files with a working ogrekit based importer is a supposed to be a more holistic solutions
0 x
the woods are lovely dark and deep
but i have promises to keep
and miles to code before i sleep
and miles to code before i sleep..

coolest videos link( two minutes paper )...
https://www.youtube.com/user/keeroyz/videos

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1063
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 82

Re: Assimp -> Ogre adaptor

Post by xrgo » Mon Jul 31, 2017 5:00 pm

We where using ogrekit while ago... the blender's DNA used by Ogrekit was for an old version but it worked with newer versions (at that time, don't know about the newewewer version)... but! the project is dead so we implemented our own loader (we use the blender parser form ogrekit and copied some code from but most its written from scratch ) and we also found a way to generate newer versions of the blender DNA used by the parser.
I can share the code! we are just in process of rewriting our engine and the blender loader part is very modular, not like a plugin but it shouldn't be so hard to turn it in to one. I am going to make a public repository tonight (if I managed to make some time) so everyone (but me... don't have the time yet) can contribute in making a plugin.
btw, I am using Ogre2.1, but the mesh loader makes mesh in 1.X format, then imports to v2, and to bullet shapes, and the material loader creates pbsdatablocks

EDIT: sorry! haven't had the time yet, and tomorow (2) I will be away form the computer, so I'll try on thursday
Last edited by xrgo on Wed Aug 02, 2017 3:17 am, edited 1 time in total.
0 x

frostbyte
Orc Shaman
Posts: 737
Joined: Fri May 31, 2013 2:28 am
x 14

Re: Assimp -> Ogre adaptor

Post by frostbyte » Mon Jul 31, 2017 8:35 pm

xrgo wrote:I can share the code! we are just in process of rewriting our engine and the blender loader part is very modular, not like a plugin but it shouldn't be so hard to turn it in to one. I am going to make a public repository tonight (if I managed to make some time) so everyone (but me... don't have the time yet) can contribute in making a plugin.
:shock: :o :) :P :D wow... just wow...
damm, i love this community, good smart people, great developers...sharing is caring :wink:
a huge huge huge thanks, you put a big smile on my face :D

and also thanks to Alden the for igniting this thread...
0 x
the woods are lovely dark and deep
but i have promises to keep
and miles to code before i sleep
and miles to code before i sleep..

coolest videos link( two minutes paper )...
https://www.youtube.com/user/keeroyz/videos

User avatar
Aiden
Halfling
Posts: 54
Joined: Fri Jul 14, 2017 3:16 pm
x 3

Re: Assimp -> Ogre adaptor

Post by Aiden » Tue Aug 01, 2017 11:31 am

frostbyte wrote: btw...if Aiden is wondering why not use assimp to load .blend files....it does'nt work( couldn't even load a cube )
assimp is an amazing effort and really cool software, but lots of formats are broken or half-baked( missing features.... )
I think I was able to load a .blend file once with that code, though I didn't load skeleton and materials as my code doesn't support that yet.
I'll do some testing and provide some feedback when I do.
I'm already working on Ogreassimp. I still think we can do this, atleast eventually we will, it's better to fix bugs than to never actually do anything, even if the bug lies within Assimp.
0 x

User avatar
Aiden
Halfling
Posts: 54
Joined: Fri Jul 14, 2017 3:16 pm
x 3

Re: Assimp -> Ogre adaptor

Post by Aiden » Tue Aug 01, 2017 11:35 am

xrgo wrote:I can share the code! we are just in process of rewriting our engine and the blender loader part is very modular, not like a plugin but it shouldn't be so hard to turn it in to one. I am going to make a public repository tonight (if I managed to make some time) so everyone (but me... don't have the time yet) can contribute in making a plugin.
btw, I am using Ogre2.1, but the mesh loader makes mesh in 1.X format, then imports to v2, and to bullet shapes, and the material loader creates pbsdatablocks
Yes please do, who knows maybe we could even integrate this into the plugin as some think ogreassimp can't load blend files.
I just hope we get enough dev support to work on the plugin.
0 x

User avatar
Aiden
Halfling
Posts: 54
Joined: Fri Jul 14, 2017 3:16 pm
x 3

Re: Assimp -> Ogre adaptor

Post by Aiden » Tue Aug 01, 2017 1:43 pm

frostbyte wrote: btw...if Aiden is wondering why not use assimp to load .blend files....it does'nt work( couldn't even load a cube )
assimp is an amazing effort and really cool software, but lots of formats are broken or half-baked( missing features.... )
I've tested it on a model I designed in blender, it's just a sphere with some facial features.
It loads it perfectly. The file used is in .blend format.

If there is a bug in loading complex models,I think we can fix it.
0 x

frostbyte
Orc Shaman
Posts: 737
Joined: Fri May 31, 2013 2:28 am
x 14

Re: Assimp -> Ogre adaptor

Post by frostbyte » Thu Aug 03, 2017 12:05 am

back to assimp topic... just wanted to mention assimp is much more than a format convertor, it has quite powerful and useful mesh pre/post-processing capabilities http://www.assimp.org/lib_html/postprocess_8h.html
ogreassimp does'nt expose them to the user( it always uses aiProcessPreset_TargetRealtime_Quality ) , it might be a good idea to do so since its not always desirable to mess with the mesh and if you do then at least you should know about it.
also the ogreassimp OgreProgressiveMesh addition is outdated( ogre1.9 ), i'll try to upgrade it to 1.10 once i get to this( i need it anyway...)

btw: blender DNA( .blend ) is a native c++ binary format, thus it loads as fast as ogre's .mesh
importing gets slow only when you try to load a very large xml based format
generally speaking i would say that all this "human readable" formats were created for moving content between different middleware/graphic engines and are not very suitable for use in production
0 x
the woods are lovely dark and deep
but i have promises to keep
and miles to code before i sleep
and miles to code before i sleep..

coolest videos link( two minutes paper )...
https://www.youtube.com/user/keeroyz/videos

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1063
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 82

Re: Assimp -> Ogre adaptor

Post by xrgo » Fri Aug 04, 2017 5:57 pm

Hello! I've made the repo:

https://github.com/yoyTeam/BlendLoader

this is for no reason ready to use/build, it needs lots of work to transform it in to a plugin, there are many things that are fitted to our specific needs, Its just a copy-paste of files from our engine (which maybe in a future we can also share). But it surely has everything needed to make a plugin. please use it as you wish =), and ask anything you want I'll try to answer as quick as possible
0 x

frostbyte
Orc Shaman
Posts: 737
Joined: Fri May 31, 2013 2:28 am
x 14

Re: Assimp -> Ogre adaptor

Post by frostbyte » Fri Aug 04, 2017 10:18 pm

xrgo wrote:Hello! I've made the repo:

https://github.com/yoyTeam/BlendLoader

this is for no reason ready to use/build, it needs lots of work to transform it in to a plugin, there are many things that are fitted to our specific needs, Its just a copy-paste of files from our engine (which maybe in a future we can also share). But it surely has everything needed to make a plugin. please use it as you wish =), and ask anything you want I'll try to answer as quick as possible
great job..., i believe this can quickly become a popular plugin among ogre user( once transformed into one )
and since its already "battle tested" i think it deserves a public announcement with its own post thread in a suitable sub-forum( either Artists or Ogre2.1 ), and maybe a wiki mention( if its not too soon )
lots of ogre users are desperate for any additional help with their content pipeline, many are eager to improve the situation, i'm sure this contribution will get the attention it deserves, so some PR is needed...

as for my self, i'm still with ogre1.10 so i'll need somewhen to make it work( luckily for me you could'nt generate tangents :lol: ), if i have something working i promise to fork and commit :D

any advice regarding on how to import materials with 1.10?
ogre1.10 does have HLMS backport but i'm not sure how to port the code( PBS definition should be the similar,or not?)
if you have any older/legacy code that worked for 1.x .materials, it can be very helpful...
anyhow, thanks for this useful contribution
cheers...
0 x
the woods are lovely dark and deep
but i have promises to keep
and miles to code before i sleep
and miles to code before i sleep..

coolest videos link( two minutes paper )...
https://www.youtube.com/user/keeroyz/videos

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1063
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 82

Re: Assimp -> Ogre adaptor

Post by xrgo » Fri Aug 04, 2017 11:19 pm

frostbyte wrote:i think it deserves a public announcement with its own post thread in a suitable sub-forum( either Artists or Ogre2.1 ), and maybe a wiki mention( if its not too soon )
I think its too soon, when is at least somehow usable
frostbyte wrote:any advice regarding on how to import materials with 1.10?
its really simple to be honest... if you see the method yMaterialMetaData::parseMaterial( Blender::Material *bMaterial ) we read the information from the Blender::Material *bMaterial, and store it in to the materialDefinition that its a yMaterialData... the yMaterialData its a structure that holds the data, in this case in Pbs metalness format... but it can be anything, with that you can later create an Ogre::Material as you wish. The key is that in the parser method we read the data serialized from the blender file, then you can do what you want, for eample we have a blink effect in our datablock/material (so we can highlight an object) and... since blender don't really have that opción we are using bMaterial->mode & MA_TANGENT_V which is the tangent shading option in the shading section in blender's material... or.. since blender doesn't have pbs (yet.. eevee is coming!!) we use the hardness as roughness, the specular as metalness, and so on... so its just a matter of making a convention with things that blender don't have
0 x

frostbyte
Orc Shaman
Posts: 737
Joined: Fri May 31, 2013 2:28 am
x 14

Re: Assimp -> Ogre adaptor

Post by frostbyte » Sat Aug 05, 2017 1:12 am

since blender doesn't have pbs
:o ha, i did'nt know that, i'm no cg artist and don't use this tools( i tried but blenders gui scared me away all the way back to writing Motorola 68000 machine code )...just want my engine to be able to support .blend files
thanks for the tips, i'll experiment when i get to it....
0 x
the woods are lovely dark and deep
but i have promises to keep
and miles to code before i sleep
and miles to code before i sleep..

coolest videos link( two minutes paper )...
https://www.youtube.com/user/keeroyz/videos

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1063
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 82

Re: Assimp -> Ogre adaptor

Post by xrgo » Sat Aug 05, 2017 1:57 am

frostbyte wrote:since blender doesn't have pbs

ha, i did'nt know that,
well... let me correct myself, apart from eevee (which is not ready yet), cycles now comes with a principled shader, that is basically a pbs shader, and the blender loader should be able to read that data and use it for creating ogre pbs datablocks, it just happen that we use blender internal and have to do those tricky things... we are waiting for eevee to be ready and then everything will fit
0 x

farrer
Halfling
Posts: 63
Joined: Mon Sep 12, 2011 7:35 pm
x 7

Re: Assimp -> Ogre adaptor

Post by farrer » Sat Aug 05, 2017 12:53 pm

xrgo wrote:Hello! I've made the repo:

https://github.com/yoyTeam/BlendLoader
Commenting here just to thank you for that!
0 x

User avatar
Aiden
Halfling
Posts: 54
Joined: Fri Jul 14, 2017 3:16 pm
x 3

Re: Assimp -> Ogre adaptor

Post by Aiden » Sun Aug 06, 2017 8:21 pm

xrgo wrote:Hello! I've made the repo:

https://github.com/yoyTeam/BlendLoader
Nice job. I've been a bit busy exploring Ogre Ver 1.9, I haven't had the time to seriously work on the said importer. I also noticed the Ogreassimp is for Ogre Ver 1.10 ,
I'm using Ver 1.9 with Visual Studio 2015 after failing to compile 1.10 sdk which also lacks learning material .

Seems I'll have to ditch cmake as a build tool for OgreAssimp, and instead build it as a new Visual studio project with Ogre Ver 1.9.
I've been porting my app from Opengl to Ogre3d so far it's been a success, the only thing remaining now is to enable my code to import materials, skeleton and fix the (complex mesh bug). I'm sure creating animations could've been impossible for me especially in Opengl.

Keep up the good work folks, we'll get there eventually.
0 x

User avatar
Aiden
Halfling
Posts: 54
Joined: Fri Jul 14, 2017 3:16 pm
x 3

Re: Assimp -> Ogre adaptor

Post by Aiden » Wed Aug 30, 2017 11:24 pm

Finally I've managed to find a solution to this problem with OgreAssimp.
The solution was right beneath our eyes. :D
Now the only thing that remains is bug fixing and materials, this shouldn't be hard to get done.

I managed to work on this as my project is currently stalled, however I feel bad that now am moving to Ogre 2.1.
I don't know how much things have changed there regarding manual meshes. I have not even tried moving the code there yet.

If we manage to fix the materials import to work right, then I think we should just push changes to the official OgreAssimp repo.
I've tested the code with various models, especially the ones that were getting trimmed and it looks good from here.
This time I had to make a class for the project.
You might want to use background resource loading with multi-threading as complex meshes may take a while to fully load.

I also may have removed some important flags which may need to be restored prior to loading specific file types in Assimp. I think a better solution is to parse the file extension first in order to select the respective import flags.

Code: Select all

[b][u]UPDATE:We are now using OgreAssimp as the base .[/u][/b]
[url=https://github.com/kenkit/ogre-assimp/tree/Ogre_Assimp_Adaptor]Github[Assimp -> Ogre adaptor][/url]

Here are some screenshots(sorry I couldn't find time to customize the scene for clearer ones).
Image

Tried adding the material above :D hahahaha but failed.
You may also be required to rescale your models to the appropriate size as seen from this very huge model that has so many triangles. There was also another way of doing this in Assimp via some transormation matrix(I think handling this from assimp would result in faster processing as we'll have reduced ogres work)

I'll polish the code if I get time, or I may just post it as it is and look into it much later(You can also help improve it)

EDIT:CODE TESTED ON OGRE 1.9 While OgreAssimp was from Ogrecave 1.10 repo
Last edited by Aiden on Mon Sep 04, 2017 6:49 pm, edited 4 times in total.
0 x

Post Reply