15

The Concept Fundamentally, a scene graph is nothing more than a bi-directed acyclic graph which serves to represent a hierarchically-structured set of spatial relationships. Engines in the wild tend to include other goodies into the scene graph, as noted. Whether you see that as the meat or the cow probably depends on your experience with engines and ...


13

It's mainly used for frustum/occlusion culling and minimizing the collision checks between the objects. Not true. It's mainly used for programming convenience and hierarchial animation. There is no way culling and collision checks benefit from scene graphs. Quite the opposite, actually, since it's required to calculate and cache the world space data before ...


12

It's possible to make your shader system more data-driven, so that you don't have so much shader-specific code laying around for uniforms and vertex formats, but rather set them programmatically based on metadata attached to the shaders. First the disclaimer: a data-driven system can make it easier to add new shaders, but on the other hand it comes with ...


8

Neither is needed. The choice of scene graphs or spatial partitioning or both is a matter of optimisation. And until you have a functioning game, you have nothing to optimise. So obsessing over this sort of detail now is counter-productive to the creation of your game. My advice: make the game, then measure which bits of it are slow, and finally fix ...


8

You can easily have coordinates going into the millions on units with an int. You can go all the way up to 2,147,483,647 units in the positive or negative direction. Procedurally generated worlds are not actually infinite. They're just very very big. If you think that 2 billion isn't enough, use a long to store your chunk coordinates, then you can go up to 9....


7

I tend to disagree with Trevor Powell's answer as there are clearly two different kinds of optimization here. One is optimization after the fact and to make the slow parts go fast, which is what he has touched on, but the other is designing your data structures and flow control to be at least reasonably efficient and sensible in the first place. The second ...


6

Yes, Transform component has Parent Transform. http://docs.unity3d.com/Documentation/ScriptReference/Transform-parent.html


5

You compile your shaders and bind them into programs. You can use the same VBOs again and again but with different uniforms or even programs, in the same frame, without problems. For each program, your calls to glGetAttribLocation will return -1 if that attribute is not in the program, or has been optimised-out (e.g. you declare it but don't use it). ...


4

Most levels in 3D platformer games are built on a 3D grid. The old Tomb Raider games are very obvious about this. (Press forward and the character moves one square every time, you know you can jump 3 squares if you are running but only 2 if you are standing, etc.) Even more recent examples, such as Darksiders 2 follow the same idea. The character has a ...


4

What is a scene graph? A scene graph as used in videogames is defined as a tree of nodes, where each node has 1 parent or no parent. The node without a parent is called the root node, because it defines the start of the tree. Each node can also have 0 or more children. What are they used for? Suppose you have a game where tanks are driving over terrain, ...


4

Deep within the game engine your mesh is defined by your vertices, your indices (which define how to draw the triangles using the vertices), and its material (which consists of the shader as well as other parameters). Submeshes allow you to define separate lists of indices and materials (depending on the engine) over the same vertex data which is useful not ...


4

Before addressing the specifics of your question, I do want to point out that I disagree with your approach to your inheritance model. A Game generally does not implement a Scene but instead a Game consists of one or more active Scenes that are being rendered and updated in a main loop. It's important to think about whether a class relationship can be ...


4

why not create a list of enemies in the level so the draw becomes: List<GenericEnemy> enemies;//filled during construction Render(){ //Render elements common to all levels draw(background); draw(playerSprite); for(GenericEnemy enemy : enemies) { draw(enemy); } } where GenericEnemy is a superclass of all enemy types,...


3

It's a little confusing as Unity conflates the organization of scene items with its transform hierarchy. There's no way to bucket or organization items without parenting them to another object. The best bet you will have is to make empty "folder" objects that have no components and no state but simply serve to be a named collection of objects. These folder ...


3

So firstly, I'd like to apologize if my question was poorly worded or if it was just confusing in general. I think I've figured out the proper solution now. It took a while because I had passed it off earlier after trying it and not immediately seeing desired results (I needed to basically remake my wooden manikin object from scratch). Basically, I found ...


3

In most game engines today the typical design is that a scene is a graph / tree of components some of which may be renderable. In a sense you are correct, every object is basically a node in a tree of things. You may have heard the expression "Entity Component System" and the expression "Component Composition" in relation to game engines and more ...


2

You might not need an anchor point in each node. When you make the 3D model, you can place it so that the origin is at the anchor point. For example, if you're making a human model, and you want the anchor point to be between the feet, then just make sure the origin is between the feet when you export from Blender, or whatever you are using. If you do want ...


2

Scene graph organization is guided by the various consumers of the scene - see answer to "Scene Graph as Object Container?" Fundamentally, the scene graph associates objects such that they share some logic, physics, position, and/or render state. So concerning organization-by-type, except for very simple games it would be a mistake to treat the scene graph ...


2

I would say think about what implication your organization have. E.g. the stow: If it where a top down game you would put the stow under the floor since if you go into the house you would like to make the ceiling invisible by making that node deactivated. If you would have put the stow under ceiling the stow would be goon to and that is not what you want. ...


2

Answering my own question: Looking at Actor's code, it seems to be as simple as overriding the default hit() method. The original code is: public Actor hit (float x, float y, boolean touchable) { if (touchable && this.touchable != Touchable.enabled) return null; return x >= 0 && x < width && y >= 0 && y <...


2

You're confusing Entity Heirarchy with Scene Heirarchy from what I can tell. It Works something like like this: class Scene { Collection<Entity> Objects; } class Entity { Collection<Entity> Objects; } class Bullet : Entity { } class Aircraft : Entity { void Shoot() { Objects.Add(new Bullet()) } } then in game code .......


2

After re-reading your question, I strongly feel you are overcomplicating the problem. Here's why: There are only really two types of rendering system: Forward, and Deferred, none of which are dependant on a scene graph. The only performance issues you should really get with any rendering system, should come from high poly count, and inefficient shader and ...


1

Submitting my earlier comment as an answer: So you are doing rasterization manually, without the use of a graphics library. If that's the case, you can emulate the depth buffer yourself. In addition to the color buffer, also store a z value in a separate image. Only write to the color buffer if the incoming z-value is less than or equal to the current z-...


1

Not everything can be represented as a tree... You're conflating "adjacency" with "hierarchy". Both may be useful concepts, depending what you're doing with your world. (Also, just to mention, there's no "right way" to do it, it just depends on your needs.) Hierarchy in your tree is probably useful for moving things around. For example, parenting the pen ...


1

You probably don't need to worry about the edge concept explicitly, in scene graphs. Any time that a parent object in the scene graph holds a reference to one or more children, that reference (pointer) is itself the connection that would be termed an "edge". It it is likely that the child also holds a reference back to the parent. These are just pointers. ...


1

To test culling, you probably want to render to another target without the culling to see if your culling strategy is working as intended. Second, rather than putting the visible objects into a collection, instead have a flag on each objects on whether or not they are visible. When drawing, skip objects with the flag set to false. Assuming your view ...


1

I wouldn't expect significant performance disadvantages to using a ConcurrentDictionary in your case, but as with anything concurrent I'd recommend tests/profiling. Also, I haven't the foggiest idea what the big engines are using. Sorry. That said, let's check your 4 uses against the information here: http://arbel.net/2013/02/03/best-practices-for-using-...


1

Typically, your scene graph in an ECS (there's a lot of variations, but this is my take on it.) can be represented in a couple ways. The most popular way of doing this sort of thing and easiest is simply a list of 'Entities' that are attached. These Entities might have children/parents, they might not. It depends how you choose to model things. In the most ...


1

First, of all I smell that you are going to use your scene graph for frustum culling and other operations not meant to be a scene graph operations. Please Don't. Using scene graph for things other than propagating data like transformations and some other properties, is counter intuitive. If frustum culling needs info derived from the scene graph Doesn't ...


Only top voted, non community-wiki answers of a minimum length are eligible