RSS

Blog #5 – INFR i3110 – Understanding Nodes and Entity in Ogre

21 Oct

Hi, in this blog i will give a brief explanation of nodes and entity in ogre scene graph and how the transformation works between nodes.

The Nodes are ogre way to render scenes in an organized way. Nodes are connected to their parent nodes and can have as many children as well. In the end all these nodes should be connected one way or the other with the root scene node. Render-able objects in ogre are called Entity. They should be connected with nodes. each node has a transformation value that carries over to their children. So all the position, scale and rotation values are carried to its child nodes.

The following diagram shows the perfect representation of nodes in Ogre.

1

 

Here you can see that Root Scene Node is a main node for ogre in scene graph. All entities and other nodes must be connected with it.

Node 1 is connected with the root scene node. That means RootSceneNode is the parent of the Node 1 or in other word, Node 1 is the child of RootSceneNode. This can be represented in a code as followed.

manager->getRootSceneNode()->addChile(Node 1);

Node 1 also has a position which is 10 unit in Y direction and 1 unit in Z direction. So all entities and child nodes connected will also have this transformation applied to it.

Node 1 does not have any entities connected to it but it has two child nodes, Node 2 and Node 3. Node 2 has a position of (0,0,10) and Node 3 has a position has position of  (10, 0, 10). And both of these nodes have a entity connected to it most probably a mesh. But since Node 2 and 3 are child node of Node 1, Node 2’s final position will be at (0, 10, 11) and Node 3 final position will be at  (10, 10, 11). This is because these two nodes were already at a (0, 10, 1) when Node 1, their parent transformed. So Entity 1 and Entity 2 will be displayed on (0,10,11) and (10,10,11) respectively.

This is just a basic understanding of the node hierarchy in Ogre. In a real life example we can understand a house to understand node hierarchy. So a House is a Root Node, and It has several nodes like bedroom, living room, kitchen and they have their own child like drawer, sink and computer table and so on. So when a house moves every nodes of it moves with it, but when a computer table from bedroom moves, only a table and its child moves with it.

I hope you enjoy this blog and find it informative. See ya’ next time.

 
Leave a comment

Posted by on October 21, 2013 in Intermidiate Computer Graphics

 

Leave a comment