Windows with transparent background & underlying windows

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

nebukadnezzar
Just popping in
Just popping in
Posts: 7
Joined: Sun Jul 09, 2006 10:42
Contact:

Windows with transparent background & underlying windows

Postby nebukadnezzar » Tue Jul 11, 2006 13:15

I created some windows with transparent Backgrounds.
With an image from an .png which is at 75% alpha.

Now every window is rendered fine, but when a windows is on top of the other, the underlying window is shining through, but i don't want that.

I wan't that the parts covered by the top window are not rendered and only my window-background (from ogre) is shining through.
(like it is in Half-Life 2 or Dod:S or CS:S)

Is this possible?
and if yes... how?

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Wed Jul 12, 2006 08:29

Hi,

i don't get this part: "I want that the parts covered by the top window are not rendered and only my window-background (from ogre) is shining through."

Can you post a screenshot of what you mean? Or photoshop such situation?

A suggestion (although i don't understand the question):
-There is an "InheritsAlpha" property for parent/chield relations when using alpha.

Thanks and good luck!

nebukadnezzar
Just popping in
Just popping in
Posts: 7
Joined: Sun Jul 09, 2006 10:42
Contact:

Postby nebukadnezzar » Wed Jul 12, 2006 08:54

I'm sorry for my bad English....

Here is a good example:

Image

You can see the background through the top-most window.
but you can't see the parts of the underlying windows.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Wed Jul 12, 2006 10:57

I can see the effect you're after, and there's no easy setting to get it done. I think the 'Background' there is actually rendered last.

I think to get a similar effect you need to use a StaticImage or what have you which is rendered over the top of all other windows (i.e. set it as always on top) with say 20% or 30% alpha (i.e. the inverse of what you would use if it was the windows that had the alpha setting) . You must set the appropriate modes to enable inputs to 'pass through' this top-most window to the underlying widgets - either set the StaticImage as disabled (for <=0.4.x), or use the "MousePassThroughEnabled" setting (for >=0.5.x).

Let us know if this works!

CE

nebukadnezzar
Just popping in
Just popping in
Posts: 7
Joined: Sun Jul 09, 2006 10:42
Contact:

Postby nebukadnezzar » Wed Jul 12, 2006 11:21

yes the background is rendered...

hmm isn't it possible to tell/modify the OGRECeGUIRenderer to not draw the pixel from the underlying window that are covered?
it should have a similar effect or not?

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Wed Jul 12, 2006 15:28

this could be done but would require "major" changes to the Renderer.

Enable depthbuffer testing/writing and draw in reverse order (front -> back)

Something like that could do it I think, I'm not really up for trying though (at least not now)

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Fri Jul 14, 2006 11:56

Hello,

I hacked around the OpenGL renderer a bit and added a configurable option to enable and disable Z buffer testing (and also switch the direction of the sort for the quads) at will. The changes are actually not too bad, just a few lines; we might want to consider adding this in as an option on some of the renderers - we also get a small performance boost out of it too when running in z-test enabled mode ;)

(Historical Note: The original version of CEGUI did not support alpha blending between GUI elements at all, and relied on using the z-buffer and front to back drawing order).

I did not try this on the Ogre3D renderer as yet, since I have not got everything set-up on here again yet, but having done it on the GL renderer - as a kind of proof of concept - I can say that you should end up with a very similar effect to what you desire, so long as the underlying imagery that you do want to be blended is rendered to the screen before any gui stuff (don't forget to clear the z buffer after drawing your scene and prior to rendering the UI ;) ).

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 10 guests