3D Objects on top of overlay

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply

This question is

Poll ended at Fri Aug 27, 2004 3:57 pm

Intriguing. I'd like to know more!
5
100%
Stupid. This guy needs to get a clue.
0
No votes
 
Total votes: 5

janders
Gnoblar
Posts: 15
Joined: Wed Oct 09, 2002 12:13 am
Location: My backporch, Minnesota

3D Objects on top of overlay

Post by janders » Thu Aug 26, 2004 3:57 pm

I'm building an inventory system that uses actual 3D entities to represent the inventoried items. To do this, I use 2 overlays,
one that defines the inventory decorations and container slots for items, and another that is rendered on top of the first, that contains only 3D scene nodes, scaled and translated to fit the appropriate container slots. The problem is that no matter how I order the overlays' zbuffer values, the 3D objects are always rendered behind the 2D overlay elements. This is fine when the inventory slot containers are completely transparent, but I'd like to use textures as backgrounds for the slots.

Is there a way to manipulate the overlays so the 3D objects are displayed on top, or do I need to define both overlays in 3D to get the ordering that I want?

Jon
0 x

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19263
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 2
Contact:

Post by sinbad » Thu Aug 26, 2004 5:19 pm

Your 3d objects will need to have depth checking disabled in order to appear on top of the overlays, I'm sure I documented this somewhere... :/ That's because as far as the depth buffer is concerned they can't possibly be in front otherwise.
0 x

janders
Gnoblar
Posts: 15
Joined: Wed Oct 09, 2002 12:13 am
Location: My backporch, Minnesota

Post by janders » Thu Aug 26, 2004 8:36 pm

Well, did some more thinking, and here it is:

The 3D elements are in a different overlay than the 2D elements, and the 3D element overlay has a higher ZOrder than the 2D overlay, so it should get rendered after the 2D one, correct?

The 2d overlay elements are rendered without depth checking to ensure they are on top, so the Z coordinate of the actual geometry they are rendered as is irrelevant for them. If they used the maximum Z value [1], rather than the minimum [-1] that they do now, they would still get rendered correctly, but would have the side effect of litterally clearing the depth buffer in those areas where they are rendered. Then, any overlay with 3D objects on top of those areas could be rendered afterward with depth_check enabled, and they wouldn't have to worry about overlapping, or being convex. And I'd have my cake and could eat it to. :)

Haven't had a chance to try it, but if it works, would you like a patch?

Jon
0 x

Post Reply