animated collada working in OF

http://vimeo.com/8672780

Direct link here:
http://www.openframeworks.cc/files/of-c-…–small.mov

[attachment=0:d8m5twsb]collada.png[/attachment:d8m5twsb]

For OF 0061 Mac: **( EDIT - fixed project ) **
http://www.openframeworks.cc/files/coll-…-bFixed.zip

‘Ported’ from the official Collada Dom package here:
http://sourceforge.net/projects/collada-dom/files/

Looks like it could be hooked up for windows and linux as the download ( Collada-dom-2.2.zip ) has window and linux projects for building the dependencies.

Some notes:

/* Some notes */
// -Almost everything is ripped from the viewer example project - so nice that they bundle an xcode project!
// -To see their full demo app - look at colladaDome/mainPC.cpp
// -I needed to download the Cg framework from Nvidia ( its now bundled - so you shouldn’t need to grab it )
// -libminizip was built for ppc so I just included the src in the project.
// -I was getting bad crashes from CrtPrint which was being called internally - there was a note that CrtPrint would crash if passed arguments flags %s %i etc
// so I commented out the inside of CrtPrint and it ran fine.
// -To load a file drag it and all its resources to the sidebar of your project and then drag
// those files (once in the sidebar) down to the last Copy Files build phase inside of Targets->YourAppName->Copy File

/* To do */
// -Get files loading out of the data folder - tricky because .dae files reference other files.
// -Universal libs for everything ( uggg )
// -Make awesome projects!!

pretty fucking cool!

any idea why the activity of the cpu is so intensive when running the models? i get 49% on astroboy, 29% on the airplane, domino breaking is at 98% and face pyramics going to 88% on a 2ghz macbook…

a walkthrough on how to het abounding box for the bots would be so so cool.
here’s for a seconded to do list!!

cheers!!!
a

Ahh thats because vertical sync is not set to be on.
try adding - ofSetVerticalSync(true); to testApp::setup()

should bring it down some!

there is a lot still to figure out - but for simple model loading its pretty great!

I can’t get this to compile. When I first downloaded your files, the colladaDom/libminizip.a file had an absolute reference to the file on your computers location. I downloaded the collada files off of Sourceforge and relatively pointed the projects reference to collada-dom/dom/external-libs/minizip/mac/libminizip.a

Once I tried to compile, I got 2 errors. It appears to me the important part is “library not found for -lminizip”

Any ideas how I can resolve this issue?

thanks for this demo and all of your hard work on OF!
-Kyle

![](http://forum.openframeworks.cc/uploads/default/543/colladaViewerInOF - Build Results.jpg)

Oh sorry about that. You shouldn’t need the library as the example includes the source for it. Just remove the .a from the project and it should run.

Theo

Thanks! Once I removed that library and added Cg.framework to my Mac’s Library/Frameworks folder the application launched. This is a very exciting demo!

Whoops - thanks for the tips.
I’ll re-up the example.

@Theo: Very nice and cool!

@haptic - thanks for the moving to frameworks-folder-tip that helped me get it working!

Hey updated the project - libminizip is removed and CG.framework is copied inside of the app and has the correct path so it doesn’t need to be installed in your OS root.

http://www.openframeworks.cc/files/coll-…-bFixed.zip

Wow!
This is great! Thanks a lot Theo!!!

Now that you’ve got some experience with the collada library, do you have any idea how difficult it would be to do the exact same thing in the opposite direction; I mean exporting a animation from OF to Collada…

Rendering a sequence of 10 thousand Obj files is not really funny, so this could be a great solution! Creating the animations inside OF and then editing them in a real 3D software, tweeking lights, materials and cameras!

Wow! Can’t wait to hear what you say about that! :slight_smile:

Cool!! Thanks very much :slight_smile:

http://vimeo.com/8956850

Just a quick note for Snow Leopard users out there.

To get this working in 10.6 you’ll need to download:

http://www.openframeworks.cc/versions/preRelease-v0.061/of-preRelease-v0061-osx-FAT.zip

And get the compiler in the project settings to be GCC 4.0, as well as the active SDK to 10.5.

Great work Theo!

this is literally one of the most exciting things i’ve seen in a long time!

amazing - i’m working on a visuals project at the moment and i’m working with an animator who was just today asking me if i can import/use 3-d models. perfect! :slight_smile:

as a more general question about animated models, can the playback of animation be controlled? started/stopped/sped up/slowed down/jump to keyframe, etc?

i’ll probably be writing some code to wrap some of that functionality some time soon. will post it up when i get around to it…

brilliant! i’d be very interested in seeing that if you get around to doing it.

don’t want to hijack the thread whatsoever, but (apologies in advance)…

theo, you mentioned you’d managed to export collada from cinema 4d - did you need to use a plugin or anything to achieve this? my animator friend (who lives a long way away from me) is having trouble exporting collada files…just wondering if it involves anything non-standard.

interruption over!

Help, I’ve been trying for days now to build this program -> I’m a beginner and I’m now stuck in the link phase it says :

DistribFixed/…/…/…/libs/FreeImage/lib/osx/freeimage.a -ldom -lfx -ltinyxml -lz -lxml2 -lboost_filesystem -lboost_system -framework Cg -lrt -lpcre -lpcrecpp -lbullet-d -o /Users/markwatt/Documents/colladaViewerInOF-DistribFixed/bin//colladaViewerInOFDebug.app/Contents/MacOS/colladaViewerInOFDebug

Undefined symbols:
“ofScale(float, float, float)”, referenced from:
testApp::draw() in testApp.o
“ofGetFrameNum()”, referenced from:
testApp::mouseMoved(int, int)in testApp.o
“ofDrawBitmapString(std::basic_string<char, std::char_traits, std::allocator >, float, float)”, referenced from:
testApp::draw() in testApp.o
“ofBackground(int, int, int)”, referenced from:
testApp::setup() in testApp.o
“ofSetVerticalSync(bool)”, referenced from:
testApp::setup() in testApp.o
“ofSetupOpenGL(ofAppBaseWindow*, int, int, int)”, referenced from:
_main in main.o
“ofAppGlutWindow::setGlutDisplayString(std::basic_string<char, std::char_traits, std::allocator >)”, referenced from:
_main in main.o
“ofGetHeight()”, referenced from:
testApp::setup() in testApp.o
testApp::draw() in testApp.o
testApp::draw() in testApp.o
“vtable for ofAppGlutWindow”, referenced from:
__ZTV15ofAppGlutWindow$non_lazy_ptr in main.o
“ofRunApp(ofBaseApp*)”, referenced from:
_main in main.o
“ofAppGlutWindow::ofAppGlutWindow()”, referenced from:
_main in main.o
“ofTranslate(float, float, float)”, referenced from:
testApp::draw() in testApp.o
“ofGetWidth()”, referenced from:
testApp::setup() in testApp.o
testApp::draw() in testApp.o
“ofSetColor(int, int, int)”, referenced from:
testApp::draw() in testApp.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

I know i’m doing something stupid but I don’t know what ?

[quote author=“mikeys”][quote author=“Apex”]
theo, you mentioned you’d managed to export collada from cinema 4d - did you need to use a plugin or anything to achieve this? my animator friend (who lives a long way away from me) is having trouble exporting collada files…just wondering if it involves anything non-standard.

interruption over![/quote][/quote]

I haven’t got animation exporting correctly from Cinema 4D - but I did get a regular model in fine.

I had to throw the file in my data folder then also drag it into the sidebar of my project and also from the sidebar down into the Copy Files phase of the build target ( also in the sidebar ) which copies the collada file to the App’s resource bundle.

For textures I had to make sure I exported the texture as TGA - and then manually edit the collada file to make sure the path for the texture just had the texture name and nothing else ( ie no absolute path ). Then make sure to add the texture / tga in the same way as the collada file to the xcode sidebar and Copy Files phase.

Hope that helps!
Theo

[quote author=“Pendotiba”]Help, I’ve been trying for days now to build this program -> I’m a beginner and I’m now stuck in the link phase it says :

DistribFixed/…/…/…/libs/FreeImage/lib/osx/freeimage.a -ldom -lfx -ltinyxml -lz -lxml2 -lboost_filesystem -lboost_system -framework Cg -lrt -lpcre -lpcrecpp -lbullet-d -o /Users/markwatt/Documents/colladaViewerInOF-DistribFixed/bin//colladaViewerInOFDebug.app/Contents/MacOS/colladaViewerInOFDebug

Undefined symbols:
“ofScale(float, float, float)”, referenced from:
testApp::draw() in testApp.o
“ofGetFrameNum()”, referenced from:
testApp::mouseMoved(int, int)in testApp.o
“ofDrawBitmapString(std::basic_string<char, std::char_traits, std::allocator >, float, float)”, referenced from:
testApp::draw() in testApp.o
“ofBackground(int, int, int)”, referenced from:
testApp::setup() in testApp.o
“ofSetVerticalSync(bool)”, referenced from:
testApp::setup() in testApp.o
“ofSetupOpenGL(ofAppBaseWindow*, int, int, int)”, referenced from:
_main in main.o
“ofAppGlutWindow::setGlutDisplayString(std::basic_string<char, std::char_traits, std::allocator >)”, referenced from:
_main in main.o

I know i’m doing something stupid but I don’t know what ?[/quote]

Looks like you are not using the latest OF ( 0061 )
You should grab the 0061 FAT release from the download page.

:smiley:

Theo

Thanks, I deleted everything and started again and it worked fine. As a matter of interest how is the skinning on astroBoy done ? I take it he is skinned.

Hello!

I know this is not really an openframeworks topic - so If I’m out of subject tell me !

I was trying to link this dae library and the artoolkitplus ( I know this is not really an awesome idea ), and I had troubles with the dae CrtRenderer…

It seems that the dae renderer is totally independent of the positions of openGl, as It’s working only with his own camera.

glTranslatef for example don’t move the model…

I searched in a lot of forums, saw a post of someone having a workaround deleting the camera functions from the render() function, but as the library is pre compiled I can’t do that.
I tried as well the CrtRenderer.LoadMatrix() function with new coords but without any result.

In fact I had an afternoon trying to understand this without any succes !

Any tips ?

Merci!