Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 120 posts ]  Go to page 1, 2, 3, 4, 5 ... 8  Next
Author Message
 Post subject: Java port of Bullet
PostPosted: Fri Jan 11, 2008 2:08 pm 
Offline

Joined: Fri Jan 11, 2008 8:33 am
Posts: 40
Hello,

I've ported Bullet 2.66 to Java. The first alpha version is available here:

http://jezek2.advel.cz/tmp/jbullet-20080111.zip

And webstart on:

http://jezek2.advel.cz/tmp/jbullet/jbullet-test.jnlp

Currently only the BasicDemo is partly working, there is some problem with box/plane for ground, so spheres are simply falling down. Also it uses only SimpleBroadphase without removing overlapping pairs and it's only partly optimized, so it's pretty slow.

The remove of overlapping pairs is disabled because it touches some bug with SequentialImpulseConstraintSolver, which is accessing array out of bounds.

UPDATE 2008/02/07:
More information and latest versions can be found on JBullet homepage.


Last edited by jezek2 on Wed Feb 06, 2008 11:11 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Sun Jan 13, 2008 6:31 pm 
Offline

Joined: Sun Jan 13, 2008 6:22 pm
Posts: 2
I already posted over at JGO - but I post here again, in case you visit this board more often:
Having a complete physics engine in Java would be awesome. JOODE never got finished, unfortunately. Any estimates for release dates or a road map? How large is your team? (first post reads like size==1)


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Sun Jan 13, 2008 7:04 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 4050
Location: California, USA
Wow, that is impressive work, how long have you been working on this? Can you describe your porting approach, did you use any automated tools, or manual find/replace?

  • It looks like interaction in the Java BasicDemo between spheres (sphere vs sphere and sphere vs box, a box spawned by the user) works fine, and so does picking.
  • SimpleBroadphase is a good start, although it is exhaustive/brute force. More parts of Bullet (like its SequentialImpulseConstraintSolver) could be split up into a 'Simple' version and Optimized/Cache friendly version. Such Bullet Simple/Light/Educational version would help porting and understanding of code.
  • It Would be good to figure out what is happening with the ground. In particular the btStaticPlaneShape should be fairly straightforward, as it doesn't rely on other algorithms (it doesn't need GJK, nor GJK but only the getSupportingVertex).

Please keep us posted if you make some progress,
Erwin


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Sun Jan 13, 2008 10:46 pm 
Offline

Joined: Fri Jan 11, 2008 8:33 am
Posts: 40
irrisor wrote:
I already posted over at JGO - but I post here again, in case you visit this board more often:
Having a complete physics engine in Java would be awesome. JOODE never got finished, unfortunately. Any estimates for release dates or a road map? How large is your team? (first post reads like size==1)


Sorry, forgot to reply. For others, I also posted about the Java port on:

http://www.javagaming.org/forums/index.php?topic=18035.0


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Sun Jan 13, 2008 10:54 pm 
Offline

Joined: Fri Jan 11, 2008 8:33 am
Posts: 40
Erwin Coumans wrote:
Wow, that is impressive work, how long have you been working on this? Can you describe your porting approach, did you use any automated tools, or manual find/replace?

Hi, thanks :) I've been working on this for a few days (or better, nights) nearly full time. I translated manually every line, maintaining the original structure as possible, only a few things are rewritten (SimpleBroadphase, OverlappingPairCache) to use Java collections such as HashMaps. The result was pretty unoptimized, there were tons of heap allocations everywhere :) I then converted it to use stack allocation (using own per-thread BulletStack object, as Java don't have stack allocations of objects).

Erwin Coumans wrote:
  • It looks like interaction in the Java BasicDemo between spheres (sphere vs sphere and sphere vs box, a box spawned by the user) works fine, and so does picking.

Yeah, although there is a little but hardly visible bug, which I already fixed in my version (will be part of the next update, after I fix the bug I mentioned in the last paragraph of first post).

Erwin Coumans wrote:
  • SimpleBroadphase is a good start, although it is exhaustive/brute force. More parts of Bullet (like its SequentialImpulseConstraintSolver) could be split up into a 'Simple' version and Optimized/Cache friendly version. Such Bullet Simple/Light/Educational version would help porting and understanding of code.

Actually I didn't have too much problem understanding the code, Bullet has very nice structure. The simple versions are basically there with the #ifdefs or flags, and was sufficient for my porting needs (at least so far).

Erwin Coumans wrote:
  • It Would be good to figure out what is happening with the ground. In particular the btStaticPlaneShape should be fairly straightforward, as it doesn't rely on other algorithms (it doesn't need GJK, nor GJK but only the getSupportingVertex).

Yeah I think too, but I'm now focused to hunting the bug I mentioned in the last paragraph of first post. I can already "fix" it by workaround, but I think that I have now fairly clear trace of origin of this bug. This bug costed me a couple of hours, but on the bright side, I learned more about Bullet internals, which is always good :)

Erwin Coumans wrote:
Please keep us posted if you make some progress,
Erwin

Sure, I will :)


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Wed Jan 16, 2008 8:07 am 
Offline

Joined: Fri Jan 11, 2008 8:33 am
Posts: 40
I've uploaded new version: http://jezek2.advel.cz/tmp/jbullet-20080116.zip

Webstart: http://jezek2.advel.cz/tmp/jbullet/jbullet-test.jnlp

Changes:
- Moved all push/popProfile to try/finally blocks
- Added final for Vectors/Transforms/etc fields where applicable, and fixed some discovered bugs
- Fixed bug with non-functional removeOverlappingPair
- Enabled ground BoxShape in BasicDemo
- Implemented drawing of BoxShape
- Fixed VectorUtil.maxAxis

Known issues:
- collision of boxes has some bug


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Thu Jan 17, 2008 8:48 am 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 4050
Location: California, USA
jezek2 wrote:

Wow, you are making good progress, and the Bullet Java performance is very good.
Quote:
Known issues:
- collision of boxes has some bug

Have you checked the btPersistentManifold class, or contact management? Is looks like some contact normal is wrong. Also, using the btStaticPlaneShape might help figuring out what is wrong (it doesn't reply on GJK or EPA collision detection algorithms, so it is easier to debug).

Thanks for the update,
Erwin


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Mon Jan 21, 2008 3:37 am 
Offline

Joined: Mon Aug 28, 2006 2:35 am
Posts: 6
This is impressive! Do you plan to have a website for jBullet?


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Tue Jan 22, 2008 12:27 pm 
Offline

Joined: Fri Jan 11, 2008 8:33 am
Posts: 40
jfelrod1960 wrote:
This is impressive! Do you plan to have a website for jBullet?


Thanks :) Yes, I'll create one in near future.


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Tue Jan 22, 2008 4:24 pm 
Offline

Joined: Fri Jan 11, 2008 8:33 am
Posts: 40
New version: http://jezek2.advel.cz/tmp/jbullet-20080122.zip

Webstart demos:
BasicDemo
GenericJointDemo

Changes:
- Fixed convex/plane collision detection
- Added GLDebugDrawer and fixed some bugs
- Added CapsuleShape
- Added ConeTwistConstraint, HingeConstraint and Generic6DofConstraint
- Added GenericJointDemo
- Optimized drawing of spheres and cylinders using display lists
- Fixed collision of boxes
- Added text overlay

Enjoy :)


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Tue Jan 22, 2008 9:44 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 4050
Location: California, USA
Very impressive, it looks almost identical to the C++ version. It looks quite stable and fast, except for some occasional jitter, you might have noticed that?
jezek2 wrote:
darkprophet wrote:
If its a port, how come the webstart wants to run without permissions?

The demo uses OpenGL (LWJGL), I'll later add support for some software 3D renderer (probably jPCT or something like that).

It would be really nice to remove the security/permission issue. How much work is it to add support for a software render? So there is no 'trusted' OpenGL Java binding, without requiring permission?

On the math library discussion here: http://www.javagaming.org/forums/index. ... ic=18035.0
Have you considered to just port and use Bullet LinearMath classes like btVector3, btQuaternion and btTransform?

Changing the math operations throughout the entire library can be error-prone and makes maintenance a bit harder. For Bullet 2.x we probably stick with LinearMath, to keep the interface stable. More radical changes, possibly a full rewrite or change in math library might happen in a separate future project, like Bullet 3.x. We don't need to worry about that now.

Thanks again,
Erwin


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Wed Jan 23, 2008 9:09 am 
Offline

Joined: Fri Jan 11, 2008 8:33 am
Posts: 40
Erwin Coumans wrote:
Very impressive, it looks almost identical to the C++ version. It looks quite stable and fast, except for some occasional jitter, you might have noticed that?

Yes, some bug is still crawling somewhere :)

Erwin Coumans wrote:
jezek2 wrote:
darkprophet wrote:
If its a port, how come the webstart wants to run without permissions?

The demo uses OpenGL (LWJGL), I'll later add support for some software 3D renderer (probably jPCT or something like that).

It would be really nice to remove the security/permission issue. How much work is it to add support for a software render? So there is no 'trusted' OpenGL Java binding, without requiring permission?

No, there isn't and probably won't be. There is one possibility, to use LWJGL as a webstart extension, which can be then signed separately. This allows to run just the OpenGL binding with all permissions, but the application stays restricted. This doesn't solve the issue though.

I think that it shouldn't be that much work to add software mode, when I use some good library for it (like jPCT, but I'll look for others too).

Erwin Coumans wrote:
On the math library discussion here: http://www.javagaming.org/forums/index. ... ic=18035.0
Have you considered to just port and use Bullet LinearMath classes like btVector3, btQuaternion and btTransform?

Changing the math operations throughout the entire library can be error-prone and makes maintenance a bit harder. For Bullet 2.x we probably stick with LinearMath, to keep the interface stable. More radical changes, possibly a full rewrite or change in math library might happen in a separate future project, like Bullet 3.x. We don't need to worry about that now.

The situation is little different in Java, there is official Sun's vecmath library (using official "javax.vecmath" package). It's good for interoperability between apps and different libraries. Because the usage is a bit different from C++, I had to rewrite (port) it anyway to use it. There are still portions of LinearMath in utility classes, because Vecmath doesn't have all functionality. Transform is also from original LinearMath.

There is effort to standarize on Vecmath2, which is evolved version of the official Vecmath library, that can be extended, is truly opensource, and has more features.

To satisfy all parties, I'm leaning towards multiple builds for both Vecmath libraries, so developer can freely choose which one he prefers.


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Wed Feb 06, 2008 11:05 pm 
Offline

Joined: Fri Jan 11, 2008 8:33 am
Posts: 40
New version available on JBullet homepage.

Changes in release 20080206:
- Memory optimalizations
- Added heap info
- Implemented HeapSort
- Added optional support for GNU Trove
- Added BspDemo and fixed ConvexHullShape
- Added ConcaveDemo and it's supporting classes
- Abstracted OpenGL rendering


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Wed Feb 06, 2008 11:12 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 4050
Location: California, USA
That looks good, very cool!

There is still some occasional boxes jumping up into the air just before they go to rest, in the BasicDemo.
And software renderer that doesn't require permission would be nice, but I suppose the abstraction is the first step.

Did you already make effort to isolate the problem, figuring out when this 'jumping' happens?
Thanks,
Erwin


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Wed Feb 06, 2008 11:19 pm 
Offline

Joined: Fri Jan 11, 2008 8:33 am
Posts: 40
Erwin Coumans wrote:
Did you already make effort to isolate the problem, figuring out when this 'jumping' happens?


Not yet. I'm now focusing on other things and to actually use it in my applications. I will try to look into it soon though.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 120 posts ]  Go to page 1, 2, 3, 4, 5 ... 8  Next

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 21 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