Doom3-alike GUI (embedded in 3D scene)

For a while now I’ve been trying to figure out a way to display functional DirectGUI in 3D. Or, more precisely, wondering if that’s possible. My intent was making something like Doom3’s GUI – a “virtual screen” embedded in the 3D world, with a cursor, buttons and so on.

Recently this idea came back to me, and after some experiments I managed to make it work. In fact, it was easier then I thought – all it requires is cloning the aspect2d. But I thought I’ll post it here anyway, in case someone is/was/will be trying to do the same.

To make it clear how it works – it doesn’t make DirectGUI objects directly “pickable”. It only renders the GUI to a texture and uses the standard MouseWatcher to make it functional. Still, that doesn’t make much difference. Combined with mouse look it can be configured to behave similarly to the Doom3’s screens (but not identically). On the other hand, this approach made it extremely flexible. Since it’s just a texture, you can do whatever you want with it – setups with multiple virtual monitors, the same GUI displayed in many places, projection or even wrapping it around complex objects. In all these cases it’ll still work and allow you to operate the GUI using the mouse and keyboard.

Additionally, using this code with any GUI you already have should only require reparenting.

Note, that MRelative mouse mode is currently not supported on Windows, so by default the demo starts in fullscreen there. Otherwise the mouse would escape the window and the virtual screen would stop working. This is possible to work around, but it would require the VirtualMouse, which would make the code twice it’s current length…

Anyway, hope someone will find it useful.

Nice work, I was inspired.

I just started working on a pygame project and to test out the pgu gui framework I decided to make something simmilar to what you did.

And with transparency enabled.