Jump to content
  • Advertisement
Sign in to follow this  
Zwigby

scene graphs?

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
here is a link to the article that i read

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

Zwigby

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by jollyjeffers
You 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 this post


Link to post
Share on other sites
Quote:
Original post by circlesoft
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.

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 this post


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

Zwig

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!