ofxAssimpModelLoader multiple meshes become 'merged'


I’ve been playing around with the assimp addon which is really cool. However, I have one small problem; it seems as though for objects to be recognised as distinct meshes, each one needs to have a separate material applied before I export from Cinema 4D. I’ve tried 3DS, obj, dae and Direct X formats and I always get the same result. Any objects that share a material appear to get ‘merged’ into a single mesh. The scene I’m experimenting with has quite large number of objects; it would be a bit of a pain to have to create and assign many many different materials purely to avoid this. Does anyone know another way?



I am also playing around with assimp and running into other troubles. What exactly do you mean by “merged”?

Hey Tim!

So, for example: I make two cubes in C4D, export them and bring them in via the assimp loader. If I call getNumMeshes() it reports 1 mesh, even though the two cubes were completely separate objects in C4D. If I assign two separate materials to the cubes in C4D, getNumMeshes() will return there are 2 meshes. Not only do they have to be separate materials, they have to have different colour values otherwise the objects still get merged. It’s almost like it’s merging by de-duping based on material values.

Pretty crazy huh?

Any ideas why it might be doing this?

Cheers, sCam

do you have the optimize boolean set to true?


Yes I did, but turning it off doesn’t actually help :-S However, thanks to your advice I realised that ofxAssimpLoader actually specifies aiProcessPreset_TargetRealtime_MaxQuality in the flags it passes to assimp even if you specify its ‘optimize’ value to be false. That preset implicitly includes aiProcess_OptimizeMeshes, so that’s why they were getting merged.

I just tweaked ofxAssimpLoader not to use that preset and all is fine.

Thanks for the help!

Cheers, sCam