Real-Time Physics Simulation Forum
http://www.bulletphysics.org/Bullet/phpBB3/

Java port of Bullet
http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=1827
Page 1 of 9

Author:  jezek2 [ Fri Jan 11, 2008 2:08 pm ]
Post subject:  Java port of Bullet

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.

Author:  irrisor [ Sun Jan 13, 2008 6:31 pm ]
Post subject:  Re: Java port of Bullet

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)

Author:  Erwin Coumans [ Sun Jan 13, 2008 7:04 pm ]
Post subject:  Re: Java port of Bullet

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

Author:  jezek2 [ Sun Jan 13, 2008 10:46 pm ]
Post subject:  Re: Java port of Bullet

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

Author:  jezek2 [ Sun Jan 13, 2008 10:54 pm ]
Post subject:  Re: Java port of Bullet

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 :)

Author:  jezek2 [ Wed Jan 16, 2008 8:07 am ]
Post subject:  Re: Java port of Bullet

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

Author:  Erwin Coumans [ Thu Jan 17, 2008 8:48 am ]
Post subject:  Re: Java port of Bullet

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

Author:  jfelrod1960 [ Mon Jan 21, 2008 3:37 am ]
Post subject:  Re: Java port of Bullet

This is impressive! Do you plan to have a website for jBullet?

Author:  jezek2 [ Tue Jan 22, 2008 12:27 pm ]
Post subject:  Re: Java port of Bullet

jfelrod1960 wrote:
This is impressive! Do you plan to have a website for jBullet?


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

Author:  jezek2 [ Tue Jan 22, 2008 4:24 pm ]
Post subject:  Re: Java port of Bullet

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 :)

Author:  Erwin Coumans [ Tue Jan 22, 2008 9:44 pm ]
Post subject:  Re: Java port of Bullet

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

Author:  jezek2 [ Wed Jan 23, 2008 9:09 am ]
Post subject:  Re: Java port of Bullet

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.

Author:  jezek2 [ Wed Feb 06, 2008 11:05 pm ]
Post subject:  Re: Java port of Bullet

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

Author:  Erwin Coumans [ Wed Feb 06, 2008 11:12 pm ]
Post subject:  Re: Java port of Bullet

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

Author:  jezek2 [ Wed Feb 06, 2008 11:19 pm ]
Post subject:  Re: Java port of Bullet

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.

Page 1 of 9 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/