And another one! Physics engine, that is!

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
Slicky
Bronze Sponsor
Bronze Sponsor
Posts: 600
Joined: Mon Apr 14, 2003 11:48 pm
Location: Was LA now France
x 22

Post by Slicky »

I haven't used Newton directly yet. Was it a lot of work redoing ODE to Newton?

User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post by monster »

I haven't "redone" anything. There's no relationship between OgreOde and Ogrewton except that they use the same graphics!

Like OgreOde, Ogrewton just wraps the Newton API calls into a set of exactly equivalent classes, all the type coercion back and forth between Ogre and Newton is handled for you and inheritable listener-style classes are used instead of callbacks. Also like OgreOde, it's not anything particularly clever (although the callback/listener changes were reasonably tricky) but it is time consuming to go through the whole API wrapping it up. Which is why I've still got all the joint stuff to do, as well as the vehicle and ragdoll containers!

Currently it's not much more than a proof of concept. For example, the performance is not quite as good as I'd expect it to be in that 1000 box demo. Partly that's because of the Ogre-overhead of having 1000+ SceneNodes (hardware instancing is on your 1.0.0 roadmap isn't it sinbad?) and partly that's down to the conversions to and from Newton transformation matrices and the Ogre Vector3/Quaternion representation. My plan is to get the wrapper completed, re-implement all the Newton demos in Ogre (and hopefully a few user-contributed ones, like Walaber's walking machines) and then look at the issues that there are when there's a hefty chunk of samples to test any improvements on.
Go Monster, master of physics.
Ah, if only. The masters are people like Russ (ODE) and Julio (Newton) I just do the donkey work of trawing through their APIs making them (I hope) simpler to use with Ogre. So in fact, I am merely a Donkey of Physics.

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 »

I've actually been starting my own Newton implementation for OGRE myself in the past week. I'm nowhere near a working demo yet, but I think I have a strong idea of how I want it to work.

so, uh... nice timing 8)

I've an idea for a fun little vehicle-based demo that I hope to make in the coming months with Ogre + Newton.

by the way, my version is called "OgreNewt" :wink:
Go Go Gadget OGRE!!
Image

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 »

got a bit of work done on OgreNewt, here's my first screenshot:

Image

it's my first attempt at building a proper OOP implementation of Newton, I'm pretty happy with it so far.

my next goal is to get TreeCollisions and ConvexHulls working. :P
Go Go Gadget OGRE!!
Image

User avatar
Sputnick
Greenskin
Posts: 110
Joined: Wed Sep 08, 2004 11:49 pm
Location: Lausanne, Switzerland

Post by Sputnick »

Looking good walaber.
Great job.

- Sput

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 »

wohoo! I got TreeCollisions working today, and I think the code can probably handle any Mesh you throw at it!

Image

[edit]

...and now with ConvexHull collision primitives working

Image
Go Go Gadget OGRE!!
Image

User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post by monster »

Not to be outshone (ha-ha), here's a re-implementation of Sascha Willems' (http://newton.delphigl.de/) "Complex 3DS Scenes" demo.
With a lovely shiny environment mapped track;
Image

User avatar
Banania
Gremlin
Posts: 150
Joined: Wed Oct 20, 2004 2:35 pm
Location: Paris, France
Contact:

Post by Banania »

Very nice ! Excellent !
Banania

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 nice :D

I'm sure your implementation will be much more elegant than mine...

but I must admit this has really helped my OOP skills, which were basically nothing before I started learning Ogre!

up next for me: simple vehicle demo, working on the classes right now. :D
Go Go Gadget OGRE!!
Image

User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post by monster »

I'm sure your implementation will be much more elegant than mine...

Well, I'm not sure about that!
monster wrote:COMMENTS DELETED

As a great philosopher once said; most problems in C++ can be solved with an additional level of indirection.

Onwards and upwards!
Last edited by monster on Sat Jan 08, 2005 2:09 pm, edited 1 time in total.

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 66
Contact:

Post by sinbad »

@monster: oh, that is SO cool. Looks like the kind of thing I used to build in the living room as a kid and drive my Mum nuts.

Looks like we have some competition going here ;) One of these should make it into ogreaddons, how about submitting them for public review and we can have a vote on it?

User avatar
Robomaniac
Hobgoblin
Posts: 508
Joined: Tue Feb 03, 2004 6:39 am

Post by Robomaniac »

:D

brings up the question though, ODE or Newton :)
phear hingo

My Webpage

User avatar
bal
Greenskin
Posts: 100
Joined: Thu Dec 09, 2004 7:29 pm
Location: Geluwe, Belgium

Post by bal »

Newton > ODE imo. Though ODE is open-source and cross-platform (Win/Linux), it is a lot less realistic than Newton. But Newton's Linux (and Mac) versions are coming...

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 »

let me first say that I am completely biased, as I've never actually coded anything with ODE, and have been using Newton for quite a while now.

but Newton is already (as of version 1.30) a full-featured physics SDK, with a great community of users (much like the Ogre community, actually). plus the engine is being improved and expanded continously, there are some really exciting features coming in the next few releases :D

I know vehicles are always a great way to show physics, which is why I'm working towards a vehicle demo... more of a demo for Newton than my implementation, although I might throw in the source code so I can get some comments on it. it's my first real attempt at an OOP class-based system :D

I hope to have a simple vehicle demo relatively soon, and then turn that into a mini-game once I get a stronger hold on Ogre (and CEGUI as well) :D

Monster- I'm looking forward to seeing any demos/source of your project as well!! I'd love to see how your implementation compares to mine :P
Go Go Gadget OGRE!!
Image

User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark
Contact:

Post by DWORD »

@ monster: :shock: looks awesome!!!

Slicky
Bronze Sponsor
Bronze Sponsor
Posts: 600
Joined: Mon Apr 14, 2003 11:48 pm
Location: Was LA now France
x 22

Post by Slicky »

I am really anxious to try a wrapper when you guys get closer to something useable. I would help myself except some nuances of class structures to get the best out of OOP I don't think of out of the box. I will give it a shot though if need be once I get done with some other stuff I'm working on.

I remember helping with Ogretok so I can help test and bug check this.

I'm curious about comparisons between ode/tok/newton. I have used both ODE (no wrapper) and Ogretok.

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 »

I'm getting farther with my Newton implementation... the other day I added in a debug visualizer using the Line3D library provided by Trep... it works very well.

I'm currently working on a mini-game using Newton+Ogre that is based on the Newton vehicle system. I have a ways to go yet, but I already have a standard vehicle with a customizable engine/gearbox/suspension working.

I'm currently writing an exporter for the lightmapper I use (Gile[s]) so I can create lightmapped meshes. I have a good start on the exporter, hopefully it'll be ready soon.

after that I need to do some more modelling before I can go much further on the game itself... I also really need to learn CEGUI so I can make a proper menu system for the game...
Go Go Gadget OGRE!!
Image

User avatar
bal
Greenskin
Posts: 100
Joined: Thu Dec 09, 2004 7:29 pm
Location: Geluwe, Belgium

Post by bal »

Very nice. I thought this was going nowhere, luckely it isn't :). I'm really looking forward to able to use Newton with Ogre.

AssiDragon
Greenskin
Posts: 145
Joined: Wed Apr 28, 2004 12:10 pm
Location: Hungary
Contact:

Post by AssiDragon »

Hmmm debug visualizer. Sounds very useful, always missed it when using Newton and getting weirdo results. :)
Hope is the first step on the road to disappointment.

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 »

I have a working vehicle demo now... with a fully functional transmission/gearbox, and adjustable engine power curve.

after I clean it up a little, I'll release a simple demo so people can try it out on different systems.

Image
Go Go Gadget OGRE!!
Image

User avatar
Sputnick
Greenskin
Posts: 110
Joined: Wed Sep 08, 2004 11:49 pm
Location: Lausanne, Switzerland

Post by Sputnick »

Great job walaber.
I'm looking forward to try it.

- Sput

dorvo
Halfling
Posts: 68
Joined: Tue Nov 02, 2004 8:01 pm

Post by dorvo »

That looks cool!
I should really block out more time to fiddle around with Newton and ODE.
I only got through the first two tutorials with Newton.
Gah! Too many projects to do! :cry:

elvencode
Gnoblar
Posts: 24
Joined: Fri Sep 03, 2004 1:29 pm
Location: Italy

Post by elvencode »

i'm trying trying to create the collision box from the bounding box of my crate entity but when i try to collide a crate making it fall over another, it goes throught :( it only slows down a little but no more. i've tried this

Code: Select all

// Create the collision shape
	Ogre::AxisAlignedBox bbBox = m_pSceneNode->getAttachedObject(0)->getBoundingBox();			
	m_pCollision = NewtonCreateBox (m_pNewtonWorld, bbBox.getMaximum().x - bbBox.getMinimum().x, bbBox.getMaximum().y - bbBox.getMinimum().y, bbBox.getMaximum().z - bbBox.getMinimum().z, NULL); 
any ideas of why collision is not detected?

elvencode
Gnoblar
Posts: 24
Joined: Fri Sep 03, 2004 1:29 pm
Location: Italy

Post by elvencode »

found the problem! i've thought that bodies who i dont want to push with a force or torque must not have any callback. but it's necessary at least a transform callback to make it "visible"
i'm using a class of my own, learning from Newton tutorials, Monster code, and my tests :wink:
can i ask why the bounding box of a SceneNode is bigger of the meshes in it? there's a way to pick the "real" bounding box ?
Thank you

Tenttu
Halfling
Posts: 74
Joined: Mon Dec 13, 2004 1:56 pm

Post by Tenttu »

I also got my newton port working, but for some reason it has a very poor performance. There is 300 boxes in that above shot and fps is only 7, and sometimes even lower.But thats not all, after boxes has "settled" (they are un active) fps will rice to 200 or similar. Has anyone else experienced similar problems? or any thoughts about it?

Image
The picture is taken with Release build.

Post Reply