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
3D Objects on top of overlay
-
- Gnoblar
- Posts: 15
- Joined: Wed Oct 09, 2002 12:13 am
- Location: My backporch, Minnesota
-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
-
- Gnoblar
- Posts: 15
- Joined: Wed Oct 09, 2002 12:13 am
- Location: My backporch, Minnesota
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
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