v002 Model Loader

vade's picture

Hi.

Here is a beta of a new model loader for QC. This model loader supports animation (yes, really), and works using Open Asset Import Library 2.0, allowing for import and display of over 20 different model formats. An in complete list:

Collada (.dae), 3ds Max 3DS (.3ds), 3ds Max ASE (.ase), Wavefront Object (.obj), Stanford Polygon Library (.ply), AutoCAD DXF (.dxf), LightWave (.lwo), Modo (.lxo), Stereolithography (.stl), AC3D (.ac), Milkshape 3D (.ms3d), TrueSpace (.cob, .scn), Valve Model (.smd,.vta), Quake I (.mdl), Quake II (.md2), Quake III (.md3), Return to Castle Wolfenstein (.mdc), Doom 3 (.md5), Biovision BVH (.bvh), CharacterStudio Motion (.csm), DirectX X (.x)., BlitzBasic 3D (.b3d)., Quick3D (.q3d,.q3s)., Ogre XML (.mesh, .xml)., Irrlicht Mesh (.irrmesh)., Irrlicht Scene (.irr)., Neutral File Format (.nff), Sense8 WorldToolKit (.nff), Object File Format (.off), PovRAY Raw (.raw), Terragen Terrain (.ter), 3D GameStudio (.mdl) and 3D GameStudio Terrain (.hmp)

You can also optionally patch in an image and use that as the models texture image, and select various texture coordinate generation routines (or use the models baked UVs). If you choose Object Linear or Eye linear you might want to use an Image Texturing Properties patch before the model image input port and choose TEXTURE_2D (so you can leverage repeat texture mode) and adjust scaling to fit.

Animations work via Patch Time, so you can scratch and scrub animations if you use an external timebase (yes, really). The model loader also handles vertex skinning on the CPU as well as keyframe interpolation, so you don't need a specific vertex shader to implement animation (although it might be faster, its far more limiting to and end user). It should work within a GLSL patch as well, but honestly i've not tested every combination or complete compatibility.

Current issues I am aware of is that its not super smart about looking for texture paths. Some models have really fucked paths for textures, listing absolute or relative paths that do not exist. You can see some errors in the console if this is the case.

This is very beta, but very very fast. You can load a 230 MB OBJ file and render 3.2 million verts at ~40 fps on a 330m.

Current issues that are solvable: Exposing animation duration, exposing inputs for selecting different animation tracks.

Issues I don't really want to deal with: mesh output compatible with OpenCL / Mesh renderer. This might be doable, but the internal structure is not suitable to expose as a single mesh object. Will have to look into this (if its possible at all). This could mean (due to CPU side vertex skinning) animated meshes to OpenCL, which.. thinking about it might be worth the effort. Fuck.

I also wont be exposing the internal textures for now, so they are loaded and handled internally and not exposed.

Anyway, this loader is very optimized, I think you will find it pretty damn fast.

Let me know how it goes. Also, while this is a pubic beta, I'd prefer I don't get random reports from people saying it doesn't work without any useful debugging info.

Check it out: http://v002.info/downloads/beta/v002%20Model%20Importer.plugin.zip

I'd like to thank the Open Frameworks conference for giving me the time to finish animation support, and specifically Memo for giving me a kick in the ass to get framerates up to their max. I think we can get this even faster.

Let me know how it goes.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

gtoledo3's picture
Re: v002 Model Loader

Nooo! It's 404! :)

(Can't wait to check it.)

gtoledo3's picture
Re: v002 Model Loader

Ah, correct link to v002 (as opposed to Vade), and it dl's. (gee, I haven't even read all of the post yet :)

vade's picture
Re: v002 Model Loader

Oh god im an asshole. ill fix that stat.

vade's picture
Re: v002 Model Loader

I cant edit the post, but Im an ass and put the wrong URL in there. The correct DL link is

http://v002.info/downloads/beta/v002%20Model%20Importer.plugin.zip

If a Kineme admin could edit the post, that would be awesome. Sorry about that. Herpa Derpa etc. etc.

gtoledo3's picture
Re: v002 Model Loader

So, just for me to be clear, we can run animations... do you have any thoughts about adding a way to control joints in the future?

vade's picture
Re: v002 Model Loader

Yes you can run animations. Control individual joints is very very tricky. You have to supply a proper, weighted matrix for each bone in the mesh. Honestly, probably not. You can look at the source, once I get some of the bugs worked out.

The source for this is a slightly modified version of the open frameworks loader I ported from this at the OF Dev conference, feel free to peruse here:

https://github.com/vade/openFrameworks/tree/master/addons/ofxAssimpModel...

This will be included in OF 007

smokris's picture
Re: v002 Model Loader

(Fixed link in original post.)

gtoledo3's picture
Re: v002 Model Loader

I'd appreciate looking at the source once your comfortable with it.

I was adding in manual joint control to a loader I'm less than thrilled with (this weekend actually), but that had an ok starting point for adding in joint control, and that's exactly what I was doing - creating weighted matrix for each bone in the mesh. It would be gargantuan to create a one size fits all for that (or maybe impossible?), but it would be handy to work with it, and maybe get some stuff going solidly with select models.

(btw, I just posted an openCL lerp/morph kernel that might get your mind rolling in some cool direction, as far as lerping between keyframes via openCL, and having it work w/ CL mesh.)

I had a feeling it was related to the OFX project, but didn't want to assume anything.

vade's picture
Re: v002 Model Loader

Definitely check out the OF source. It's based on a Mac example I donated to the assimp project so they had an up to date VBO based gl example. I wrote the QC plugin next but never had a chance to add animation until the OF conference, thus the post here right after the conference :)

gtoledo3's picture
Re: v002 Model Loader

Thanks for the link to the OF source.

franz's picture
Re: v002 Model Loader

AWESOME ! Thank you soooo much.

gtoledo3's picture
Re: v002 Model Loader

I believe there's problems using relative file paths with actual models (not just texture). (To counter, I'm loving looking at bvh files playing through.)

dust's picture
Re: v002 Model Loader

sweet i herd you where working on a collada importer but this seems to be a bit more. sounds awesome can't wait to try.

gtoledo3's picture
Re: v002 Model Loader

This is the loader playing through some bvh files.... I used some motion blur on the render (Quartz Crystal).

I've attached a zip. Now, files will have to be reloaded into paths, because it looks like paths have to be absolute.

PreviewAttachmentSize
bvh player.zip7.62 MB

vade's picture
Re: v002 Model Loader

Oh, good catch. Indeed I did not add that code, I ought to add the relative path checking. Will do for the next beta.

randall's picture
Re: v002 Model Loader

I tried loading these guys into a trackball to no avail. Any reason why it wouldn't work inside a trackball?

gtoledo3's picture
Re: v002 Model Loader

They work fine in a trackball.

I may be assuming too much but I'm guessing you selected all, then hit macro (at which point you would see all the characters disappear because the file paths just got eradicated), then hit transmutate trackball.

Just put the file paths back in.

vade's picture
Re: v002 Model Loader

It 100% works in a trackball. I have tons of comps that do that.

hiltmeyer's picture
Re: v002 Model Loader

thank you very much for this great plugin.

franz's picture
Re: v002 Model Loader

hi, how am I supposed to import skinned meshes ? should I import bones as well ?

vade's picture
Re: v002 Model Loader

Updated the model loader, fixed some display/rendering issues with certain format models, removing redundant loading options, fixed relative paths for texture loading. Added animation index option, so if your model supports multiple animation tracks, you can select which animation to use.

http://v002.info/downloads/v002%20Model%20Loader%201.0%20Beta%201.dmg

Example comp includes a demo collada (dae) model with animation. This loader supports 35+ format models, most have been tested and verified to work.

Enjoy.

vade's picture
Re: v002 Model Loader

Hrm? You include the skinned bones with the model, or export a format that supports both like MD5, which exports the MD5mesh and MD5anim files, and make sure they are in the same directory.

Or use Collada which includes the animation tracks and bones in one file.

gtoledo3's picture
Re: v002 Model Loader

Thanks!

idlefon's picture
Re: v002 Model Loader

A marvelous plugin ! Cheers Vade!

franz's picture
Re: v002 Model Loader

A.W.E.S.O.M.E ! and thxx for the source, this is ultra-valuable, will definetly learn a lot.

cybero's picture
Re: v002 Model Loader

Just gotten into the whole working process of utilising the Model Importer, currently only with .dae and .ply within GLSL shaders derived pretty directly from the MeshLab application. [see MeshLab Shaders Collection ].

I'm pretty wowed out about it, very useful and I know I've only just begun to skim the surface of what is possible with the plugin.

Source Code too :-)

vade - you're a true star

dust's picture
Re: v002 Model Loader

im seriously going to try this plugin soon with some animations. it really excites me particularly the external time component. the link is dead now but i think i have this on my other machine. going to try it on my clean plugin free dev machine.

jersmi's picture
Re: v002 Model Loader

Thank you once again for this amazing plugin. Should I be able to put it inside an iterator? If not, suggestions?

cybero's picture
Re: v002 Model Loader

Yes you should be able to, see attached, uses seashell.ply in a Normal Map Shader from MeshLab, ported to QC.

PreviewAttachmentSize
seashell.ply_.zip31.96 KB
seashellply.iterated.v002.qtz19.4 KB
seashellply.iterated.v002.png
seashellply.iterated.v002.png121.55 KB

jersmi's picture
Re: v002 Model Loader

Thanks a lot, cybero. Not sure why the simple dae file I tried didn't show up at first but I didn't try too hard to troubleshoot.

vade's picture
Re: v002 Model Loader

The 1024 guys and Weirdcore helped me identify some issues where I was not properly handling specific types of transforms, and additionally, was blindly transforming things that did not need transforming. The net result is a new version of the v002 Model Loader that properly handles many more formats and more types of animation.

Im uploading the DMG now, im gonna make a new post about Beta 2. Let me know if it fixes your loading woes.

bernardo's picture
Re: v002 Model Loader

hi vade is this for snow leopard only or us is hotter climate can use it too?

cybero's picture
Re: v002 Model Loader

10.6 and QC 4.0 required.

To quote from the Read Me included in the DMG.

Quote:

Requirements:

Mac OS X 10.6 (Quartz Composer 4.0) Only.

Works really nicely with .ply models [& other types besides].

Also, without giving too much away, works AOK in Lion as well as 10.6.x /////////////////////////////////////////////////////////////////////////////////////////////

BTW - is it possible to place the Model Loader inside an RII patch and get it to render in Quartz Crystal?

I merely ask because a composition that looks exceedingly cool using the v002 Rutt Etra 3.0 patch fed by such an RII reversioning of the seashell composition above, renders fine in QC but fails to produce anything apart from a square grid in Crystal [version 2.0].

vade's picture
Re: v002 Model Loader

If it renders ok in QC, it may be a bug in Quartz Crystal 2.0, or, in turn, I could be making an error in how I handle some subtle state changes that Quartz Crystal is doing that QC itself is not.

Can you post a simple composition illustrating the issue?

cybero's picture
Re: v002 Model Loader

Sure, here it is.

Includes the .ply employed in the composition.

BTW, although I haven't included a Sprite or other rendering patch apart from the v002 Rutt Etra 3.0 patch in the composition attached, I have tried out this composition with them and Quartz Crystal still renders it as a black, empty space.

PreviewAttachmentSize
seashell-ghosts.zip41.76 KB

bernardo's picture
Re: v002 Model Loader

Quote:

Requirements: Mac OS X 10.6 (Quartz Composer 4.0) Only.

NOW thats unfair. packing my sht to go to the snow. its time. wish me luck!!!!

cybero's picture
Re: v002 Model Loader

You won't need too much in the way of luck, just some patience, bernardo :-).

The process should be quite painless.

Retaining a bootable Leopard partition would be a good idea if you can manage to though.

bernardo's picture
Re: v002 Model Loader

ah!! thanks cybero as for the partition my disk is too small.... i am considering ditching my dvd drive and gor for another hdd instead...

vade's picture
Re: v002 Model Loader

You and I have different ideas of simple. Your composition renders black for me in Quartz Composer when I open and run it.

cybero's picture
Re: v002 Model Loader

My bad, just need to turn up the Color Alpha setting on the v002 patch to get it to render in Composer, if I explode the Iterator and then present to Crystal it renders , so actually this is the simplest version that reproduces the problem, albeit the case that the use of the Concert patch is arguably inessential to running the v002 patch's Displacement image input, as it could use the same image input as the main image input.

vade's picture
Re: v002 Model Loader

I am actually able to re-produce an issue with just an iterator, and I think I have found a bug with the iterator patch.

If I have a 3rd party plugin that I check has a published input port, and save a value into that input port, and in the execute method I check for "did value for input key change", when I am in an iterator, that value does not seem to fire when starting the comp for the first frame, but will fire on load outside of the iterator

So what is happening, is that its not actually being told to load a model

sigh

I am going to send a bug report to the QC list.

cybero's picture
Re: v002 Model Loader

I guess I just wasn't seeing the wood for the trees.

Thanks for enquiring further.

Mind you, having just taken a look back at the pre RII version, having exploded the various macros down to a single Iterator wrapping a Model Loader patch [no RII], I can render in QC.

Perhaps you're meaning an Iterator in an RII?

However, I am unable to reproduce your reported problem maker, in fact, going down that route [so far as I am understanding what that route is] actually results in a product that is renderable in Quartz Crystal, both inside and outside of Quartz Crystal.

These examples don't use GLSL shaders, or Trackballs.

They both render in Quartz Crystal for me.

PreviewAttachmentSize
DoesItRenderInCrystal.zip43.11 KB

gtoledo3's picture
Re: v002 Model Loader

If you take your problem comp and make the file path in an insert splitter, that's not in the iterator or rii, but then links to the model loader, does it load then?

cybero's picture
Re: v002 Model Loader

I'd already done that. It , indeed they all, load and render in Composer, but fail, unless otherwise previously indicated, in Crystal.

UnexpectedGirl's picture
Re: v002 Model Loader

Firstly thank you for a great plugin! Was having some trouble previously bringing in 3d models and this sorted everything out!

With the exception of the textures - I'm sure I'm just doing something wrong on my side, but I'm new to this so can't quite manage to work it out.

I'm trying to load multiple textures on my 3d model, so for example the boots are textures separately to the torso etc - is this possible? How do I go about doing it?

cybero's picture
Re: v002 Model Loader

only single texture file supported, SFAIK.

UnexpectedGirl's picture
Re: v002 Model Loader

Funny you should say that - I would have expected as much, but when I loaded it up this morning textures were all loaded... Don't know if it will last, but was a nice surprise! I also haven't changed anything so I'm not sure what happened...

UnexpectedGirl's picture
Re: v002 Model Loader

On a related note, is there a way to bring in .mtl files (linked to .obj) for the textures?

vade's picture
Re: v002 Model Loader

Cybero, dude, it loads as many textures are linked in the model file.

:\

Unexpected Girl: May have to do with the paths. The model loader looks for the image file of the texture via the paths as specified in the model file. If you had weird paths, or moved/edited the paths, that might explain a difference?

I've 100% loaded models with many different textures, and know that it works just fine. The only gotcha is using models where full paths are specified as texture resources. The logic for deducing the proper path is pretty simple. That could use a bit of fleshing out. That said, it will work if paths are "sane".

cybero's picture
Re: v002 Model Loader

Updated :_)

mattb's picture
Re: v002 Model Loader

Hi Been looking to get into real time 3d for ages, here we go,cheers Vade. Have read through the thread but couldn't quite pin where the latest version can be got from? X Matt Black

vade's picture
Re: v002 Model Loader

v002.info

mattb's picture
Re: v002 Model Loader

thank you Vade.

do you know where there is some info about what one can do to objects/meshes? have read around it on the forums here but I'm not clear about a simple thing like: can one deform objects in a flexible way? say I want to take a plane and put a sinewave on the Y axis to make it ripple. Possible?

x Matt

mattb's picture
Re: v002 Model Loader

Also Vade, my mate and me were just talking about '3d feedback' , objects creating objects, and then found the post here with the Iterator idea 'Seashell.'! sounds like what we wanted. We grabbed it, but on opening it in QC its black. Do we need eg to explicitely load the seashell.ply object to it? thanks X M

gtoledo3's picture
Re: v002 Model Loader

mattb wrote:
thank you Vade. say I want to take a plane and put a sinewave on the Y axis to make it ripple. Possible?

x Matt

Making a sinewave ripple with a mesh is fairly easy when using GLSL.

One can put the "renderer" patch inside of a GLSL environment (I guess in this case it would be a GLSL grid, or the v002 model loader, from context of previous discussion).

If you want the ripple to be on a different axis than Y, take the line:

vec3 vertex = gl_Vertex.xyz + sin(offset + gl_Vertex.y * scaleIn)*scaleOut;

...and change the gl_Vertex.y to gl_Vertex.x or z.

One thing to realize about using a GLSL environment, like this, is that you will have to implement stuff like lighting manually (using GLSL code).

PreviewAttachmentSize
GLSL Sine Wave.qtz6.74 KB

mattb's picture
Re: v002 Model Loader

thank you George, and thanks for your many creative inputs here and elsewhere