Page 1 of 1

Using CEGUI as GUI in 3D [Solved, with images]

Posted: Mon Jan 15, 2007 14:19
by tx

First of all ive used CEGUI once briefly in a former project, but I don't have much indept knowledge about the limitations of CEGUI.

My new project is going to use a gui api on screen inside the 3d world. There is going to be several screens running at the same time.

What I was thinking about was if I could change the rendering target of CEGUI to a texture and then place it on the quad in 3d space. Then I would have to translate the 3d picking into the texture space of the quad. And connect all input through that.

My question is, would this be possible? First of all changing rendering surface to a texture, and then have several layouts and instances of the gui active.

Would I be better of writing my own stuff? Or maybe even change some in CEGUI's code?

I tried to search for something similiar, but couldn't find anything. But then again im a crappy searcher. :lol:

Posted: Mon Jan 15, 2007 17:38
by Rackle
Are you saying that you want to render the GUI in 3D, such as on one face of a cube that can rotate?

The "traditional" approach to a GUI is to draw it on top of the 3D world, always facing the camera.

>> There is going to be several screens running at the same time

Do you mean split screens? You can have multiple dialogs (Cegui::FrameWindow) active at once. What you would need to do is prevent each from leaving its region. One easy solution would be to create a fullscreen Cegui::Sheet having one Cegui::DefaultWindow per split.

For example, a 4x4 grid layout:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>

<GUILayout >
    <Window Type="DefaultWindow" Name="Grid_4x4" >
        <Property Name="InheritsAlpha" Value="False" />
        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
        <Window Type="DefaultWindow" Name="Grid_4x4/Cell_1x1" >
            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
            <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0.5,0},{0.5,0}}" />
        <Window Type="DefaultWindow" Name="Grid_4x4/Cell_1x2" >
            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
            <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0,0},{1,0},{0.5,0}}" />
        <Window Type="DefaultWindow" Name="Grid_4x4/Cell_2x1" >
            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
            <Property Name="UnifiedAreaRect" Value="{{0,0},{0.5,0},{0.5,0},{1,0}}" />
        <Window Type="DefaultWindow" Name="Grid_4x4/Cell_2x2" >
            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
            <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0.5,0},{1,0},{1,0}}" />

You would then add dialogs to one of the cells, such as "Grid_4x4/Cell_2x2" for the cell in the lower right. This dialog would be clipped by its parent, preventing it from appearing in a different cell.

Is this making sense or am I off the mark?

Posted: Mon Jan 15, 2007 19:24
by tx
I don't want to render it on top of everything else. I want to render it to a texture then apply it to a side of a box for example. I might be able to render it first then take the backbuffer and copy it to a texture then clear the backbuffer and render the world. But im not sure thats very effecient.

Posted: Mon Jan 15, 2007 20:52
by Rackle
That approach is beyond my knowledge. Maybe the answer lies in the renderer code (DirectX9GUIRenderer.cpp for example).

Posted: Mon Jan 15, 2007 22:05
by tx
Good idea, ill try checking it out.

Posted: Thu Jan 18, 2007 01:59
by tx
So here is the first results, so far ive been able to render it onto a texture. Next step is to get more surfaces to add windows too.


Posted: Thu Jan 18, 2007 16:10
by tx
Progress, it's now possible to run multiple windows, each "screen" capturing a window and it's children.

But only one window can have input focus.

But as the left is parent to the right moving the smallest window on left will move the small window in the right.

Pressing right mouse button will swap input focus from left to right or the opposite.


Posted: Thu Jan 18, 2007 17:16
by Rackle
Please consider creating a Wiki for this. It's quite an effect.

Posted: Thu Jan 18, 2007 18:24
by tx
Rackle wrote:Please consider creating a Wiki for this. It's quite an effect.

Sure I will consider that but im going to do some more testing first, so I can get the most efficient solution.

Posted: Wed Jan 24, 2007 01:16
by Pompei2
This looks like great work ! a few users already asked for this but never did it. nice. I look forward for the wiki ;)

Posted: Thu Jan 25, 2007 08:42
by Taharez
Coolness :) Definatly a nice effect, I too think it's one for the wiki. Any chance for more details on the project you're using this for?

Posted: Mon Jan 29, 2007 01:44
by tx
Taharez wrote:Coolness :) Definatly a nice effect, I too think it's one for the wiki. Any chance for more details on the project you're using this for?

Well yeah, im going to use it for a game im making. The "game" is a spaceship exploring the internet. At the bridge of the spaceship there will be different terminals containing scripted programs. Looking alot like Star Trek.

At the end the user will be able to to develop their own programs, spaceships and game scripts..

There will be more information on soon :lol:

Hard to describe this project in such few words..

Posted: Mon Jan 29, 2007 15:38
by Taharez
Sounds like a very original concept :)

Posted: Fri Mar 02, 2007 05:50
by cybereality
Nice screenshots, looking good man. I remember how impressed I was the first time I played DOOM3 and saw a working 3d GUI. It s cool to see that CEGUI can be used for this type of effect.