Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Physics Modeling - Java3D suitability  (Read 5192 times)
0 Members and 1 Guest are viewing this topic.
Offline rohde

Innocent Bystander





« Posted 2006-06-18 10:01:04 »

Hi there,

I have a question on Java 3D's applicability on a project I'm soon to embark upon. I need to do some physics modeling/simulation of cloths using a mass spring system (with some colision detection). Since I've yet to learn Java 3D I was thinking this might be a good time for that.

I've perused the docs a bit, and it seems it might be suitable for such a project (by using GeometryArray for instance). My question is thus, would Java 3D be suitable for such an endevaour or is it too high-level? I have also been comtemplating using JOGL, but with Java 3D all the basic stuff is taken care of (like matrix and vector classes, quaternions etc), and I can focus on the physics part.

Any opinions and comments are velcome. Thanks.
Offline Breakfast

Senior Devvie




for great justice!


« Reply #1 - Posted 2006-06-18 21:17:27 »

Java3D is quick and easy for representing a 3D scene. If you're doing physics I would keep the physics implementation well away from the 3D stuff (so for example don't use Java3D to calculate when and where things have collided) and just use the physics to update the 3D scene as and when changes occur.
Offline darkprophet

Senior Devvie




Go Go Gadget Arms


« Reply #2 - Posted 2006-06-19 00:19:54 »

This is probably OT for this thread but...

Physics libraries can be thought of as big black boxes...feed data in about forces and torques, out comes new positions and rotations in world coordinates. The problem is actually feeding the scenegraph with the new transforms while still maintaining a nice heirarchy for culling and all sorts of nice optimisations. Anyone have any cool special algorithms to do that ?

DP


Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jeff

JGO Coder




Got any cats?


« Reply #3 - Posted 2006-06-28 21:16:29 »

The counter example is Shawn Kendall at IMI, who Cosmic Racer uses a rigid physics system that is directly driven off of the
Java3D scene graph structure.  The advantages are as follows:

(a) Cannot get out of synch with rendered data.  (Removes whole classes of potential bugs.)
(b) Uses the Java3D bounding system for hirearchical bounding volumes.  (Less coding, already optimized for the
J3D structures and update path, again less likely to get out of synch.)
(c) Less memory usage (you arent representing your geometry twice  in two diffferent ways.)

He still does his own final tri v. tri collision and penetration depth calculation.

i dont THINK Im giving away any trade secrets by revealing this much,,,


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Jeff

JGO Coder




Got any cats?


« Reply #4 - Posted 2006-06-28 21:17:22 »

Btw.. Shawn did a Jakobsen soft body physics model in Java3D more then 2 years ago with some fairly sophistcated exampels (one was in fact cloth)  so its definitely doable.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Breakfast

Senior Devvie




for great justice!


« Reply #5 - Posted 2006-06-28 22:44:21 »

That's very interesting- I'd always been lead to believe it was likely to be safer to keep them separate...
Offline darkprophet

Senior Devvie




Go Go Gadget Arms


« Reply #6 - Posted 2006-06-29 13:17:46 »

Quote
system that is directly driven off of the Java3D scene graph structure.

Would you mind explaining more about this? how exactly is it "driven off". You need to exachange transformation data between the physics layer and the graphics layer. (Ofcourse, if the physics and the graphics are using the same math classes, you could just pass a pointer to the tranform). But my question is still valid, how do you keep a tight scenegraph while allowing free movement ?

Cosmic Racer (as far as physics examples go) is pretty simple, but if you look at some of the videos by Artificial Stuidos and what they do with their physics, thousands of dynamic objects everywhere that can literally move from one end of the level to the next. How do you keep a clean and tight scenegraph so that the frustum culling is effecient in these cases?

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Offline kevglass

« JGO Spiffy Duke »


Medals: 212
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #7 - Posted 2006-06-29 15:53:31 »

Ooi, wasn't the game called Cosmic Birdie?

Kev

Offline Mike Jacobs

Junior Devvie





« Reply #8 - Posted 2006-06-30 03:23:13 »

...rigid physics system that is directly driven off of the Java3D scene graph structure.  ...

A while back, I did some research on collision detection and briefly considered using the scene graph as the bounding volume hierarchy (BVH).  [A BVH is used during a broad phase of collision detection to more quickly prune away distance objects from collision consideration.  Other tighter volumes up to and including the actual geometry are typically used in the narrow phase.].  There are many ways to create a BVH depending on the application (binary trees, n-ary trees, spheres, axis aligned boxes, oriented bounding boxes, etc.  Since the BVH is used for the broad phase of collision detection and my situation (a particle system) could involve many shapes, I elected to go with a separate axis aligned box BVH.  This was mostly because the particles could have little or no locality coherence (they could go anywhere).  I also elected to use 'subtree volume' as the cost function to determine how to build the BVH for the same reasons.  If an application has a relatively static scene, then the scene graph seems like it could double as a fine BVH.  It has a collision bounds at each level and already has a tree structure.  Ultimately, the decision is primarly about the perfomance of the collision detection.

Mike 

Special Effects for Java 3D games: http://www.indietechnologies.com
Offline darkprophet

Senior Devvie




Go Go Gadget Arms


« Reply #9 - Posted 2006-06-30 22:35:58 »

Ah ok, so you are using the bounding volume heirarchy to do wide area collision detection? Nice....

Why doesn't any physics engine out there at the moment do that? They all have their own weird way of dividing up the universe (im thinking Spaces for ODE) for collision detection. Looks like ive found myself something to code for a few days Smiley

But the question still remains, once that dynamic object has traveled across the scenegraph, how do you stop the bounding heirarchy severly overlapping itself...maybe some PhD student should write a dissertation about it

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mike Jacobs

Junior Devvie





« Reply #10 - Posted 2006-07-01 03:17:17 »

Ah ok, so you are using the bounding volume heirarchy to do wide area collision detection? Nice....
Why doesn't any physics engine out there at the moment do that?
DP,
I was trying to justify the possibility that using the scene graph as a basis for the BVH was reasonable for applications with relatively static scenes.  I have no first hand knowledge that IMI did what I described (sorry if that was not clear).  My physics stuff does the weird stuff (with axis-aligned bounding boxes (AABB) and a binary tree).  Java3D does not reveal a BVH, so one would have to manage the volumes within the application (presumably with BoundingBox and the collision bounds) using the scene graph.

The severely overlapping volumes is a common issue in a BVH implementation.  Because I selected 'minimum added volume' as the cost function to determine the 'best' tree location, the tree does need to be rebuilt occasionally if the objects are long lived.

Entire books have been written the subject.

Mike

Special Effects for Java 3D games: http://www.indietechnologies.com
Offline darkprophet

Senior Devvie




Go Go Gadget Arms


« Reply #11 - Posted 2006-07-01 21:39:27 »

Got a few links that are specific to my question? Im interested in that area at the moment...

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Offline Mike Jacobs

Junior Devvie





« Reply #12 - Posted 2006-07-02 20:26:32 »

Got a few links that are specific to my question? Im interested in that area at the moment...

DP

"Five Balltree Construction Algorithms," Technical Report TR-89-063, International Computer Science Institute, Berkeley, CA, November 1989.  [http://http.icsi.berkeley.edu/ftp/global/pub/techreports/1989/tr-89-063.pdf]

"Using Dynamic Bounding Volume Hierarchies To Improve Efficiency of Rigid Body Simulations', Robert Webb and Mike Gigante.
[http://portal.acm.org/citation.cfm?id=135556&dl=ACM&coll=ACM&CFID=74193598&CFTOKEN=33406427].  I had to order a hardcopy (cannot find an online version).

Google 'Gino Van De Bergen'

Mike

Special Effects for Java 3D games: http://www.indietechnologies.com
Offline shawnkendall

Senior Devvie





« Reply #13 - Posted 2006-07-06 14:46:37 »

Ah ok, so you are using the bounding volume heirarchy to do wide area collision detection? Nice....
...Java3D does not reveal a BVH, so one would have to manage the volumes within the application (presumably with BoundingBox and the collision bounds) using the scene graph.
...

That is incorrect. Java3D does have and exposes the BVH (bounding volume heirarchy) and we use it in our traversal down to the shape level.  Then at the point we added addition partitioning down to the triangle.  This way we could use as much of the J3D graph as possible AND it makes it easy on the artist since most of the time the collision geometry is the same as the visual geoemtry.
Another reason we did this is because you can deform the geometry in our engine, so we had to manipulate the J3D shapes.  In that case you really want the visual and collision to be one in the same.
Quote

Shawn Kendall
Cosmic Interactive, LLC
http://www.facebook.com/BermudaDash
Offline Mike Jacobs

Junior Devvie





« Reply #14 - Posted 2006-07-07 19:19:11 »

That is incorrect. Java3D does have and exposes the BVH (bounding volume heirarchy) and we use it in our traversal down to the shape level. 

That's interesting.  When I asked earlier, the answer was no.  See http://forums.java.net/jive/thread.jspa?forumID=70&threadID=4723&messageID=42803#42803.  I would not call the scene graph the BVH.  Is that our difference?

Mike

Special Effects for Java 3D games: http://www.indietechnologies.com
Offline shawnkendall

Senior Devvie





« Reply #15 - Posted 2006-07-07 21:33:38 »

Perhaps they were confusing what you wanted with the Java3D internal BINARY tree that is used for culling.

Every node in the Java3D graph has a bounding geometry (usually a sphere for each grouping node, and a box for each Shape3D).  We are using those exact bounds to traverse the graph looking for collision (we even do some caching and manipulations of those bounds).  Shoot, our system even inverse transforms into local Shape3D space to do the bounds test on the Local axis aligned box (which is oriented in global space)  It works great, I love it ;-).

Who is Jada that made that response?

Oh I see it's Chien.
He must have misunderstood your question :-)

Shawn Kendall
Cosmic Interactive, LLC
http://www.facebook.com/BermudaDash
Offline jfelrod1960

Junior Devvie




Use the source Luke, use the source!!!


« Reply #16 - Posted 2006-07-08 21:11:21 »

This sounds very interesting ... maybe you should write a paper? Smiley

Jeffrey F. Elrod
Complexsive Systems
Offline shawnkendall

Senior Devvie





« Reply #17 - Posted 2006-07-09 17:30:44 »

The best I can offer right now is my blog :-)

Shawn Kendall
Cosmic Interactive, LLC
http://www.facebook.com/BermudaDash
Offline uj

Junior Devvie





« Reply #18 - Posted 2006-07-31 11:04:27 »

That's very interesting- I'd always been lead to believe it was likely to be safer to keep them separate...

I think it depends on the purpose of the physics modeling. Sometimes physics modeling is used to enhance the visual experence and sometimes it's used to learn more about physics. In the first case it's probably no harm in integrating the physics quite tightly with the scenegraph, but in the other it's definately a mistake.

Also note the emerging physics cards. To be able to use them I guess its not a good idea to intertwine the physics modeling to much with Java3D.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (33 views)
2014-12-15 09:26:44

Mr.CodeIt (23 views)
2014-12-14 19:50:38

BurntPizza (51 views)
2014-12-09 22:41:13

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (45 views)
2014-12-05 12:39:02

SHC (59 views)
2014-12-03 16:27:13

CopyableCougar4 (59 views)
2014-11-29 21:32:03

toopeicgaming1999 (123 views)
2014-11-26 15:22:04

toopeicgaming1999 (114 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!