Physics & Scene Management with DirectX

mmakrzem 101 Mar 09, 2006 at 14:49

I’m using DX9c to create my game engine… however I’m a little confused what to do about scene management.

How should I organize all my objects in the game. Is there any good scene management software out there? What about Physics. I need something that will work with the scene management easily so that I can do collision detection and other fun stuff like that.

What are people using out there when you use DirectX?

5 Replies

Please log in or register to post a reply.

karligula 101 Mar 10, 2006 at 20:42

collision detection is FUN?

you’re mad ;-)

kulik 101 Mar 11, 2006 at 10:20

Look at the open source engines source for some scene graph and scene managing implementation (OpenSceneGraph, Ogre, CrystalSpace, ..).

Basically you want something called SceneGraph, in SceneGraph you have Nodes, attached to each other. You attach anything renderable to the nodes. When you move node, every subnode and attached renderables move too. Same applies to rotation or any other transformation.

When you outline this, you can try to implement a Octree optimization. Octree will build octane tree using attached renderables.

Physics is a little tricky, because the standard culling techniques aren’t applicable to physics. I solve it this way:
1) using std techniques to render (Octrees)
2) using physics scene optimizations parallel (got BruteForce - no culling, and basics of some sort of tree - scene divided into little boxes, collisions only happens from one body to bodies in neighbour boxes)

btw: I know I can collide using octree, however I think this approach is much more flexible than constraining physics to rendering scene managers …

@karligula: I agree, collision and physics is fun, but only when it has been already implemented and you’re watching the result ;)

mmakrzem 101 Mar 11, 2006 at 12:07

Do you know if there is any good documentation for OpenSceneGraph, Ogre, or CrystalSpace explaining how the scene management stuff works.

I’m not very good at taking code and trying to figure out what it’s for.

Just to clairify, you are using a scene graph to store all the data in your game, and another scene graph just for your physics?

I’m a little confused with the octrees bit. Are you saying your scene graph IS an octree?

roel 101 Mar 11, 2006 at 15:58

I wouldn’t consider a scene graph as an octree. A scene graph describes the logical relations between objects (a chair is in a house is in a village …) (or an axe is attached to the left hand of the player). An octree is a spatial data structure that is often used for frustum culling, like: give me all the objects that are inside the frustum.

kulik 101 Mar 11, 2006 at 21:36

I think I didn’t made that clear, octree != scene graph, octree is created using scene graph. octree isn’t used for scene management, but just for optimizations. I hope it’s clearer now ;)