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!
Transporter
Minaton
Posts: 933
Joined: Mon Mar 05, 2012 11:37 am
Location: Germany
x 110

Re: OgreAssimpConverter

Post by Transporter »

jacmoe wrote:I guess the Zlib error occurs when Ogre is statically built, am I right?
If Ogre OR Assimp is statically built. Detecting static assimp is easy on windows. Just check if there is an assimp.lib and no assimp.dll.
jacmoe wrote:Looks like the CMake script for Assimp is coded by a bloody amateur - this calls for a fork, I think.
I agree to that! I also published a patch to fix DirectX detection for assimp_view tool (windows)

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 tested this with a static Assimp build and it doesn't want me to link ZLib statically, maybe it's just because OgreAssimp is not using it atm?
I'll boot into Windows and see what kind of trouble that'll bring. :)

Pushed a commit which changes the find assimp script to check against assimp/config.h instead of assimp/assimp.h - thanks.

<edit:>
The CMake script might be failing in places, but I am not too unhappy about it: at least they have chosen to use CMake, and it seems to work (ish).
It just needs some more love.
I might issue a pull request later on.
I shouldn't complain about things breaking in a 'master' branch - I can't resist, though.. :P
</edit>
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

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

Re: OgreAssimpConverter

Post by Transporter »

jacmoe wrote:I tested this with a static Assimp build and it doesn't want me to link ZLib statically, maybe it's just because OgreAssimp is not using it atm?
No, I think you compiled assimp WITHOUT zlib. If you do so, assimp includes zlib from the contrib/zlib (btw, an old version) subdirectory.

Let me summarize:
  • ogre static -> zlib is a dependency
  • assimp static with external zlib -> zlib is a dependency
  • assimp dynamic -> zlib is not a dependency
  • assimp static with internal zlib -> zlib is not a dependency
:shock: :? :roll:

I always compile assimp with external zlib dependency, because I build the current version for ogre so I can use it twice.

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 »

Of course I compiled it without internal zlib as I compiled it on Linux.

So, what you need is a way to 'reuse' your already compiled zlib instead of the internal zlib.

I am building it now, using contrib zlib, as it's intended on other platforms than *nix.
I'll look into how you'd specify your own zlib.

Neither option would make ogreassimp dependent on zlib, would it?
/* 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 »

Okay, Transporter:

WONTFIX :)

Because Assimp is using the internal CMake FindZLIB script which is inferior compared to the FindZLIB cmake script shipped with Ogre.
It doesn't handle separate debug/release library names, and doesn't have the option to define a ZLIB_HOME environment variable.
The reason why it works using the internal zlib is because it's an included project.

I tested it by setting the ZLIB_LIBRARIES an ZLIB_INCLUDE_DIR CMake values, but that will only work for one particular configuration.

This needs to be fixed by the Assimp team, not OgreAssimp. :)
We don't need to worry about what Assimp uses or not.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

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

Re: OgreAssimpConverter

Post by Transporter »

:D I've added a ticket to assimp bug tracker (http://sourceforge.net/tracker/?func=de ... id=1067632) to fix that zlib stuff. I'll make a post to their development forum (http://zfx.info/viewtopic.php?f=9&t=334&start=465) about the cmake file and zlib integration next week. If you like to add some improvements I could post them, too.

One word about ZLIB_LIBRARIES and ZLIB_INCLUDE_DIR. I use it and point on the release config because I belive that I don't need to debug zlib.

If you fix FindASSIMP use ai_assert.h instead of config.h. config.h is a common name which is used in many projects. ai_asset.h is mentioned by another bug ticket (http://sourceforge.net/tracker/?func=de ... id=1067632) as a good point.

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 »

Cool! :)

The only thing I'd like to add is that it would be great if they would prefix all their CMake variables with ASSIMP_ so that they get grouped properly in CMake grouped view.

That is
BIN_INSTALL_DIR - should be ASSIMP_BIN_INSTALL_DIR
INCLUDE_INSTALL_DIR - should be ASSIMP_INCLUDE_INSTALL_DIR
LIB_INSTALL_DIR - should be ASSIMP_INCLUDE_INSTALL_DIR
etc.

The only two which are in the ASSIMP group are ASSIMP_BUILD_ARCHITECTURE and ASSIMP_BUILD_COMPILER

As it is now, it's sort of impossible to know what settings are for Assimp and what settings are for other.

Just nitpick, but since it's so easy to do right, they ought to do it. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

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

Re: OgreAssimpConverter

Post by Transporter »

jacmoe wrote:The only thing I'd like to add is that it would be great if they would prefix all their CMake variables with ASSIMP_ so that they get grouped properly in CMake grouped view.
Ok, I've made a "large" patch to update assimp cmake. If you like you can add more changes. I use FindZLIB, FindDirectX and FindPkgMacros from Ogre.

Btw, they created their own "FindASSIMP" in C:\assimp\install\test\lib\cmake\assimp-2.0.

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 »

Looks great - need to test it though. :)

I'll check out their FINDAssimp script - good call.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
duststorm
Minaton
Posts: 921
Joined: Sat Jul 31, 2010 6:29 pm
Location: Belgium
x 80
Contact:

Re: OgreAssimpConverter

Post by duststorm »

CMAKE is really still a lot of magic to me. I should take the time to get to know it better. (and make a decent build setup for the recast demo ;))
At least I already found out how it uses pkg-config to find libraries :)
Developer @ MakeHuman.org

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

Re: OgreAssimpConverter

Post by Transporter »

The developers like to release assimp 3.0 this week. They will look through the cmake patch and copy the interesting parts for the next release.

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 »

Sounds great. :)
I guess OgreAssimp will use Assimp 3 then, instead of unstable.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

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

Re: OgreAssimpConverter

Post by Transporter »

Assimp 3 is ready. It has an own branch on svn. They have to merge version 3 to trunk and create the new SDK. Release notes are also missing but the code base is complete for version 3. From my point of view it's not a big thing and they didn't use our contributions.

I've made a new patch for ogreassimp to add zlib as an optional component as long as there is no detection on static assimp lib.

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 guess I need to send them a letter telling them that they are dumb asses.. They should fix their broken script. ;)

Thanks for the patch.
I'd rather patch AssImp itself, but I'll make it work anyway. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
Mind Calamity
Ogre Magi
Posts: 1255
Joined: Sat Dec 25, 2010 2:55 pm
Location: Macedonia
x 81

Re: OgreAssimpConverter

Post by Mind Calamity »

There's a pretty big issue in the sub-mesh creation, namely the usage of 16-bit indices instead of 32-bit. This screws up larger high-poly meshes, and an easy fix is to just change the integers used from uint16 to uint32, and also change the parameter to the createIndexBuffer function from Ogre::HardwareIndexBuffer::IT_16BIT to Ogre::HardwareIndexBuffer::IT_32BIT.

I already added an issue on the BitBucket repo here, but just to be safe, and besides it's easier to find stuff on the forums. ;)
BitBucket username changed to iboshkov (from MindCalamity)
Do you need help? What have you tried?
- xavier
---------------------
HkOgre - a Havok Integration for OGRE | Simple SSAO | My Blog | My YouTube | My DeviantArt

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 »

Nice catch!
I think it's safe to assume that 32bit indices works in all places. I'll change that.
Will probably fix some 'broken' models. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

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

Re: OgreAssimpConverter

Post by Transporter »

Assimp version 3.0 released.

http://assimp.sourceforge.net/main_downloads.html

But without bugfixing the CMake files. :(

Edit: I've added new patches with new settings (eg boost 1.51).
Attachments
ogreassimp-cmake.patch
Patch for ogreassimp
(2.59 KiB) Downloaded 186 times
assimp-cmake.patch
Patch for assimp 3.0
(31.24 KiB) Downloaded 213 times

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

Re: OgreAssimpConverter

Post by Transporter »

http://assimp.svn.sourceforge.net/viewv ... ision=1293

Patch accepted! I'll stay in contact with the developers.

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 »

Awesome! :)

I'll tend to this when my summer schedule allows.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

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

Re: OgreAssimpConverter

Post by Transporter »

I've found a bug in AssimpLoader.cpp (204):

Code: Select all

#ifdef USING_BYATIS
                Ogre::VertexDeclaration* newDcl =
                    sm->vertexData->vertexDeclaration->getAutoOrganisedDeclaration(mMesh->hasSkeleton(), mMesh->hasVertexAnimation(), false);
#else
                Ogre::VertexDeclaration* newDcl =
                    sm->vertexData->vertexDeclaration->getAutoOrganisedDeclaration(mMesh->hasSkeleton(), mMesh->hasVertexAnimation());
#endif
It should be

Code: Select all

#if (OGRE_VERSION >  ((1 << 16) | (7 << 8) | 0))
                Ogre::VertexDeclaration* newDcl =
                    sm->vertexData->vertexDeclaration->getAutoOrganisedDeclaration(mMesh->hasSkeleton(), mMesh->hasVertexAnimation(), false);
#else
                Ogre::VertexDeclaration* newDcl =
                    sm->vertexData->vertexDeclaration->getAutoOrganisedDeclaration(mMesh->hasSkeleton(), mMesh->hasVertexAnimation());
#endif
or it's not possible to compile it with Ogre 1.9.0.
  • Add support for boost 1.5x
  • Optional ZLIB switch
  • Update assimp include dir detection (config.h is a common name)
  • Fix to compile ogreassimp with ogre 1.9.0
Edit: New patch available.
Last edited by Transporter on Thu Sep 13, 2012 8:40 am, edited 1 time in total.

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 a lot - will apply in a month or so.
((Mathematics studies atm))
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

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

Re: OgreAssimpConverter

Post by Transporter »

jacmoe wrote:Thanks a lot - will apply in a month or so.
((Mathematics studies atm))
Good luck! Nice to have you back.

Edit: New patch available.
  • Update support for boost 1.48 to 1.53
  • Optional ZLIB switch
  • Update assimp include dir detection (config.h is a common name)
  • Fix to compile ogreassimp with ogre 1.9.0
Last edited by Transporter on Tue Jan 29, 2013 11:31 am, edited 1 time in total.

AlphaSND
Gnoblar
Posts: 8
Joined: Sun Oct 06, 2002 11:19 pm
Location: France

Re: OgreAssimpConverter

Post by AlphaSND »

Hello,

Here is a loosely patch for the file AssimpLoader.cpp as a model was crashing the converter:

Code: Select all

@@ -1326,7 +1326,8 @@
     } // if mesh has bones
 
     // Finally we set a material to the submesh
-    submesh->setMaterialName(matptr->getName());
+    if (!matptr.isNull())
+      submesh->setMaterialName(matptr->getName());
 
     return true;
 }
As a side note, we have compiled it with Ogre 1.8.1 SDK (Windows only), if someone needs it in compiled form (i didn't found it): http://www.purebasic.com/download/OgreA ... verter.zip

Thanks for the nice work on this tool !

Fred

cloud
Gremlin
Posts: 196
Joined: Tue Aug 08, 2006 6:45 pm
x 14

Re: OgreAssimpConverter

Post by cloud »

Hi all.

I've just finished an OgreAssimpConverter version 2, I thought using assimpView's SceneAnimator would be a good idea, and might fix some issues. Although I don't think its made the slightest bit of difference. Additionally theres a Loader2WithTinyXML for the scene graph, you can use it without that (with Loader2) but only with the LP_METHOD_SINGLE_MESH flag set. In sum then this is just a prettied up and simplified down version, with a few new options.

Here it is
http://www.pearsonp.force9.co.uk/OgreAssimp2.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 »

Do you want to be added to the repo, Cloud ? :)

No obligations, but you can get write access any time you want.

I'll see about putting it 'up there' - perhaps even during the week. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

Post Reply