BrokeAss Games Releases FBX to Torque Community!
by Chris Calef · 01/31/2013 (2:41 pm) · 22 comments

Wow, two blogs in two days is, I believe, an official record for me... but remember how I said there would be more exciting news in the near future?
Well, after having this thread brought to my attention a couple of days ago, I just couldn't hold out any longer. BrokeAss Games has officially decided to release our FBX importer/exporter to the Torque Community, as a thank you for all the great things you all have done for us and for Torque over the years!
You can grab it right now and start playing with it (AFTER you read the compiling instructions below!) from here:
github.com/ChrisCalef/Torque3D - branch fbx
Unfortunately, I must admit that this announcement full of good news comes with a bit of bad news as well... while I knew it needed a lot of work, I was not aware until today of the extent to which my FBX work interferes with the pre-existing Collada importer in T3D. It is still possible to import simple collada models, but the soldier_rigged.dae player blows up all over the place. Turns out I never went back and tested that... sigh.
That being the case, I didn't bother making a pull request to GG or anything, since it obviously isn't ready to be added to the trunk yet. However, the code is available for scrutiny, and if you get it running, even without collada functioning you can make this into a build that lets you import fbx models and then copy the working dts models over to your regular project. (I know, this is lame, but it is merely where we are today, not where we expect to end up!)
By releasing this into the community, I am fervently hoping, of course, that somebody else with some programming chops might take an interest and start fixing and expanding this work. I am fully expecting to roll up my sleeves and get back in there myself as soon as possible, but after spending the last month and a half on various non-paying Torque-related projects, at this point I am going to have to step back for a bit and pursue some of my neglected contracting customers.
Shameless self promotion: if anyone with deep pockets (or even shallow pockets) in the community wanted to actually pay me to put some serious time into this, now that it's property of everyone, I could definitely bump it up on my priority list.
------------------------------------------------------------------------
Now, to get it running, you have to download the FBX SDK from here, first:
usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=10775847
Then you need to make a directory in your Engine/libs folder, called fbxsdk, or something similar, and make sure it has the includes and libs from the fbx sdk in it. Then point your DLL project at those include/lib directories, and include the appropriate fbx lib as in input.
I've set up the Templates/Full solution under vs2008, if this helps.
Finally, you also have to copy the fbxsdk_20113_1.dll to your game directory.
Because of the collada problems, I added the old ForgeSoldier player model (I hope that's okay with GG legal?) and switched the player over to there, just to get up to game state.
I also removed the mountImage for the player's weapon, because the collada-based gun was also breaking the build.
I think that's all there was to do... but I could well be wrong. If anybody tries it and needs help, let me know. One word of warning, I compiled this on last year's version of FBX SDk, if the new one has broken anything you could get compile errors related to that.
Otherwise, good luck, and have fun!
#2
01/31/2013 (3:01 pm)
*CHEER* that's Great news.. THANKS!!
#3
If you get into the code, you'll notice a huge amount of commented code at the bottoms of some of the files - what I did was make copies of the relevant parts of the collada importer, and then fill in only what I needed to get the FBX import working, but I left a lot of the commented code in there in case it becomes useful as we flesh this thing out.
FBX requires MUCH less work than importing Collada, because we get to use the FBX SDK, which has its own load/save functions. At no point do we actually have to step through and parse the FBX file itself - the work is all in asking the SDK for information about the file, and fitting that information where it belongs in the DTS model.
Really the FBX SDK is a blast to work with, it is *very* powerful. Supposedly you can even do things like save to Collada, from the FBX SDK, although I've had trouble making that work so far. Definitely spend some time in the FBX SDK programmer's guide, it's worth reading.
01/31/2013 (3:35 pm)
My pleasure!If you get into the code, you'll notice a huge amount of commented code at the bottoms of some of the files - what I did was make copies of the relevant parts of the collada importer, and then fill in only what I needed to get the FBX import working, but I left a lot of the commented code in there in case it becomes useful as we flesh this thing out.
FBX requires MUCH less work than importing Collada, because we get to use the FBX SDK, which has its own load/save functions. At no point do we actually have to step through and parse the FBX file itself - the work is all in asking the SDK for information about the file, and fitting that information where it belongs in the DTS model.
Really the FBX SDK is a blast to work with, it is *very* powerful. Supposedly you can even do things like save to Collada, from the FBX SDK, although I've had trouble making that work so far. Definitely spend some time in the FBX SDK programmer's guide, it's worth reading.
#4
This is awesome! I will have to try this out with the soldier using the Blender FBX export to see how it does.
01/31/2013 (3:38 pm)
@Chris, This is awesome! I will have to try this out with the soldier using the Blender FBX export to see how it does.
#5
If you get a shape but it doesn't have any materials, the problem is usually that the fbx sdk made a directory called "(model name).fbm" and put the texture in there. If you simply drag the textures up to the same directory the cached dts file is in, it should work.
Now, hopefully some other programmer out there will sign on to help me make this better!
01/31/2013 (3:48 pm)
Well, my advice is start simple. First make a box. :-) I don't want to discourage anyone but many, many fbx models fail as it stands right now. There are issues, let's put it that way.If you get a shape but it doesn't have any materials, the problem is usually that the fbx sdk made a directory called "(model name).fbm" and put the texture in there. If you simply drag the textures up to the same directory the cached dts file is in, it should work.
Now, hopefully some other programmer out there will sign on to help me make this better!
#6
Thank you.
Ron
01/31/2013 (4:14 pm)
F**kin Brilliant! You rock Chris. Even with the issues it's a lot further along than starting from scratch. I would always rather chase bugs then reinvent the wheel.Thank you.
Ron
#7
01/31/2013 (4:21 pm)
Speechless. I hope this make it way into T3D as an out the box feature at some point! Thanks
#8
01/31/2013 (4:37 pm)
@Ron: You're welcome! I just couldn't bear to see you guys considering starting from scratch on this while I camp on my code. :-)
#9
01/31/2013 (6:55 pm)
Thank you for this addition. It should help emensely for not having to write one from scratch.
#10
thanks chris.
u have saved a lot of time.i was digging into the links scott posted on that thread.but no need now.
time to improve your's one.
[edit]
a forum section like Collada Test could be helpful to improve fbx importer/exporter(http://www.garagegames.com/community/forums/57)
02/01/2013 (2:52 am)
Hip Hip Hurray!thanks chris.
u have saved a lot of time.i was digging into the links scott posted on that thread.but no need now.
time to improve your's one.
[edit]
a forum section like Collada Test could be helpful to improve fbx importer/exporter(http://www.garagegames.com/community/forums/57)
#11
Maybe now some artists types could heckle a programmer type or two just enough to get this polished enough for official inclusion sooner than it would have been.
02/01/2013 (9:32 am)
Alright Chris, the next round is on me!Maybe now some artists types could heckle a programmer type or two just enough to get this polished enough for official inclusion sooner than it would have been.
#12
02/01/2013 (11:36 am)
Cheers m8, cant figure who rocks the most atm -gg or you guys ;)
#13
02/04/2013 (5:40 am)
Thank you, Chris! I hope I'll be able to dive in soon! What an awesome move!
#15
which FBX SDK versionu used?
i am getting errors for header files.
"#include <fbxfilesdk/kfbxio/XXXXXX.h>"
i did not found any "fbxfilesdk".
tried to change locations but it create some other problems with some Constants declarations.
i am using vs2010.
not vs2008.
"Finally, you also have to copy the fbxsdk_20113_1.dll to your game directory."
where is that dll?
edit:
ohh. missed.
"One word of warning, I compiled this on last year's version of FBX SDk, if the new one has broken anything you could get compile errors related to that."
"Then you need to make a directory in your Engine/libs folder, called fbxsdk, or something similar, and make sure it has the includes and libs from the fbx sdk in it. Then point your DLL project at those include/lib directories, and include the appropriate fbx lib as in input."
04/19/2013 (12:26 pm)
@chris,which FBX SDK versionu used?
i am getting errors for header files.
"#include <fbxfilesdk/kfbxio/XXXXXX.h>"
i did not found any "fbxfilesdk".
tried to change locations but it create some other problems with some Constants declarations.
i am using vs2010.
not vs2008.
"Finally, you also have to copy the fbxsdk_20113_1.dll to your game directory."
where is that dll?
edit:
ohh. missed.
"One word of warning, I compiled this on last year's version of FBX SDk, if the new one has broken anything you could get compile errors related to that."
"Then you need to make a directory in your Engine/libs folder, called fbxsdk, or something similar, and make sure it has the includes and libs from the fbx sdk in it. Then point your DLL project at those include/lib directories, and include the appropriate fbx lib as in input."
#16
lots of files missing.
can u upload your "Engine\lib\fbxsdk" ?
04/19/2013 (12:52 pm)
without that old sdk version may be it is not possible to compile.lots of files missing.
can u upload your "Engine\lib\fbxsdk" ?
#17
I'm on a different computer today but I will take another look at that and upload that directory for you.
05/09/2013 (11:42 am)
Oh, dear, sorry ahsan! I totally dropped the ball on this thread! I'm on a different computer today but I will take another look at that and upload that directory for you.
#18
here is the link for the sdk:
http://images.autodesk.com/adsk/files/fbx20113_1_fbxsdk_win.exe
+ need to add some line into "project.conf".
//fbx 2011.3
addProjectDefine( 'FBXSUPPORT' );
addEngineSrcDir( "ts/fbx" );
addProjectLibInput('C:/Program Files/Autodesk/FBX/FbxSdk/2011.3/lib/vs2010/fbxsdk_20113.lib');
addProjectLibInput('C:/Program Files/Autodesk/FBX/FbxSdk/2011.3/lib/vs2010/fbxsdk_20113d.lib');
addProjectLibDir( "C:/Program Files/Autodesk/FBX/FbxSdk/2011.3/lib/vs2010" );
addIncludePath( "C:/Program Files/Autodesk/FBX/FbxSdk/2011.3/include" );
i will post full description when time is available.
in case if u follow this:
"Then you need to make a directory in your Engine/libs folder, called fbxsdk, or something similar, and make sure it has the includes and libs from the fbx sdk in it. Then point your DLL project at those include/lib directories, and include the appropriate fbx lib as in input."
then :
//fbx2013
//addProjectDefine( 'FBXSUPPORT' );
//addEngineSrcDir( "ts/fbx" );
//addProjectLibDir( getAppLibSrcDir() ."fbxsdk/lib/vs2010/x86" );
//addIncludePath( getAppLibSrcDir() . "fbxsdk/include" );
//addIncludePath( "C:/Program Files/Autodesk/FBX/FBX SDK/2013.3/include" );
//addProjectLibDir( "C:/Program Files/Autodesk/FBX/FBX SDK/2013.3/lib/vs2010/x86" );
05/09/2013 (6:08 pm)
no need of that.i have fixed it.here is the link for the sdk:
http://images.autodesk.com/adsk/files/fbx20113_1_fbxsdk_win.exe
+ need to add some line into "project.conf".
//fbx 2011.3
addProjectDefine( 'FBXSUPPORT' );
addEngineSrcDir( "ts/fbx" );
addProjectLibInput('C:/Program Files/Autodesk/FBX/FbxSdk/2011.3/lib/vs2010/fbxsdk_20113.lib');
addProjectLibInput('C:/Program Files/Autodesk/FBX/FbxSdk/2011.3/lib/vs2010/fbxsdk_20113d.lib');
addProjectLibDir( "C:/Program Files/Autodesk/FBX/FbxSdk/2011.3/lib/vs2010" );
addIncludePath( "C:/Program Files/Autodesk/FBX/FbxSdk/2011.3/include" );
i will post full description when time is available.
in case if u follow this:
"Then you need to make a directory in your Engine/libs folder, called fbxsdk, or something similar, and make sure it has the includes and libs from the fbx sdk in it. Then point your DLL project at those include/lib directories, and include the appropriate fbx lib as in input."
then :
//fbx2013
//addProjectDefine( 'FBXSUPPORT' );
//addEngineSrcDir( "ts/fbx" );
//addProjectLibDir( getAppLibSrcDir() ."fbxsdk/lib/vs2010/x86" );
//addIncludePath( getAppLibSrcDir() . "fbxsdk/include" );
//addIncludePath( "C:/Program Files/Autodesk/FBX/FBX SDK/2013.3/include" );
//addProjectLibDir( "C:/Program Files/Autodesk/FBX/FBX SDK/2013.3/lib/vs2010/x86" );
#19
Also, if you'd like to make a fork and start sending in pull requests, that too would be *most* welcome.
05/10/2013 (4:05 pm)
Oh, great, so has it worked for you then? Did you manage to import an FBX? I recommend starting simple, or else starting with one of the ones I can demonstrate to be functional. The Mixamo characters from Unity seem to do pretty well, at least the free soldier character pack worked out nicely. I have some completely broken code in there somewhere, though, because MANY models end up with their skeletons all out of whack. I must be making some erroneous assumption or missing some whole part of the puzzle, more eyes on the code would be very welcome.Also, if you'd like to make a fork and start sending in pull requests, that too would be *most* welcome.
#20
i am busy with my current project.
so did not get chance to trace out actual reason.
i will look into it whenever get some time.
05/10/2013 (6:54 pm)
i tried with stock models from unity 3d. it always crashed.i am busy with my current project.
so did not get chance to trace out actual reason.
i will look into it whenever get some time.

Torque 3D Owner Scott Warren
I can't thank you enough Chris. T3D needs this in the Trunk, seriously.