Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: ColladaConverter
PostPosted: Tue Nov 11, 2008 9:44 pm 
Offline

Joined: Mon Oct 16, 2006 6:19 pm
Posts: 19
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.
Attachment:
COLLADAFiles.zip [15.25 KiB]
Downloaded 174 times


Many thanks

James.


Top
 Profile  
 
 Post subject: Re: ColladaConverter
PostPosted: Wed Nov 12, 2008 5:27 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3746
Location: California, USA
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


Top
 Profile  
 
 Post subject: Re: ColladaConverter
PostPosted: Wed Nov 12, 2008 5:43 pm 
Offline

Joined: Mon Oct 16, 2006 6:19 pm
Posts: 19
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.


Top
 Profile  
 
 Post subject: Re: ColladaConverter
PostPosted: Wed Nov 12, 2008 11:16 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3746
Location: California, USA
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


Attachments:
BulletColladaConverter.zip [24.77 KiB]
Downloaded 136 times
Top
 Profile  
 
 Post subject: Re: ColladaConverter
PostPosted: Thu Nov 13, 2008 7:10 pm 
Offline

Joined: Mon Oct 16, 2006 6:19 pm
Posts: 19
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.


Top
 Profile  
 
 Post subject: Re: ColladaConverter
PostPosted: Thu Nov 13, 2008 7:39 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3746
Location: California, USA
Quote:
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:
Quote:
<convex_mesh convex_hull_of="#RenderMeshBulletUnnamed-0-Geometry"/>

How can you reproduce this <convex> tag? Can you attached a zipped exported file?
Thanks,
Erwin


Attachments:
convex_compounds.zip [48.96 KiB]
Downloaded 123 times
Top
 Profile  
 
 Post subject: Re: ColladaConverter
PostPosted: Thu Nov 13, 2008 8:18 pm 
Offline

Joined: Mon Oct 16, 2006 6:19 pm
Posts: 19
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group