Giter Site home page Giter Site logo

ofxfbx's Introduction

ofxFBX

FBX version 7.4

FBX version 7.4

FBX version 7.4

Updated to maintain the hierarchy of the fbx file. Added getter / search functions. Not compatible with older versions of the addon. Currently supporting OSX (x86_64 and arm64), iOS (x86_64, armv7, armv7s and arm64), Windows Visual Studio (x64) Linux and Linux64. Tested with OF >= v0.11.2. Please check older releases for compatibility with older versions of OF. Linux support with help from @themancalledjakob

Features include:

  • Multiple Animations with individual control
  • External Bone Control with Animations
  • Linear Bone Animation Blending between two animations
  • Define animations
  • Textures
  • Materials
  • Cached meshes and scenes for faster rendering
  • Individual mesh manipulation
  • Enable and disable rendering of certain assets in the scene
  • Caching of mesh animations
  • Getter / search functions
  • Maintains fbx hierarchy
  • Scene caching for faster loading of the same scene multiple times
  • Conversion to different units

If you have a fbx with a single animation that needs to be broken up into separate animations, you can try the following: mScene.load( "Alligator.FBX", tsettings );

mScene.clearAnimations();

mScene.addAnimation("SwimBite", 81, 100 );

mScene.addAnimation("Swim", 61, 80 );

iOS Notes

The example projects include a ofApp.cpp and main.cpp. The project generator will be looking for ofApp.mm and main.mm. Please add the .cpp versions. You will need to tell the compiler to treat them as Objective-C++. Click on ofApp.cpp and then select Objective-C++ from the drop down menu. Do the same for main.cpp. (see below image.)

ObjectiveC++

Linux Notes

To compile in Debug mode run linux install script with debug: ofxFBX/scripts/ci/linux/install.sh debug you'll be asked to accept EULA during install.

To switch back to release, run same script without debug

The FBX SDK does not ship with xml2 or zlib anymore. They can be installed using the following commands.

To install zlib: sudo apt install zlib1g

libxml2: sudo apt-get install libxml2

The libxml2 dev files may be needed

sudo apt-get install libxml2-dev

Blender workflow.

Using Blender 2.63, the FBX exporter is not fully featured and there are known bugs that may be fixed in the future. Apply any transformations before exporting using ctrl + A. http://wiki.blender.org/index.php/User:Fade/Doc:2.6/Manual/3D_interaction/Transform_Control/Reset_Object_Transformations

When exporting, be sure to set the Forward to Y Forward and the Up to Z Up.

FBX version 7.4

FBX version 6.1

ofxfbx's People

Contributors

nickhardeman avatar prisonerjohn avatar themancalledjakob avatar tyhenry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ofxfbx's Issues

Loading material textures

Hi Nick,

Just wondering if you knew how to approach loading a FBX file with textures attached. Cant seem to find anything obviously implemented in the addon.... Is this still a missing feature or am I blind?

Thanks,
josh

VS 2015 Support

Attempting to get VS 2015 support. @jasonrwalters did you try running the example from the example folder in Release in 64 bit mode?

problem compiling in OSX because of "to ofFile tfile = (srtring)aPathToTexture"

Hi!
Something's preventing me from using the addon, and XCode fails to compile the example scene because of an error occuring at line 264 of ofxFBXScene.cpp:
ofFile tfile = (string)aPathToTexture;
I get the error:
No viable conversion from 'string' (aka 'basic_string<char, char_traits<char>, allocator<char>>') to 'ofFile'
Does anyone else stumble on that error/has an idea for a solution?
Thanks!

[bug] linux install script returns 403 Error

I noticed that something in the autodesk server settings changed, so to download the sdk we need to send a user agent with the wget request. it's fixed here #21 by sending a string ("openFrameworks") as user agent.

tested on Linux Debian 11, should be the same for all Linux distributions

trying to run on linux..

Hello,
I'm trying to run the examples on linux, and getting a segfault.
I know you don't officially support linux, but perhaps you can give me an idea of what's happening.
I'm on a Ubuntu 4.4.0-116-generic running ofx_v0.9.8
using the fbx-sdk-2018-1-1 downloaded from here.

per example, when I run ImporterAnimations:

Output

HOST_OS=Linux
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl gl glu glew gtk+-3.0 libmpg123 
Autodesk FBX SDK version 2018.1.1 Release (246450)
FBX file format version for this FBX SDK is 7.5.0
FBX file format version for file 'data/humanoid.fbx' is 6.0.0

Animation Stack Information
    Number of Animation Stacks: 3
    Current Animation Stack: "shot"

    Animation Stack 0
         Name: "run"
         Description: ""
         Import Name: "run"
         Import State: true

    Animation Stack 1
         Name: "punch"
         Description: ""
         Import Name: "punch"
         Import State: true

    Animation Stack 2
         Name: "shot"
         Description: ""
         Import Name: "shot"
         Import State: true

Segmentation fault (core dumped)

Stack trace:

#0  0x00007ffff759a7f6 in fbxsdk::FbxLayerElementArray::GetAt(int, void**, fbxsdk::EFbxType) const () from ./bin/libs/libfbxsdk.so
#1  0x0000000000463eac in fbxsdk::FbxLayerElementArray::GetAt<fbxsdk::FbxVector4> (this=0x500000000, pIndex=0, pItem=0x7fffffffba90)
    at /home/user/ofx/of_v0.9.8_linux64_release/addons/ofxFBX/libs/fbxsdk_2016.1/include/fbxsdk/scene/geometry/fbxlayer.h:703
#2  0x0000000000461bc6 in fbxsdk::FbxLayerElementArrayTemplate<fbxsdk::FbxVector4>::GetAt (this=0x500000000, pIndex=0)
    at /home/user/ofx/of_v0.9.8_linux64_release/addons/ofxFBX/libs/fbxsdk_2016.1/include/fbxsdk/scene/geometry/fbxlayer.h:909
#3  0x0000000000459b5b in ofxFBXMesh::setFBXMesh (this=0x183e9b0, lMesh=0x185b3f0) at ../../../addons/ofxFBX/src/ofxFBXMesh.cpp:122
#4  0x0000000000459087 in ofxFBXMesh::setup (this=0x183e9b0, pNode=0x186b170) at ../../../addons/ofxFBX/src/ofxFBXMesh.cpp:29
#5  0x00000000004760c1 in ofxFBXScene::populateMeshesRecursive (this=0xddcbd8, pNode=0x186b170, pAnimLayer=0x0) at ../../../addons/ofxFBX/src/ofxFBXScene.cpp:449
#6  0x0000000000476430 in ofxFBXScene::populateMeshesRecursive (this=0xddcbd8, pNode=0xe6aa60, pAnimLayer=0x0) at ../../../addons/ofxFBX/src/ofxFBXScene.cpp:492
#7  0x0000000000473ac5 in ofxFBXScene::load (this=0xddcbd8, path="humanoid.fbx", aSettings=...) at ../../../addons/ofxFBX/src/ofxFBXScene.cpp:139
#8  0x0000000000456a9f in ofApp::setup (this=0xddcbc0) at /home/user/ofx/of_v0.9.8_linux64_release/addons/ofxFBX/example-ImporterAnimations/src/ofApp.cpp:11
#9  0x0000000000453ea5 in ofBaseApp::setup (this=0xddcbc0, args=...) at ../../../libs/openFrameworks/app/ofBaseApp.h:63
#10 0x000000000064387a in std::shared_ptr<of::priv::Function<ofEventArgs, std::recursive_mutex> > ofEvent<ofEventArgs, std::recursive_mutex>::make_function<ofBaseApp>(ofBaseApp*, void (ofBaseApp::*)(ofEventArgs&), int)::{lambda(void const*, ofEventArgs&)#1}::operator()(void const*, ofEventArgs&) const (__closure=0xddd7c0, t=...)
    at /home/user/ofx/of_v0.9.8_linux64_release/libs/openFrameworks/events/ofEvent.h:237
#11 0x0000000000651c31 in std::_Function_handler<bool (void const*, ofEventArgs&), std::shared_ptr<of::priv::Function<ofEventArgs, std::recursive_mutex> > ofEvent<ofEventArgs, std::recursive_mutex>::make_function<ofBaseApp>(ofBaseApp*, void (ofBaseApp::*)(ofEventArgs&), int)::{lambda(void const*, ofEventArgs&)#1}>::_M_invoke(std::_Any_data const&, void const*&&, ofEventArgs&) (
    __functor=..., 
    __args#0=<unknown type in /home/user/ofx/of_v0.9.8_linux64_release/addons/ofxFBX/example-ImporterAnimations/bin/example-ImporterAnimations_debug, CU 0xa8eeaa, DIE 0xaf67ac>, 
    __args#1=...) at /usr/include/c++/5/functional:1857
#12 0x0000000000603127 in std::function<bool (void const*, ofEventArgs&)>::operator()(void const*, ofEventArgs&) const (this=0xddd770, __args#0=0x0, __args#1=...)
    at /usr/include/c++/5/functional:2267
#13 0x00000000006012b0 in of::priv::Function<ofEventArgs, std::recursive_mutex>::notify (this=0xddd760, s=0x0, t=...)
    at /home/user/ofx/of_v0.9.8_linux64_release/libs/openFrameworks/events/ofEvent.h:136
#14 0x00000000005ffe3b in ofEvent<ofEventArgs, std::recursive_mutex>::notify (this=0xa4fd28, sender=0x0, param=...)
    at /home/user/ofx/of_v0.9.8_linux64_release/libs/openFrameworks/events/ofEvent.h:303
#15 0x00000000005ff1c9 in ofNotifyEvent<ofEvent<ofEventArgs, std::recursive_mutex>, ofEventArgs> (event=..., args=...)
    at /home/user/ofx/of_v0.9.8_linux64_release/libs/openFrameworks/events/ofEventUtils.h:222
#16 0x00000000005fd761 in ofCoreEvents::notifySetup (this=0xa4fd28) at /home/user/ofx/of_v0.9.8_linux64_release/libs/openFrameworks/events/ofEvents.cpp:193
#17 0x0000000000640f2c in ofMainLoop::run (this=0xa4fbf0, window=std::shared_ptr (count 3, weak 0) 0xa4fd20, app=std::shared_ptr (count 4, weak 0) 0xddcbc0)
    at /home/user/ofx/of_v0.9.8_linux64_release/libs/openFrameworks/app/ofMainLoop.cpp:108
#18 0x0000000000640fd7 in ofMainLoop::run (this=0xa4fbf0, app=std::shared_ptr (count 4, weak 0) 0xddcbc0)
    at /home/user/ofx/of_v0.9.8_linux64_release/libs/openFrameworks/app/ofMainLoop.cpp:114
#19 0x00000000004ed3e4 in ofRunApp (app=std::shared_ptr (count 4, weak 0) 0xddcbc0) at /home/user/ofx/of_v0.9.8_linux64_release/libs/openFrameworks/app/ofAppRunner.cpp:158
#20 0x00000000004ed34f in ofRunApp (OFSA=0xddcbc0) at /home/user/ofx/of_v0.9.8_linux64_release/libs/openFrameworks/app/ofAppRunner.cpp:153
#21 0x0000000000453724 in main () at /home/user/ofx/of_v0.9.8_linux64_release/addons/ofxFBX/example-ImporterAnimations/src/main.cpp:12

Trying to run on IOS

First, I d'like to thank you for your great addon!
It runs very well on Desktop (mac) but I can't get it working on IOS.
The problem seems related with glew :
Use of undeclared identifier 'GL_FILL'
when calling glPolygonMode (which is not defined as well)
So it seems to be an include problem, but i can't find out the solution.
Does anyone has knows a solution?

Thanks

Removing models from a scene?

Hey Nick,

Loving your work!

I'd like to use one ofxFBXScene object and one ofxFBXManager object to dynamically load .fbx files. The problem I'm experiencing is that as I load new models and add the to the scene by calling scene.load(filePath, settings) and then manager.setup( &scene ) they just stack up on top of each other.

How would you recommend doing this? I was thinking of adding something like an "unload" method to the scene class, or perhaps the best way is to use multiple scene objects. Do you have a recommendation? I'm currently working on the unload method route trying to get to something that works. Let me know!

glm issue

i just update your branch to OF glm, but got some issue with it,the fbx model collapsed together,do you have clue which parts might be causing this behavior? thxs
fbx issue

Is multi layers animation feature supported?

Hi, In my scene, I have a human fbx model, which have multi animations: "idle" and "mouse open", and "idle" run looped, "mouse open" duration controlled by my program logic, so , I want run animations concurrently, is this multi layers animation feature supported? please give me some advises, thank you!

Error - Rotation of imported skeleton different to original

There is an issue in getting the same quaternion/euler rotations from the character file made in Blender.
This project is taking quaternion data from a motion capture suit (Gyroscopes) and apply it to the character imported via ofxFbx.
After several day, I also tried to export it via different softwares with the same outcome.
The examples from ofxFBX gives me weird armatures in Blender 3D.
I also tried to use constraints, which does not seem to be supported with ofxFbx.

Do you have a working armature example as Blender 3D file I could use, or any information of how to actually get the rotation quaternions right?

errors on 0.10.0

So, when passing to ofx v0.10 some things break.
I'm compiling the examples (that worked with no problems on v0.9..), and getting:

ofx/of_v0.10.0_linux64gcc6_release/addons/ofxFBX/src/ofxFBXBone.cpp:109:16: error: ‘class ofxFBXBone’ has no member named ‘setTransformMatrix’; did you mean ‘localTransformMatrix’?
         sbone->setTransformMatrix( getLocalTransformMatrix() );
                ^~~~~~~~~~~~~~~~~~
                localTransformMatrix

I tried as a temporary workarround:

diff --git a/src/ofxFBXManager.cpp b/src/ofxFBXManager.cpp
index 30af6f9..7d94e01 100755
--- a/src/ofxFBXManager.cpp
+++ b/src/ofxFBXManager.cpp
@@ -109,7 +109,10 @@ void ofxFBXManager::update(float aElapsedSeconds) {
         } else {
             fbxMeshes[i]->update( animations[animationIndex].fbxCurrentTime, lPose );
         }
-        meshTransforms[i].setTransformMatrix( fbxMeshes[i]->getGlobalTransformMatrix() );

+        setTransformMatrix(meshTransforms[i], fbxMeshes[i]->getGlobalTransformMatrix())
+
     }
     
     for( auto& skel : skeletons ) {
@@ -478,7 +481,23 @@ vector< shared_ptr<ofxFBXPose> > ofxFBXManager::getPoses() {
 
 
 
+void ofxFBXManager::setTransformMatrix(ofNode& node, const ofMatrix4x4 &m44) {
+        localTransformMatrix = m44;
 
+        ofVec3f position;
+        ofQuaternion orientation;
+        ofVec3f scale;
+        ofQuaternion so;
+        localTransformMatrix.decompose(position, orientation, scale, so);
+        node.position = position;
+        node.orientation = orientation;
+        node.scale = scale;
+        node.updateAxis();
+        
+        node.onPositionChanged();
+        node.onOrientationChanged();
+        node.onScaleChanged();
+}
 
 
 
diff --git a/src/ofxFBXManager.h b/src/ofxFBXManager.h
index c630bfc..671a671 100755
--- a/src/ofxFBXManager.h
+++ b/src/ofxFBXManager.h
@@ -81,6 +81,10 @@ protected:
     bool bAnimationsEnabled = true;
     int poseIndex = 0;
     bool bPosesEnabled = false;
+
+
+    //----------------------------------------
+    void setTransformMatrix(ofNode& node, const ofMatrix4x4 &m44);
     
 };

Which requires some minor changes on the ofx core: 😅

diff --git a/ofNode.h b/ofNode.h
index dca3566..8f2fb0e 100644
--- a/ofNode.h
+++ b/ofNode.h
@@ -450,7 +450,7 @@ public:
 
 	/// \}
 	
-protected:
+public:
 	void createMatrix();
 	void updateAxis();
 	
@@ -466,7 +466,7 @@ protected:
 
 	ofNode * parent = nullptr;
 
-private:
+public:
 	void onParentPositionChanged(glm::vec3 & position) {onPositionChanged();}
 	void onParentOrientationChanged(glm::quat & orientation) {onOrientationChanged();}
 	void onParentScaleChanged(glm::vec3 & scale) {onScaleChanged();}

but still:

ofx/of_v0.10.0_linux64gcc6_release/addons/ofxFBX/src/ofxFBXManager.cpp:492:30: error: ‘glm::mat4 {aka struct glm::tmat4x4<float, (glm::precision)0>}’ has no member named ‘decompose’
         localTransformMatrix.decompose(position, orientation, scale, so);
                              ^~~~~~~~~

texture not drawn on iOS.

I have succeeded to make it work on iOS.
But texture is not shown on FBX while it shows on MacOS.

Also it is shown on "FBX Review" app which is official viewer app for FBX on iOS.

I am using iOS 12.1.

img_0003
no texture on the model

img_0005
texture on the model with FBX Review.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.