0
\$\begingroup\$

I'm trying to understand if it makes sense to call what I have a scene graph or not.

Im doing an asteroid-like game, where all objects in the game are described in world space coordinates (an asteroid will be at X 50, Y 50 and it wont have objects orbiting, the player avatar is at X 100, Y 100 and it does'nt have a turret rotating the base of the ship. Objects are all described in world space, not in relationship to each other cause it just dose'nt make any sense).

For clarity (on why I will be mentioning a view matrix and a projection matrix bellow) - this is a 3D game with 3D objects in it, but the camera is locked facing one direction.

What I have is an object with a set of vectors containing all the objects visible in the scene. To me, this is still a scene graph - it just happens to be a flat graph where everything in the scene is a single node, not a child of a parent. The scene graph also stores the projection and view matrix, as these are common to all objects scene (the view and projection matrix are static, only world space coordinates are updated). One could consider this view matrix as a transformation "node" that will be applied to all the children in the scene graph I guess.

So my question is - am I stretching it calling this a a "Scene Graph" and should I use another name for it?

\$\endgroup\$
  • \$\begingroup\$ Why do you ask, why does it matter to you whether it is a scene graph? \$\endgroup\$ – Alexandre Vaillancourt Jun 16 at 16:30
  • \$\begingroup\$ Im trying to make both a work portfolio and a tutorial for others, which is why I want it to be as accurate as possible \$\endgroup\$ – Jimmie Johnsson Jun 16 at 17:31
0
\$\begingroup\$

In your case it is not a scene graph because you don't have object hierarchies, e.g. your objects are stored in flat lists and not in a tree like datastructure. Now flat lists are in mathematical sense some kind of graph, but in a scene graph you can have a node with more than two links, whereby in a list node only the information about the previous node and next node can be known. Even more your objects transformations are not interrelated or dependent on another.

Remove your one object (the root container) and you end up with a set of vertices and a flat list of objects which you can easily iterate through inside a simple while render loop.

Please don't call the list implementation a graph in your tutorial because that can mislead people into thinking wrong about the concepts of local space and world space! Best example for a transformation graph is solar system or legs connected to torso, e.g. minecraft characters.

\$\endgroup\$
  • \$\begingroup\$ I tend to agree. It feels a bit "off" calling it a scene graph. I named it as such because I wanted to keep it open for possible more things to come but I don't think I will end up having hierarchy of transformations. Got any suggestions for a better name? I still want to have an object which keeps and renders all the various things in the game (there are 3 separate types of objects all handled by this object as is now). \$\endgroup\$ – Jimmie Johnsson Jun 16 at 18:47
  • \$\begingroup\$ For me it's more of a object container that stores reference to all objects in the game without knowing much about the stored objects relationships. \$\endgroup\$ – D3d_dev Jun 16 at 19:46
  • 1
    \$\begingroup\$ I renamed it to simply GameScene. It holds a set of refs to vectors with objects that will be rendered in the scene. My intention with it is basically an object that is responsible for drawing all things in the scene that you can see. \$\endgroup\$ – Jimmie Johnsson Jun 16 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.