• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Xperience

Scene graph

6 posts in this topic

Hi,

I'm trying to create my own 3D engine, but I have some problems with implementing scene graph. I want to achieve this:

Assume that our character is on the ship. He doesn't move relative to the ship, but he moves relative to world(where ship go, he go too). Not only he, but everything what is on the board.

I'm using actor component system and I'm storing WorldMatrix inside transform component(But I have idea to store scene node directly to the actor, as a component, is this a bad idea?)

I have created scene graph based on GCC one(but it doesn't work in deeper hierarchy what is what I want to achieve).

My second question is:

I read : http://www.gamedev.net/topic/619283-are-scene-graphs-worth-it/

that I should separate rendering from scene graph(I'm reading GCC and they used scene graph as rendering system).

But if I do it, is then scene graph unnecessary?

Edited by Xperience
0

Share this post


Link to post
Share on other sites
I think it's still necessary, some way or another. Could also be childs pointing to parents etc.
In your use case you could say that:

- player has it's local orientation (it's childs and renderables derive it's world matrix)
- you can give player a parent for world orientation.
This would be an identity matrix if the player's state is on the land or in the sea, and it could be the derived world matrix of for example your ship or a car (depending on the state of the player).

To visualize a bit:

- player parent = ship transform or car transform or identity (on land, walking), based on player state
- player world matrix = own orientation * parent (either identity or ship orientation)
- player head = own orientation * player matrix/ orientation

I don't know how you can fully seperate the scenegraph from the rendering system. In my engine I have a renderqueue holding only ID's etc. These point to renderables/ objects/ materials/ shaders etc. When something is rendered through the order determined by the queue, my rendering system retrieves the world matrix for that renderable (kept as member in all renderable and object objects). All dynamic objects and their renderables are updated within the classes of both of themselves.
1

Share this post


Link to post
Share on other sites

The reason to have a scene graph is so that you can represent hierarchical relationships in your scene.  If you have your player walking on a ship, it would make sense to have them as a child of the ship until they leave it where it would become a child of the world or whatever else he was on.

 

Thank about the situation where the ship has to bob up and down because something heavy was dropped on it.  If your player (and everything else on the ship) isn't a child of the ship, how do you know that you also have to make your player bob up and down?

 

One other comment is this: if you think a scene graph is going to work for you, then try it out and experiment with it.  Don't rely on what others are saying, because you need to understand the reasons behind the decision for yourself.  Just remember to design your code so that an entity binding system can be swapped in and out without too much pain, and then you can try different schemes without having to totally rewrite your engine.

2

Share this post


Link to post
Share on other sites

Thank you for your advices!

This is exactly like I'm doing it:

 

 

                                         |- Car     -|-  Player

                                         |

Root(just identity matrix) -| - Ship   -|- AI

                                                        -|- Machine gun

                                         |

                                         |-  Another AI(walking on the land)

 

But I had some problems with concatenating matrices, like car stopped, but Player was still moving, or(the funniest one) player in the car was moving with exponential speed.

 

I solved this by using three matrices(is there a better way? This one brings a lot of matrix concatenations):

1) Parent transformation

2) Local transformation relative to the parent

3) World transformation

 

Now, I'm using scene graph for computing world transformations and visibility tests and I'm trying to experiment with graphics too.

Ok, I try to rely less on what others are saying, but I want to find and develop things in the best way I can do it.

And what about rendering system? What is meaning to separate it?(This or not(If I understand it correctly)?: Traverse scene graph, compute world matrices, find which scene nodes can be renderered and add them into rendering queue?)

 

And my final question(or request), can someone review my English, please? Thank you

Edited by Xperience
0

Share this post


Link to post
Share on other sites
That's a lot of questions :)

- three matrices shouldn't be a problem, assuming that 2 is for the player, 1 is identity/boat/car and 3 is the multiplication of both (there would be a 4th variant for the childs/ renderables of objects that are related to for example the boat: boat to world, object to boat, child/ renderable of object to object)
- there's no law on this, but you can use a renderqueue for sorting out everything you need to render in a frame, I only keep id's and indices in the queue, pointing to objects, renderables, shaders etc. (in the wanted order to reduce draw calls).
- my d3dscene class has an update function, which does the culling and save visibility per zone/ object/ renderable/ positional light. In this class I also update all objects's matrices, each object kan have childs which update accordingly. This last 'job' could also be separated into a scenegraph (class), but I didn't see the advantage of doing that yet (maybe later on when things get more complex in the scene/ level)

Your english doesn't seem to be too bad (for usage on the forums), looking at your post/ replies. Did you mean these texts or something else you wanted to have reviewed? (of course if you want to write for example a letter, resume or motivation for a job application, then I'm not the right person to judge/ review :))
1

Share this post


Link to post
Share on other sites

I solved this by using three matrices(is there a better way? This one brings a lot of matrix concatenations):

1) Parent transformation

2) Local transformation relative to the parent

3) World transformation

 

That's the general idea behind a hierarchy tree of transformations.

In fact what you really need are just ToParent relative (local) transformation matrices. Then you can get all global (world) transformations just by multiplying the ToParent matrix of the actual node with the ToParent matrix of its parent with the ToParent matrix of this parent's parent.... all the way to the top-most node. The top-most node has no parents and you assume it's global transform to be identity.

This is very inefficient, because you'll be repeating the same multiplications a lot, unless each parent has only one descendant. So it's a good idea to store the global (world) transform of each node and when you go from the top to the bottom, you calculate the world matrix of each node by just multiplying its ToParent matrix with the parent's World matrix (which already incorporates all the ToParent*ToParent*ToParent... multiplications).

1

Share this post


Link to post
Share on other sites

Yes, I'm using system like a stack for computing world matrices.

No, I don't have a specific post (just if you look at it, if it is readable or you must read a lot to understand what I mean)

Probably my last question is: Where is a good place to attach scene node to the Actor?

Edited by Xperience
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0