ColladaConverter

Physics APIs, Physics file formats, Maya, Max, XSI, Cinema 4D, Lightwave, Blender, thinkingParticles™ and other simulation tools, exporters and importers
JamesH
Posts: 19
Joined: Mon Oct 16, 2006 6:19 pm

ColladaConverter

Post by JamesH »

I'm currently implementing Bullet in the C4 Engine to mirror a PhysX implementation that I've been working on, and I've hit a bit of a wall with regards to saving compound rigid bodies, ie made up from numerous convex hulls (generated using ConvexDecomposition)

At the moment I am using ConvexDecomposition on a test model of a column, it works fine decomposing at runtime but obviously it is slow. So I'm saving it out to a .dae file to load back in at runtime rather than decompose it every time. The problem I have is that the collada file that is generated of the saved compound rigid body does not contain multiple convex hulls that were generated, just a single one.

If I then run the same scene in PhysX (both are using the same ConvexDecomp code) and save a dae file out using NXUStream the file is completely different, but if I then load that file into the bullet scene it loads fine and all of the hulls are created correctly.

Image
The image shows a yellow column that has the collision mesh generated at runtime and the red one loaded the file generated from NXUStream, Column-PhysX.dae - the Bullet debug is turned on.

My question is, do I have to do anything special when saving a btDynamicsWorld, I just create the world, create one rigid body (the compound one) and save it. I created my own class that inherits from ColladaConverter and override the ::createConvexHullShape() and ::createCompoundShape() to check that the convex hulls are being created when it loads and just one hull is created when loading the Bullet generated collada file, Column-Bullet.dae.

The two files are here if anyone wants to check them out.
COLLADAFiles.zip
Many thanks

James.
You do not have the required permissions to view the files attached to this post.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: ColladaConverter

Post by Erwin Coumans »

Cool, that is interesting work, thanks for sharing.

There is probably some issue with the BulletColladaConverter compound export.
In particular, the COMPOUND_SHAPE_PROXYTYPE case in void ColladaConverter::buildShape, in Bullet\Extras\BulletColladaConverter\ColladaConverter.cpp.

I'll see if we can fix it. Obviously, if you fix it before us, we accept contributions.

Please keep us up-to-date and let us know if there are any issues,
Thanks,
Erwin
JamesH
Posts: 19
Joined: Mon Oct 16, 2006 6:19 pm

Re: ColladaConverter

Post by JamesH »

I am going to go through it in the next couple of days and see if I can track the issue down. I'll let you know if I find the problem.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: ColladaConverter

Post by Erwin Coumans »

The latest trunk and Bullet 2.73 RC3 has compound collision shape export in the ColladaConverter:
http://code.google.com/p/bullet/downloa ... 73-rc3.zip

Can you test this (or attached zipfile), and report if that works for you?

Thanks,
Erwin
You do not have the required permissions to view the files attached to this post.
JamesH
Posts: 19
Joined: Mon Oct 16, 2006 6:19 pm

Re: ColladaConverter

Post by JamesH »

I modified the three changes identified in the GoogleCode's change-set (I didn't have time to merge in 2.7.3), and it works fine now thanks.

One observation from the outputted file, is that the hulls are tagged as <convex>, but looking at Chapter 6 of the COLLADA specs for 1.4 and 1.5, the Analytical shapes, should it be <convex_mesh> ?

Anyway, once again thanks for the fix.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: ColladaConverter

Post by Erwin Coumans »

One observation from the outputted file, is that the hulls are tagged as <convex>, but looking at Chapter 6 of the COLLADA specs for 1.4 and 1.5, the Analytical shapes, should it be <convex_mesh> ?
Bullet doesn't produce the exported XML, it relies on COLLADA_DOM. Are you using Bullet's ColladaConverter, in combination with the COLLADA DOM & libxml from Bullet/Extras folder?
I just tried to convert the convex parts from Bullet/Demos/ConvexDecompositionDemo, and the output is fine:
<convex_mesh convex_hull_of="#RenderMeshBulletUnnamed-0-Geometry"/>
How can you reproduce this <convex> tag? Can you attached a zipped exported file?
Thanks,
Erwin
You do not have the required permissions to view the files attached to this post.
JamesH
Posts: 19
Joined: Mon Oct 16, 2006 6:19 pm

Re: ColladaConverter

Post by JamesH »

Sorry Erwin, ignore my post, I meant <mesh> not <convex>, but I can see that there is a <convex_mesh> tag that refers to the previous <mesh> section.