Open Asset Import Library for BlitzMax

BlitzMax Forums/MiniB3D Module/Open Asset Import Library for BlitzMax

Difference(Posted 2009) [#1]
A 3D model import module for Blitzmax.

It wraps the "Open Asset Import Library" Assimp, so that it can be staticly linked to your Blitzmax programs.

This initial release is without animation and hierarchy.

http://code.google.com/p/blitzmax-assimp/

Feedback appreciated


Brucey(Posted 2009) [#2]
Nice module!

You don't need any of that "module" stuff at the top of source.bmx :-)


Difference(Posted 2009) [#3]
Thanks Brucey. :-)

I did try to split it up the way you do, but forgot to remove that.
Cleaned up now.


DreamLoader(Posted 2009) [#4]
nice work,a huge project but really userful,
some format are very nice like the .dae, .ter...
hope we can see the animation version soon,keep up the great work!


rs22(Posted 2009) [#5]
Brilliant! I can't wait for animated support. That'll be absolutely fantastic. Good work!


Volker(Posted 2009) [#6]
Ok, I am one of those "pulling their hair out".
I have this path: blitzmax\mod\scheutz.mod\assimp.mod

I use tortoise svn.
Now I rightclick on the assimp.mod folder; choose svn checkout
and enter the URL "http://blitzmax-assimp.googlecode.com/svn/trunk/ blitzmax-assimp-read-only".
I get "URL http://blitzmax-assimp.googlecode.com/svn/trunk/%20blitzmax-assimp-read-only does not exist".

Don't know why i am again and again running in this trouble with svn..


Brucey(Posted 2009) [#7]
You have a space between the "/" and "blitzmax-assimp-read-only".

That probably shouldn't be there?



Brucey(Posted 2009) [#8]
Actually... you've read the instructions wrong ;-)

This is the URL you enter :

http://blitzmax-assimp.googlecode.com/svn/trunk/

If you were using the command-line, you would also want to add a folder in which to checkout to.
With tortoise you would browse for that folder instead.


Volker(Posted 2009) [#9]
Pheew, just in time Brucey. Some hairs left.
Actually... you've read the instructions wrong ;-)

Ouch! Already wondered about the space turned in %20.


Difference(Posted 2009) [#10]
I've committed a new version (revision 34) that loads the nodes.

I'm having major trouble decomposing the aiMatrix for the nodes into minib3d 3D space, so if anybody can help it will be mush appreciated.

[EDIT] I've started a cry for help here: /Community/posts.php?topic=82644


Volker(Posted 2009) [#11]
Hi Peter,

I just tracked down an error, that your function "aiLoadMiniB3D"
fails (just exits the application) when loading some files, if
I import Brucey's BaH.magick module.
It' s available at maxmods.googlecode.com, but not yet official
published. I do not really need it, but perhaps it's of interest
for you or Brucey.

If you enter "import bah.magick" in your "show-all-samples.bmx"
if fails compiling:




Difference(Posted 2009) [#12]
Hi Volker thanks for testing.

I got latest versions from SVN blitzmax-assimp r41, and bah.mods r586

And did a "Build All modules"

I can compile "Showallsamples" fine and import bah.magic

In debugmode, I do get
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Runtime Error!

Program: ...heutz.mod\assimp.mod\examples\show-all-samples.debug.exe



This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.


---------------------------
OK   
---------------------------


at Local tex:TTexture=LoadTexture(texFilename)

with

../scheutz.mod/assimp.mod/assimp/test/models/3DS/cube_with_diffuse_texture.3DS
../scheutz.mod/assimp.mod/assimp/test/models/3DS/TEST.PNG


and the C++ runtime sends a signal!:22 to the Bmax ide.



so my guess is bah.magic is overriding Loadtexture() in some way, and that it does something wrong or strange...

over to you Brucey... ;-)


Brucey(Posted 2009) [#13]
Something to do with how functions have been "externed'. One uses WINAPI the other doesn't.

It seems that when magick is linked, what it thinks those functions were defined as (with the win32 naming convention), are not actually like that. I'll maybe have a play with it tomorrow.
Good ole Windows.


Volker(Posted 2009) [#14]
Addition:
Here it fails at
assimp.mod\assimp\test\models\3DS\test1.3ds
assimp.mod\assimp\test\models\ASE\Rifle2.ase
without any warning.
BMax 1.28; newest BaH.magick; newest assimp.mod.
Did just "Rebuild modules".


Brucey(Posted 2009) [#15]
Hmm... I'll have to see if I have enough room for *another* copy of boost if I'm going to get all this building... ack ! :-p


Difference(Posted 2009) [#16]
@Volker: Is this with debug on?

I think you are having other errors than me. (the compile errors)

I trace the error I get to "magic.bmx":

Type TPixmapLoaderM Extends TPixmapLoader

Local image:TMImage = TMImage.CreateFromBlob(blob)

in magic.bmx, so it seems bah.magic *does* in some way interfere/take over pixmap loading ?

The order of my imports (if that matters) are:
Import scheutz.assimp
Import sidesign.minib3d
Import bah.magick


[EDIT]: Yes, it would indeed be nice to be able to share such libs as boost in some common way, without having to reconfigure external SVNs to use them


Volker(Posted 2009) [#17]
Yes, debug is on. Release mode makes no difference.
Same order of imports here.
Good night (or day, wherever you are) guys. I really have to view another episode from 4400 before sleeping :-)


Brucey(Posted 2009) [#18]
in magic.bmx, so it seems bah.magic *does* in some way interfere/take over pixmap loading ?

Yes, that's the whole point of an image library ;-)

Does assimp include its own copy of libpng? Or are you importing brl.pngloader?

If the latter, ideally you leave it up to the user to import their preferred loaders.
If the former, it's... a little more complicated ...


Difference(Posted 2009) [#19]
in magic.bmx, so it seems bah.magic *does* in some way interfere/take over pixmap loading ?

Yes, that's the whole point of an image library ;-)


I disagree. Surely an image library does not *have to* interfere with bmax native functions?
It seems to me, that overriding pixmap loaders is a design choice you have made.

My sample program does not use the framework command, so I guess I import everything, but not brl.pngloader in particular.

I don't think assimp does anything with images at all, and I can't find any reference to libpng. I'll try a better debug, to tell you exactly where magic is crashing


Brucey(Posted 2009) [#20]
Surely an image library does not *have to* interfere with bmax native functions?

I don't think it interferes at all. :-)
If you decide to use BaH.* modules without a Framework, then you are likely to encounter issues in certain areas (examples include BaH.Random, BaH.FreeImage, BaH.Magick).
The image modules are designed as drop-in replacements. BlitzMax's Framework system is designed to allow this.

It seems to me, that overriding pixmap loaders is a design choice you have made.

I would say it is a positive design choice. It doesn't override. Whatever pixmap loaders are available will be iterated over until the image can be loaded. However, having multiple of the same core libraries compiled into the same binary is probably not very healthy.

so I guess I import everything

Everything in BRL and Pub.

Of course the easy answer is not to use BaH.Magick (or BaH.FreeImage), and stick to BlitzMax's native functions :-)


Brucey(Posted 2009) [#21]
Compile Error: File 'C:/Program Files/BlitzMax/mod/scheutz.mod/assimp.mod/assimp/code/irrXML/irrXML.cpp' not found
[C:/Program Files/BlitzMax/mod/scheutz.mod/assimp.mod/source.bmx;6;40]

:-(

I guess the checkout didn't work properly...


Brucey(Posted 2009) [#22]
Seems the "irrXML" folder is not there at all.

That's one reason I don't use external repositories - they can change and break your code.


Difference(Posted 2009) [#23]
Compile Error: File 'C:/Program Files/BlitzMax/mod/scheutz.mod/assimp.mod/assimp/code/irrXML/irrXML.cpp' not found
[C:/Program Files/BlitzMax/mod/scheutz.mod/assimp.mod/source.bmx;6;40]


:-(

I guess the checkout didn't work properly...

I've updated a little time ago, so it should compile ok if you check out again.

To prevent this from happening again, I've locked boost and assimp to specific revisions. I'll be sure to check everything compiles next time before I update revisions again! :-)


Brucey(Posted 2009) [#24]
This in minib3d does not help :
Import BRL.BMPLoader
Import BRL.PNGLoader
Import BRL.JPGLoader

Best to comment those out and let the user decide how they want to load images. (or let the module designer dictate it for you - the choice is yours :-)

Also, you will need the "config" folder in magick's example folder to be available locally for the app - it tells the library what features to support.


Difference(Posted 2009) [#25]
Thanks Brucey.
Including the config folder seems to solve the problems for me.

@Volker: There is a problem with some files that crash aiImportfile(), when the aiProcess_PreTransformVertices flag is used.

assimp authors are working on it to try and iron that out:
http://groups.google.com/group/bmx3d/browse_thread/thread/fdcb073d834b5e8f

https://sourceforge.net/forum/forum.php?thread_id=2869243&forum_id=817653


Volker(Posted 2009) [#26]
Hi Peter,

just found this in the sourceforge forum:
OBJ loads ok now. :-)

Hm, problem seems to be solved?
I will not support .dae until I hear from you.

Btw, under what license is your mod?
I want to publish a freeware version of my 3D content viewer in a few days
(who want's to do some betatesting, drop me a note).
Is this ok?


Difference(Posted 2009) [#27]
Hi Volker

Bye,
Alex

PS: Guys, please remember, Assimp is currently no *stable* release,
it's a beta in development. But I think we can profit from each
other :-)


And for blitzmax - assimp?, It's even more in a Beta state!

There are several minor problems, mainly when using the flag mentioned above, but they will I hope be ironed out along the way.
Collada import is not more unstable than other formats.

You can find the license on the googlecode page.
It's "The New BSD Style License" , so you can basically do what you want, except use my name or alias to promote or endorse what you release.

A notice that you are using Beta versions of assimp and blitzmax-assimp will be much appreciated, as will a link to blitzmax-assimp google code page.

It will be very useful, if you, when you find files (not already included with assimp) that crash aiFileImport() , (and only that), that you post a link on the assimp sf page, so that the authors has a chance to iron those out.


Volker(Posted 2009) [#28]
It will be very useful, if you, when you find files (not already included with assimp) that crash aiFileImport() , (and only that), that you post a link on the assimp sf page, so that the authors has a chance to iron those out.

Yep, I will create a special error check for this and browse some files.


jhocking(Posted 2009) [#29]
This looks like it could be very useful for what I'm looking into right now. I'm trying to figure out the best art pipeline from Maya to b3d file format, and one thought I'm pursuing is exporting Collada from Maya and converting that to b3d. Would your module be helpful for that? If so, using your module to write a file format converter would be extremely useful for Blitz3D/minib3d as that would enable a solid art pipeline from both Maya and 3ds max.

Also, I remember you made an xml>b3d converter years ago. Looks like you're taking file conversions to the next level!


Difference(Posted 2009) [#30]
I'm planning to update the module soon. I'm mainly interested in handling static models, but since it's an open source project, I'm inviting anybody to join, and help make animations convert nicely to.

I think I'll try to make a test program, that simply saves b3d files, so that it can be used as a file converter.

Bumb me if I don't complete a new version soon :-)


gman(Posted 2009) [#31]
Hi Peter. Great project :) If you are still having issues with MiniB3D and animation, I wrote a model importer for MiniB3D using Irrlicht as the loader. Not sure if the source would be helpful in your quest or not but it did have animation support. Would be more than happy to pass it along if you are interested.


jhocking(Posted 2009) [#32]
Sweet well that's good to know. Just started messing with minib3d on iphone so that's why I've been thinking about Maya/Collada to b3d.


Difference(Posted 2009) [#33]
Updated to assimp version 508.
This version does not need the boost library.


Difference(Posted 2009) [#34]
@gman: Sorry for a really late answer, but I haven't really gotten the parent child transformations to work properly yet.

I won't be trying to ad animation before that is in place.
I'm hoping a that a new minib3d transform system and the recent update to assimp internal quats, will eventually end up in correct transforms on the blitzmax side.

As it is now I'm just guessing as I haven't solved /Community/posts.php?topic=82644 to obtain consistent results.


Danny(Posted 2009) [#35]
<ignore-sorry>


jkrankie(Posted 2009) [#36]
How come you can't use SVN?

Cheers
Charlie


Danny(Posted 2009) [#37]
lol - Never used SVN before, but didn't think it was that simple ;) Getting the goodies now!