Hi,
I'm doing a GUI for an application with lots of semi-transparent "glass" elements. Now someone suggested that I should try to blur the background under the transparent windows, like the Aero theme for Vista does.
But I don't know where to start with this, or at which part of CEGui this could be implemented.
Do you think that it is possible? And where would you start with this?
Blurred background for glass style
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Hi, and welcome
I think this is possible for CEGUI to do this, though it's potentially a large change. I know the scope of the changes to get such effects into CEGUI since I'm already working on a rendering system rewrite that will make this kind of thing very simple (demos of such things will be included once the support is in).
I think there is no trivial change to get this support in such that the core of CEGUI supports it, though I guess there is some potential if you were to render to a texture and go off and do your own thing with that content afterwards, though this would need you to add some direct support for rendering separate parts to texture - I think without this, the system - in it's current state - is not geared towards these kinds of effects.
So, I'm not saying it can't be done, because I'm already working on such things, hehe What I will say is that it's potentially a large and complex set of changes, and unless you're absolutely desperate, you might want to wait and see what I come up with. The only down side to that is that I can't give you an ETA (these mods are already six months overdue, though in that time the scope of the mods have been expanded considerably).
CE.
I think this is possible for CEGUI to do this, though it's potentially a large change. I know the scope of the changes to get such effects into CEGUI since I'm already working on a rendering system rewrite that will make this kind of thing very simple (demos of such things will be included once the support is in).
I think there is no trivial change to get this support in such that the core of CEGUI supports it, though I guess there is some potential if you were to render to a texture and go off and do your own thing with that content afterwards, though this would need you to add some direct support for rendering separate parts to texture - I think without this, the system - in it's current state - is not geared towards these kinds of effects.
So, I'm not saying it can't be done, because I'm already working on such things, hehe What I will say is that it's potentially a large and complex set of changes, and unless you're absolutely desperate, you might want to wait and see what I come up with. The only down side to that is that I can't give you an ETA (these mods are already six months overdue, though in that time the scope of the mods have been expanded considerably).
CE.
Re: Blurred background for glass style
Hello,
It has been a while now since this has been requested, and I'm hoping the feature made it into CEGUI. Now, I'm trying to achieve the very same thing that was previously discussed in this thread, blurred background for glass style.
My approach is to render a material to the CEGUI window:
Now, 'material' is an Ogre::MaterialPtr ("Ogre/Compositor/GlassPass" to be more precise). The error I get on compile is : 'CEGUI::Texture &CEGUI::Renderer::createTexture(const CEGUI::Size &)' : cannot convert parameter 1 from 'Ogre::TexturePtr' to 'const CEGUI::Size &'
1> Reason: cannot convert from 'Ogre::TexturePtr' to 'const CEGUI::Size'
Now, I took the code from somewhere on the web, and I reckon it is outdated, the Renderer::createTexture method no longer takes an Ogre::TexturePtr.
Perhaps this isn't even what I need to do to get a glass like effect on a CEGUI window, and I'm understanding this all wrong.
Is rendering an Ogre material on a CEGUI window what I really need to achieve the effect?
Thanks in advance.
It has been a while now since this has been requested, and I'm hoping the feature made it into CEGUI. Now, I'm trying to achieve the very same thing that was previously discussed in this thread, blurred background for glass style.
My approach is to render a material to the CEGUI window:
Code: Select all
CEGUI::Texture* texture = CEGUI::System::getSingleton().getRenderer()->
->createTexture((Ogre::TexturePtr)Ogre::TextureManager::getSingleton()
.getByHandle(material->getHandle()));
Now, 'material' is an Ogre::MaterialPtr ("Ogre/Compositor/GlassPass" to be more precise). The error I get on compile is : 'CEGUI::Texture &CEGUI::Renderer::createTexture(const CEGUI::Size &)' : cannot convert parameter 1 from 'Ogre::TexturePtr' to 'const CEGUI::Size &'
1> Reason: cannot convert from 'Ogre::TexturePtr' to 'const CEGUI::Size'
Now, I took the code from somewhere on the web, and I reckon it is outdated, the Renderer::createTexture method no longer takes an Ogre::TexturePtr.
Perhaps this isn't even what I need to do to get a glass like effect on a CEGUI window, and I'm understanding this all wrong.
Is rendering an Ogre material on a CEGUI window what I really need to achieve the effect?
Thanks in advance.
Re: Blurred background for glass style
Ok, that was silly. How was a generic renderer interface like CEGUI::Renderer supposed to know how to create a CEGUI texture from an Ogre texture. A static_cast from Renderer to OgreRenderer was required, since this renderer knows how to deal with Ogre stuff.
Still, am I on the right path with this?
Still, am I on the right path with this?
Re: Blurred background for glass style
Hello again.
Unfortunately it appears I've hit a snag. I can't get the glass material to render:
textureName comes out null. Surely this must be because the Glass.material does not have a texture defined, right? It is generated by the programs. Here's the .material file:
If i do Ogre::String textureName = material->getTechnique(0)->getPass(0)->getTextureUnitState(1)->getTextureName(); instead, sure, i get the texture for WaterNormal1.tga. But the StaticImage still comes out completely white.
Any help pretty please?
Unfortunately it appears I've hit a snag. I can't get the glass material to render:
Code: Select all
Ogre::MaterialManager & matMgr = Ogre::MaterialManager::getSingleton();
Ogre::MaterialPtr material = matMgr.getByName("Ogre/Compositor/GlassPass");
CEGUI::OgreRenderer & ogreRenderer =
static_cast<CEGUI::OgreRenderer &>(*CEGUI::System::getSingleton().getRenderer());
Ogre::String textureName = material->getTechnique(0)->getPass(0)->getTextureUnitState(1)->getTextureName();
Ogre::TexturePtr ptr = Ogre::TextureManager::getSingleton().getByName(textureName);
CEGUI::Texture & texture = ogreRenderer.createTexture(ptr);texture;
CEGUI::Imageset & rttImageSet =
CEGUI::ImagesetManager::getSingleton().create(
(CEGUI::utf8*)"RttImageset", texture);
//CEGUI::ImagesetManager::getSingleton();
rttImageSet.defineImage((CEGUI::utf8*)"RttImage",
CEGUI::Point(0.0f, 0.0f),
CEGUI::Size(texture.getSize().d_width, texture.getSize().d_height),
CEGUI::Point(0.0f,0.0f));
mStaticImage = (FrameWindow*)wmgr.createWindow( "TaharezLook/StaticImage", "myImage" );
mRootWindow->addChildWindow( mStaticImage );
CEGUI::Size winSize = mOptionsWindow->getPixelSize();
float ratio = winSize.d_width / winSize.d_height;
mStaticImage->setSize( UVector2( UDim( 0.5f, 0 ), UDim( 0.5f * ratio, 0 ) ) );
mStaticImage->setText( "Hello World!" );
mStaticImage->setProperty("Image",
CEGUI::PropertyHelper::imageToString(
&rttImageSet.getImage((CEGUI::utf8*)"RttImage")));
textureName comes out null. Surely this must be because the Glass.material does not have a texture defined, right? It is generated by the programs. Here's the .material file:
Code: Select all
fragment_program Ogre/Compositor/GlassFP cg
{
source GlassFP.cg
entry_point main_ps
profiles ps_2_0 arbfp1
}
material Ogre/Compositor/GlassPass
{
technique
{
pass
{
depth_check off
vertex_program_ref Ogre/Compositor/StdQuad_Cg_vp
{
}
fragment_program_ref Ogre/Compositor/GlassFP
{
}
texture_unit RT
{
tex_coord_set 0
tex_address_mode clamp
filtering linear linear linear
}
texture_unit
{
texture WaterNormal1.tga 2d
tex_coord_set 1
//tex_address_mode clamp
filtering linear linear linear
}
}
}
}
If i do Ogre::String textureName = material->getTechnique(0)->getPass(0)->getTextureUnitState(1)->getTextureName(); instead, sure, i get the texture for WaterNormal1.tga. But the StaticImage still comes out completely white.
Any help pretty please?
Re: Blurred background for glass style
Found out RenderEffect might be what I need.
Moved the discussion here, since this is more of a beginner's topic.
Moved the discussion here, since this is more of a beginner's topic.
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 16 guests