Open Physics Abstraction Layer sample app

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
tylerstreeter
Gnoblar
Posts: 24
Joined: Thu Apr 21, 2005 7:23 pm
Contact:

Open Physics Abstraction Layer sample app

Post by tylerstreeter »

Just to give some background, here's a message I recently posted on the ODE message board:

----------------------------
Open Physics Abstraction Layer is a library I've been working on for a
few months with Andres Reinot and Alan Fischer. The goal of the
project is to make it easy for people to start using physics
simulation in their applications by providing a simple interface over
the top of existing physics engines (ODE only for now, but it could be
extended to use others in the future). It's mainly helpful for people
getting started with physics that don't want/need to tweak tons of
parameters. It also provides a set of high-level constructs (various
sensors and motors) for things like robotics simulations.

I just posted a new version (0.3.0), including a source release and a
precompiled win32 binary version. Also included is a sample app that
uses the Ogre rendering engine (www.ogre3d.org).

If you're interested, read more details on the website (I have posted
tutorials and full API documentation), and let me know what you think.

http://opal.sourceforge.net
----------------------------

The sample app that uses Ogre is a fun little arena with simple physical objects, a wall of blocks, a tower of blocks, and a ragdoll, complete with a spring-based picking system for dragging things around. If you're interested, there's a source and win32 binary version available here (get the 0.3.0 version):

http://sourceforge.net/project/showfile ... _id=134434

Tyler

User avatar
myak
Halfling
Posts: 40
Joined: Fri May 23, 2003 10:46 pm
Location: Warsaw, Poland

Post by myak »

Looks quite nice though you should post some screens here I suppose - it's Showcase forum.

One thing bothers me. Why do I get _1_ fps when pressing 8? Yeah, I know, it's because of these objects created, but hell, there's P4 3GHz inside my box, it should be enough. It gets a little bit better (5 fps?) when the stack collapses but it's too slow anyway.

And I think it's OPAL doing something really bad, because when I run OgreODE and Helicopter vs Wall demo (there's a lot of boxes creating a wall) I get ~100 fps.

I haven't had time to check the sources, maybe these bricks are trimeshes or something and that's the cause of poor performance.

Anyway - nice one. I'm waiting for other physic engines support :)
Marcin Jakubowski
jabber://myak@chrome.pl

User avatar
johnhpus
Platinum Sponsor
Platinum Sponsor
Posts: 1186
Joined: Sat Apr 17, 2004 2:49 am
x 3

Post by johnhpus »

I had a lot of fun playing with your demo.

I don't know muc about the technical stuff of how ragdoll works and its limitations, etc. I tortured the ragdoll in your demo with some pretty high velocity impacts into the giant block and found that his limbs tend to fligh off if he hits hard enough. Is this an unintended accident or a demonstration of breaking joints?

User avatar
psyclonist
OGRE Expert User
OGRE Expert User
Posts: 286
Joined: Fri Nov 01, 2002 3:54 pm
Location: Berlin & Nuremberg, Germany
x 1
Contact:

Post by psyclonist »

Did you take a look at ODF, Rocket etc?

Check here: http://www.physicstools.org/.

Rocket is like a RAD environment for physics apps. Is that what you're aiming at?

-psy

tylerstreeter
Gnoblar
Posts: 24
Joined: Thu Apr 21, 2005 7:23 pm
Contact:

Post by tylerstreeter »

Did you take a look at ODF, Rocket etc?

Check here: http://www.physicstools.org/.

Rocket is like a RAD environment for physics apps. Is that what you're aiming at?
We started OPAL around the same time that ODF was getting off the ground. At that time there was no ODE support in ODF, and we wanted something that would work on all platforms (like ODE). OPAL has been tested on multiple platforms (Win32, Mac OS X, Linux, and IRIX); ODF, it seems, is mainly focused on the Win32 platform. OPAL also has a few features that ODF currently doesn't have, like some of the motors and sensors (e.g. incline sensor, volume sensor).
I don't know muc about the technical stuff of how ragdoll works and its limitations, etc. I tortured the ragdoll in your demo with some pretty high velocity impacts into the giant block and found that his limbs tend to fligh off if he hits hard enough. Is this an unintended accident or a demonstration of breaking joints?
That's the breakable joints feature. This can be turned off/adjusted. This demo loads the ragdoll from an OPAL XML file, so if you want, you can open ragdoll.xml and tweak the "BreakThresh" value.
One thing bothers me. Why do I get _1_ fps when pressing 8? Yeah, I know, it's because of these objects created, but hell, there's P4 3GHz inside my box, it should be enough. It gets a little bit better (5 fps?) when the stack collapses but it's too slow anyway.

And I think it's OPAL doing something really bad, because when I run OgreODE and Helicopter vs Wall demo (there's a lot of boxes creating a wall) I get ~100 fps.

I haven't had time to check the sources, maybe these bricks are trimeshes or something and that's the cause of poor performance.
Not totally sure on that. I have a PentiumM 1.6 GHz, and in 1024x768 with a tower of blocks I get 166fps, 36fps, and 22fps with no shadows, shadows w/ 1 light source, and shadows w/ 2 light sources, respectively. Did you run it with or without shadows? What's your video card?
Looks quite nice though you should post some screens here I suppose - it's Showcase forum.
Sorry, I'm new. :)

Image
Image
Image[/img][/quote]

User avatar
myak
Halfling
Posts: 40
Joined: Fri May 23, 2003 10:46 pm
Location: Warsaw, Poland

Post by myak »

tylerstreeter wrote:Not totally sure on that. I have a PentiumM 1.6 GHz, and in 1024x768 with a tower of blocks I get 166fps, 36fps, and 22fps with no shadows, shadows w/ 1 light source, and shadows w/ 2 light sources, respectively. Did you run it with or without shadows? What's your video card?
Geforce 6600GT/PCI-E - I can assure that's not the problem :)

Others don't seem to report this so maybe it's just my comp, crappy and installed ages ago Windows or aliens invading my motherboard ;)

Strange thing it' that only when all the bricks are on their place - when they form a tower. When the tower collapses everything seems to be fine.
Marcin Jakubowski
jabber://myak@chrome.pl

tylerstreeter
Gnoblar
Posts: 24
Joined: Thu Apr 21, 2005 7:23 pm
Contact:

Post by tylerstreeter »

tylerstreeter wrote:
Not totally sure on that. I have a PentiumM 1.6 GHz, and in 1024x768 with a tower of blocks I get 166fps, 36fps, and 22fps with no shadows, shadows w/ 1 light source, and shadows w/ 2 light sources, respectively. Did you run it with or without shadows? What's your video card?
Geforce 6600GT/PCI-E - I can assure that's not the problem Smile

Others don't seem to report this so maybe it's just my comp, crappy and installed ages ago Windows or aliens invading my motherboard Wink

Strange thing it' that only when all the bricks are on their place - when they form a tower. When the tower collapses everything seems to be fine.
The tower should definitely slow things down a lot since there are so many contact points being generated continually, but I don't know why it slows down that much on your machine. If anyone else sees the same problem, please post your computer specs too.

User avatar
johnhpus
Platinum Sponsor
Platinum Sponsor
Posts: 1186
Joined: Sat Apr 17, 2004 2:49 am
x 3

Post by johnhpus »

That's the breakable joints feature. This can be turned off/adjusted. This demo loads the ragdoll from an OPAL XML file, so if you want, you can open ragdoll.xml and tweak the "BreakThresh" value
That's cool.

Am I the only person who has -way- too much fun abusing the poor ragdolls in demos like this?

I've had no performance problems with the demo.

morricone
Gnoblar
Posts: 24
Joined: Tue Mar 15, 2005 8:03 pm

Post by morricone »

tylerstreeter wrote:
tylerstreeter wrote:
Not totally sure on that. I have a PentiumM 1.6 GHz, and in 1024x768 with a tower of blocks I get 166fps, 36fps, and 22fps with no shadows, shadows w/ 1 light source, and shadows w/ 2 light sources, respectively. Did you run it with or without shadows? What's your video card?
Geforce 6600GT/PCI-E - I can assure that's not the problem Smile

Others don't seem to report this so maybe it's just my comp, crappy and installed ages ago Windows or aliens invading my motherboard Wink

Strange thing it' that only when all the bricks are on their place - when they form a tower. When the tower collapses everything seems to be fine.
The tower should definitely slow things down a lot since there are so many contact points being generated continually, but I don't know why it slows down that much on your machine. If anyone else sees the same problem, please post your computer specs too.
Same Problem with D3D9 and OpenGL.

My PC:

Athlon XP 2GHZ
Geforce 4 Ti 4200
1 GB RAM

User avatar
Olex
Hobgoblin
Posts: 593
Joined: Fri Apr 08, 2005 6:08 pm
Location: WA, USA

Post by Olex »

Awesome! Just what I was looking for!

Thanks!

tylerstreeter
Gnoblar
Posts: 24
Joined: Thu Apr 21, 2005 7:23 pm
Contact:

Post by tylerstreeter »

Same Problem with D3D9 and OpenGL.

My PC:

Athlon XP 2GHZ
Geforce 4 Ti 4200
1 GB RAM
Could you post the window resolution and the fps you're seeing with and without shadows? Again, here's my setup and performance:

Windows XP w/ SP2, PentiumM 1.6 GHz, 512mb ram, Radeon Mobility 9000, 1024x768 window (not fullscreen), single block tower, camera looking at the tower

No shadows, 1 light source: 166fps
Shadows, 1 light source: 36fps
Shadows, 2 light sources: 22fps

User avatar
joshcryer
Gnome
Posts: 351
Joined: Wed Oct 13, 2004 8:22 am

Post by joshcryer »

Really nice demo! :)

It would be cool if the plane was a bit bigger. I enjoy taking the ragdoll and dropping him from really high or throwing him around until his limbs rip off, hehehe.

Only performance problems I got was when I went inside the brick wall thingy, went down to something like 8fps, from far away things were fine though.

User avatar
myak
Halfling
Posts: 40
Joined: Fri May 23, 2003 10:46 pm
Location: Warsaw, Poland

Post by myak »

tylerstreeter wrote: Could you post the window resolution and the fps you're seeing with and without shadows?
Windows XP SP2, P4 3GHz, Geforce 6600GT, 512 MB RAM

1024x768x32bpp (fullscreen):

D3D9:
Shadows: 13fps
No shadows: 45fps

GL:
Shadows: 0.9fps
No shadows: 45fps

Windowed mode gets almost the same results in GL and a little bit better in D3D9.
Camera is in the same place (default, starting position), light sources - default number (= 1, I guess).

I know it's because of many contact points but you can also notice (well, I can) that the bricks in the tower are moving (the tower would collapse without applying any forces to bricks). Seems to me that those bricks should stay at where they are until something hits them - means they should be freezed until that moment. It may be ODE related problem and it's not OPAL's fault.


[EDIT]
Nevermind the results. /me is just dumb :) With Einstein@Home & some really heavy calculations working in background the results were just ok :)
Sorry for troubles :oops:

But moving bricks are still a little bit strange.
[/EDIT]
Marcin Jakubowski
jabber://myak@chrome.pl

User avatar
Olex
Hobgoblin
Posts: 593
Joined: Fri Apr 08, 2005 6:08 pm
Location: WA, USA

Post by Olex »

Do you guys have a forum?

tylerstreeter
Gnoblar
Posts: 24
Joined: Thu Apr 21, 2005 7:23 pm
Contact:

Post by tylerstreeter »

Nevermind the results. /me is just dumb Smile With Einstein@Home & some really heavy calculations working in background the results were just ok Smile
Sorry for troubles Embarassed
No problem. :wink: Glad to know what the problem was.
I know it's because of many contact points but you can also notice (well, I can) that the bricks in the tower are moving (the tower would collapse without applying any forces to bricks). Seems to me that those bricks should stay at where they are until something hits them - means they should be freezed until that moment. It may be ODE related problem and it's not OPAL's fault.
ODE's box stacking is not perfect, but it's still pretty good with motion damping and autodisabling enabled (i.e. OPAL's linear/angular damping and sleeping features). You'll notice that the wall of blocks goes to "sleep" after just a little bit because of these features. ...But the tower never goes to sleep. The more blocks touching, the harder it is to get everything to go to sleep (with the current state of ODE, anyway). Actually, I could have just started the whole tower asleep and it would look nice initially, but the slightest nudge would wake up everything again, so I just left it.

User avatar
Olex
Hobgoblin
Posts: 593
Joined: Fri Apr 08, 2005 6:08 pm
Location: WA, USA

Post by Olex »

Yeah, it's always a nagging problem with ODE, trying to get everything to come to rest.
It's also a serious performance hit. :? But OPAL demo handles it quite well.

I have looked at the API, and my understanding is that you use ODE stepFast1(), right?

tylerstreeter
Gnoblar
Posts: 24
Joined: Thu Apr 21, 2005 7:23 pm
Contact:

Post by tylerstreeter »

Do you guys have a forum?
No, sorry. No plans for that at the moment.
Yeah, it's always a nagging problem with ODE, trying to get everything to come to rest.
It's also a serious performance hit. But OPAL demo handles it quite well.
What's the performance hit? The damping and autodisabling algorithms, or the fact that things don't come to rest very quickly?

That demo uses the default OPAL parameters for damping and autodisabling (sleeping). One of our goals is to provide a really good set of default parameters so users only have to tweak a few things for their apps.
I have looked at the API, and my understanding is that you use ODE stepFast1(), right?
No, it uses ODE's quickstep and worldstep solvers. OPAL's Simulators have an "accuracy level" parameter: the less accurate (but quicker) accuracy levels use the quickstep solver with different numbers of iterations (the least accurate level uses fewer iterations than the medium accuracy level). The most accurate level uses the worldstep solver.

User avatar
joshcryer
Gnome
Posts: 351
Joined: Wed Oct 13, 2004 8:22 am

Post by joshcryer »

Any performance comparision between OpalOde and OgreOde? Would be interesting to see. :)

User avatar
Olex
Hobgoblin
Posts: 593
Joined: Fri Apr 08, 2005 6:08 pm
Location: WA, USA

Post by Olex »

What's the performance hit? The damping and autodisabling algorithms, or the fact that things don't come to rest very quickly?
The fact that bodies dont come to rest quickly is a serious perfomance hit. Creation of all those collision-contact-joints is really quite a problem once you have about 300+ objects in close proximity.

For example, when I throw in 3-4 towers, app just dies (<1 fps). Those boxes just keep moving around, very slowly, but yet still creating contact joints.

How does tower behave under lowest accuracy? My goal is try to reach about 1000+ objects with acceptable performance, even if I have to sucrifice accuracy.

Anybody recall "Painkiller" demo boss? It had a LOT of boxes flying around with very good perfomance.

User avatar
eugen
OGRE Expert User
OGRE Expert User
Posts: 1422
Joined: Sat May 22, 2004 5:28 am
Location: Bucharest
x 8
Contact:

Post by eugen »

they use Havok in PainKiller, i think is a small difference from ode's performance!
nice demo! :)
as i remember, OgreOde at its first or second version died on my machine on almost 300 bodies...the performance i think is comparable!

User avatar
walaber
OGRE Expert User
OGRE Expert User
Posts: 829
Joined: Sat Oct 02, 2004 2:20 pm
Location: California, USA
Contact:

Post by walaber »

very fun demo! it ran pretty well on my crappy work computer, unless I pressed the 8 button and spawned the Jenga-like tower, it crawled to something like 0.1 fps :P

otherwise very cool! being a physics lover, I can never get enough of these demos :)
Go Go Gadget OGRE!!
Image

User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Post by tuan kuranes »

Nice.

What facilites do you intend provide in regards of network games/simulation ?

(get pos/quat/accel/vel of all objects, time rewind, make simulation deterministic, etc..)

Check this a good addition to your ragdolls : http://www.mmandel.com/gdc

User avatar
myak
Halfling
Posts: 40
Joined: Fri May 23, 2003 10:46 pm
Location: Warsaw, Poland

Post by myak »

tuan kuranes wrote:What facilites do you intend provide in regards of network games/simulation ?
I'm also very interested in this, especially in making simulation deterministic.
Marcin Jakubowski
jabber://myak@chrome.pl

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 65
Contact:

Post by sinbad »

Looks good; more open source tools for physics have to be welcome, and I'm sure the Blender exporter you have planned will be popular. Well done!

reimpell
OGRE Contributor
OGRE Contributor
Posts: 570
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

Re: Open Physics Abstraction Layer sample app

Post by reimpell »

For the planned feature "OPAL XML exporter for Blender" it would be very nice if one could import it as a Python module and call it on a per Blender object level. This way a seamless integration with the DotScene exporter would be very easy.

Post Reply