Sign in to follow this  
Wavesonics

Alpha Blending & Scene Graph node order

Recommended Posts

Wavesonics    330
So I have a node at the top of my scene graph that has both 2D (HUD) elements that require alpha blending, and 3D geometry data as childeren. The problem is though, that the order of the 2D and 3D elements in the child list matters. If the 2D elements draw first, then the alpha blended areas are just black. So the 3D must draw first. So any sugestions? Of course I could sort the list but this is costly and would require some changes so I could more easily differentiate between 2D and 3D elements. Is there something in OpenGL that could help me here?

Share this post


Link to post
Share on other sites
LorenzoGatti    4442
Putting the HUD in the same scene graph as the 3D scene behind it doesn't seem particularly useful: they are very different things and the benefits of a scene graph architecture apply mostly to 3D scenes, not to 2D widgets.
If sorting the two heads of this scene graph chimera is difficult (why?), you could render the HUD by itself in a successive pass; the GUI can be a second scene graph, with modest changes from the current organization.
What libraries are you using? They seem to seriously impair your design freedom.

Share this post


Link to post
Share on other sites
Wavesonics    330
I'm writing my own Engine from scratch. And the Scene Graph does need quite a bit more work, but the idea with this was, the HUD is only shown when the 3D "User" (aka camera) is attached to the scene graph, so the HUD elements would be attached to the User node. So when it was detached the HUD would go with it with out any extra work.

Then you could attach something else, like some GUI widgets for a 2D interface.

Now right now one thing I dont really like is my "User/Camera" node is the root node, because I want the User's translation & rotation nodes to affect everything that is drawn obviously.

But really, logically, the "user" should be attached to the geometric node they are in spatially speaking. Not the other way around as it is now.

How is this usually handled in Scene Graphs? So the camera's translations/rotations affect everything?

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