Wednesday, November 7, 2007

XNA Scene-Graph

Today I worked on building a Scene-graph in XNA. Scene-graphs are a collection of nodes in a graph or tree structure. Which would display an object/entity as a node in which I could then reproduce children nodes of that parent node. A node may have many children but often only a single parent, with any effect to the parent node apparent to all its child nodes. All this helps in the optimization of game engines in relation to physical memory on the machine.

My supervisor asked me to create and demonstrate a simple scene graph using the notorious teapots. The simple scene graph I made uses a Scene Graph library I got from a tutorial I did on the Ziggyware website.

I create a parent node teapot, I then created a child node, grandchild node and great grandchild node. I attached each child to it's parent node. I made them revolve around the parent node in the centre of the scene, with each offspring getting smaller and further away from it's parent.

The parent node is then attached to the root of the scene, in this case (0,0,0). The center of the scene.

Creates the following scene graph

Root
/\---Parent
/\---Child
/\---Grandchild
/\---Great Grandchild

No comments: