# scene graphs?

This topic is 4875 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have just learned about scene graphs and was wondering if anyone could go through the basics of using this in directx. The article i read explain what they are and that they can be used but didn't explain how to. So i was wondering if anyone could help me out with that. Thanks in advance for any advice. Zwigby

##### Share on other sites
What article did you read this from? It would be helpful to know where you are at in your knowledge of scene graphs.

##### Share on other sites

http://www.realityprime.com/scenegraph.php

Zwigby

##### Share on other sites
Looks like a good article to me, but you're right - it doesn't show you how. Presumably this is because it wanted to remain implementation neutral and just present some theory.

The concepts do map quite easily though, so if you've got your head around that article you're probably not as far away as you might think [smile]

To what level are you using Direct3D? and to quite what end do you want to use your scenegraph?

There are slightly different angles you can take, and varying levels of complexity. For example, you might only want to use it for a combination of culling and collision detection. You could also use it to minimize only the number of SetTexture(), SetStreamSource() and SetIndices() - a simple rendering pipeline. At the other end you could use a complex scene graph to do all of what I mentioned AND provide an insanely efficient state and effect management system (e.g. shaders and multi-pass effects)..

hth
Jack

##### Share on other sites
well right now i just want to use the concept for rendering a tank with three pieces and being able to keep independent rotations with repect to the tank base. I feel this is a simple degree of scene graph. I am reletively new directx but am learning quickly.

note - your f1 game project looks pretty sweet.

##### Share on other sites
well right now i just want to use the concept for rendering a tank with three pieces and being able to keep independent rotations with repect to the tank base. I feel this is a simple degree of scene graph. I am reletively new directx but am learning quickly.

note - your f1 game project looks pretty sweet.

##### Share on other sites
I've read that article, and it is indeed very well written. Most interesting I think was the discussion on future scene graphs, and I completely agree that the "multi-view" graph is the way to go (in fact, I'm designing and implementing one right now :).

That said all of the concepts that they talk about are language-neutral, and API-neutral. Most of the scene graph stuff that you deal with will be totally independent of DirectX... only at the very lowest level (objects in the "soup") will you potentially use DirectX/OpenGL to create/store geometry buffers, etc. Even then, it's very easy to abstract out the idea of a "buffer" and remain cross-platform and API-independent.

More to the point though, what you're trying to do is probably best represented by a "transform heirarchy", where each node represents a transformation (relative to its parent coordinate frame - ie. multiplying world matrices as you traverse down the tree). The leaves in this heirarchy would be links to the object instances (in the "soup"), as they are in any of the other "views" of the scene.

To be even more concrete, you probably want to create a tree structure where each node has a local transformation matrix (or quaternion, or whatever you want to use to specify transformations). Then to find the world matrix of a specific leaf, you can traverse up (or down) the heirarchy from the leaf to the root, multiplying the local transformation matrices of each node that you traverse. (You can cache these computations at each node for efficiency, but get the basic system working first :).

I hope that helps somewhat... feel free to ask more specific questions and I'll see what I can answer.

##### Share on other sites
Quote:
 Original post by jollyjeffersYou could also use it to minimize only the number of SetTexture(), SetStreamSource() and SetIndices() - a simple rendering pipeline.

This is the approach that I use. Basically, some kind of culling routine delivers the set of visible objects to the scenegraph. The scenegraph then categorizes each object based on its material - its shader, texture set, and constant set. For example:

                     Shader1                            Shader2               |--------|--------|                 |--------|--------|           TextureSet1      TextureSet2       TextureSet3        TextureSet4       |--------|--------|      ...               ...               ...   ConstantSet1      ConstantSet2       |                 |     Entity1          Entity5     Entity2          Entity6     Entity3     Entity4

##### Share on other sites
Quote:
 Original post by circlesoftBasically, some kind of culling routine delivers the set of visible objects to the scenegraph. The scenegraph then categorizes each object based on its material - its shader, texture set, and constant set.

Incidentally some sort of "state" view is a perfect example of another possible heirarchy in the multi-view scene graph. It makes a lot of sense to position it "after" the spatial view which handles the culling as you describe. Organizing it as just another view in the scene graph allows generalized traversers, etc.

##### Share on other sites
This method works well for me and my purposes, now only if i could get my math right.

Zwig

1. 1
Rutin
37
2. 2
3. 3
4. 4
5. 5

• 12
• 10
• 13
• 104
• 11
• ### Forum Statistics

• Total Topics
632980
• Total Posts
3009684
• ### Who's Online (See full list)

There are no registered users currently online

×