is it possible to add shader effects on widgets?

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

Cloudage
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Thu May 28, 2009 11:37

is it possible to add shader effects on widgets?

Postby Cloudage » Thu May 28, 2009 12:00

i want to make text drop shadows, and make window background half transparent like a ground glass.if we have a interface to set pixshaders with these widgets,these effects will be possible.

minutes ago i`m digging OgreCeguiRenderer, and i found every thing in CEGUI only means quads and textures to renderer,i have no idea to decide which one is character which one is window which one should be shade,it seems renderers can not obtain too many infos from cegui,may be there`s nothing to deal with the renderer.

so do we already have such a interface,or some otherway to do the same things,in CEGUI?

any help plz.
Last edited by Cloudage on Fri May 29, 2009 04:01, edited 1 time in total.

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: is it possible to add shader effects on widgets?

Postby Jamarr » Thu May 28, 2009 20:09

I don't think there is an easy answer to this question; if there is, I am unaware of it. As you've figured out the renderer does not hold any contextual information as to what is being rendered when. Additionally, CEGUI uses a delayed rendering scheme so even if you activated the shaders in the windows draw methods it would have no effect as the window is not actually rendered at that time. This thread gives a basic breakdown of the rendering process in v0.6 (i think).

The rendering system is being re-written for v0.7, but unfortunately I do not think this type of support is being added. I am not sure why CEGUI does not, and is not planning on, supporting a callback/event-based (or any other) mechanism providing users with custom rendering capabilities. Maybe there just has not been enough demand for it. Perhaps CE will comment on this? (hint hint)

I know that other people have done drop-shadows on text as in this thread, and you can easily make windows transparent by setting their Alpha property. Another option may be to first render the effect to a texture, and then use that texture in a CEGUI::Imageset which is then used to texture the window. Other than that I am not really sure...
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

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

Re: is it possible to add shader effects on widgets?

Postby CrazyEddie » Thu May 28, 2009 20:48

Just to confirm, there is currently (0.6.x) no way to reliably use shaders for any effects when rendering.

Jamarr wrote:The rendering system is being re-written for v0.7, but unfortunately I do not think this type of support is being added. I am not sure why CEGUI does not, and is not planning on, supporting a callback/event-based (or any other) mechanism providing users with custom rendering capabilities. Maybe there just has not been enough demand for it. Perhaps CE will comment on this? (hint hint)

It is my intention that there will be some level of support for shaders in 0.7 - I have yet to play around with this area before I can determine exactly what form this will ultimately take. Perhaps, depending how things go, it might be possible to demonstrate a few existing possibilities shortly (I might have a go tomorrow / over the weekend, though obviously, if it all falls on it's arse, demonstrations may not be possible :lol:)

CE.

Cloudage
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Thu May 28, 2009 11:37

Re: is it possible to add shader effects on widgets?

Postby Cloudage » Fri May 29, 2009 03:56

CrazyEddie wrote:Just to confirm, there is currently (0.6.x) no way to reliably use shaders for any effects when rendering.

Jamarr wrote:The rendering system is being re-written for v0.7, but unfortunately I do not think this type of support is being added. I am not sure why CEGUI does not, and is not planning on, supporting a callback/event-based (or any other) mechanism providing users with custom rendering capabilities. Maybe there just has not been enough demand for it. Perhaps CE will comment on this? (hint hint)

It is my intention that there will be some level of support for shaders in 0.7 - I have yet to play around with this area before I can determine exactly what form this will ultimately take. Perhaps, depending how things go, it might be possible to demonstrate a few existing possibilities shortly (I might have a go tomorrow / over the weekend, though obviously, if it all falls on it's arse, demonstrations may not be possible :lol:)

CE.


it`s good news for me.thank you ce.
and also thanks jamarr,may be i can use their tricks to fake text shadows until we can have a real shader interface.

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

Re: is it possible to add shader effects on widgets?

Postby CrazyEddie » Sat May 30, 2009 08:13

I know it's probably obvious, but I wanted to clarify that in this post where I mention the 'current code' and in my earlier post when I said 'existing possibilities' those are referring to the svn trunk code, and not any 0.6.x (or earlier) release.

I played about yesterday with some shaders via the CEGUI::Effect interface. So far this has been using OpenGL only, since that's the API that I use as the baseline / reference for working on the rendering related parts of the system. The experiments I have done so far have allowed me to establish some basic facts about the current situation.
1) There are already some pretty cool shader based effects and animations possible using this interface.
2) There are some definite limitations. Some areas here can and should be improved.
3) I have much to learn when it comes to shaders!

Obviously here, number 2 - the limitations - are of most interest. These limitations boil down to two main issues:
1) The rendering from an unmodified and unextended CEGUI that can be affected by shaders is currently at the level which has the CEGUI::Effect system applied. This means that to affect a window/widget rendered using the stock Window and stock WindowRenderer types it must be promoted to having it's own render surface backing (texture) - this is not a massive issue, since it's just a property setting to get that support. I did not yet see if there would be an appropriate way to hook into the rendering process elsewhere (obviously it's possible, but it has to be appropriate).
2) We currently only have support for a single rendering pass (this is not a shader specific limitation). This is something that definitely can and will be addressed, since I believe that many of the more advanced effects need >1 pass (I could be wrong; as mentioned, I'm no expert).

I'll be doing some more experimentation and making modifications where I feel it's appropriate :)

CE.

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

Re: is it possible to add shader effects on widgets?

Postby CrazyEddie » Sat May 30, 2009 19:57

I made a video that shows a window with a shader based effect running. It's kind of crappy, but it show the very basic building blocks are in place. I hope to perhaps demonstrate something a bit more advanced sometime soon :)



CE.

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

Re: is it possible to add shader effects on widgets?

Postby CrazyEddie » Sun May 31, 2009 19:36

And to follow up, once more - here's a video showing a glass-like effect:


I hope the video shows the effect clear enough for others to make out :)

CE.

LennyH
Quite a regular
Quite a regular
Posts: 92
Joined: Thu Nov 30, 2006 20:50

Re: is it possible to add shader effects on widgets?

Postby LennyH » Mon Jun 01, 2009 16:03

The wave effect is kinda silly, but it demonstrates your point. The glass effect, however, is pretty cool. Good job :)

earthsruler
Quite a regular
Quite a regular
Posts: 74
Joined: Mon Apr 28, 2008 23:21
Location: Australia

Re: is it possible to add shader effects on widgets?

Postby earthsruler » Thu Jun 04, 2009 00:00

Great work man.

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

Re: is it possible to add shader effects on widgets?

Postby CrazyEddie » Sun Jun 07, 2009 16:07

Thanks for the comments. Yeah, the wave is a little lame and useless - at least on a frame window, though could be useful if applied (more subtly) to a button, perhaps as a hover / mouse-over effect ;)

CE.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 13 guests