PDA

View Full Version : Physics & Scene Management with DirectX


mmakrzem
03-09-2006, 07:49 AM
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?

karligula
03-10-2006, 01:42 PM
collision detection is FUN?

you're mad ;-)

kulik
03-11-2006, 03:20 AM
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
03-11-2006, 05:07 AM
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
03-11-2006, 08:58 AM
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.

http://www.gamedev.net/community/forums/topic.asp?topic_id=110342
http://www.gamedev.net/community/forums/topic.asp?topic_id=128965
http://www.gamedev.net/community/forums/topic.asp?topic_id=181233

kulik
03-11-2006, 02:36 PM
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 ;)