Live data from Hacker News

Could ImGUI Be the Future of GUIs?

games.greggman.com

61–70 of 128 posts

Re: Could ImGUI Be the Future of GUIs?

#61
post #6

It's important to point out why games use immediate mode GUIs: 1. The GUI needs to be overlaid on the game image (OpenGL/DirectX). This is difficult with traditional GUIs like QT. 2. The GUI needs to be updated in sync with the game, again, it's difficult to integrate traditional GUIs event loops into the game loop, especially with stuff like double/triple buffering. 3. The GUI needs to be as fast as possible, games…

Every game I've worked on didn't actually use an IMGUI for anything you'd ever show a player; (unless it's a style of game that really doesn't need much UI), it's just custom gui implementations. A lot of modern games actually put the UI in with the scene graph of the game itself (IE: Unity's new GUI system)

This is definitely the way to go, especially with the more recent trend of embedding UI elements in world space, and VR/AR essentially requiring it.

Internal tools tend to be IMGUI, Winforms, or WPF from what I've seen. Essentially whatever the original author is most productive in. No need to be super performant because your only users are other devs with really high end systems and rarely an actual need for a constant 30/60fps.

Your engine likely already has a graph structure, event system, and input handling. The core pieces of a retained mode UI system are already there.

Re: Could ImGUI Be the Future of GUIs?

#62

Really probably not. I love them and they're very handy in certain situations (debugging tools, quick UIs) but once you need a lot of customization they become extremely cumbersome. Also really kind of makes it impossible for designers or less technical people to do anything. Also, while I think separating view logic is slightly overrated, it is useful, and it's very hard to do that with IMGUI. Also it doesn't thread…

Specifically Unity would have been much better served using something like Electron. Unity's UI looks bad, feels bad, and is a huge pain in the ass if you're authoring extensions.

Whoa there.

Electron is a catastrophic of hog of resources and performance. Electron for mobile game UI would be a disaster!

Re: Could ImGUI Be the Future of GUIs?

#63
post #33

Earlier quoted context omitted.

I've written real-time game UIs too. I think you underestimate just how ludicrously fast CPUs and GPUs are, and overestimate the complexity of your average GUI. What does your average screen's-worth of GUI consist of, after all? How many widgets are there? I double dare you to tell me that a modern computer or games console can't handle 500 widgets per frame. And I now triple dare you to tell me that your UI designer…

I'm sure many games can get away very well with an immediate mode GUI. I think the question is not can you, but rather should you. My last project used a custom immediate-mode GUI. At the absolute pinnacle of optimization, it was pushing 2,000+ FPS on my machine with something like 3-4k vertices, with heavy texture mapping and anti-aliasing. But the problem was that even with peak optimization, the CPU was spending 1…

> The CPU was spending 15-20% of its time every frame recreating the UI's vertex buffer.

Not saying it is easy, but it's possible to optimize and cache vertex buffers by using something similar to React's VDOM.

Re: Could ImGUI Be the Future of GUIs?

#66
post #50

Here’s a downside that wasn’t mentioned: if (ImGUI::Button("Click Me")) { IWasClickedSoDoSomething(); } This forces Button to be stateless, which limits the possible quality of implementation. If you mouse-down on a button and the button changes before you mouse-up, it shouldn’t register as a click. Similarly, if you mouse-down on a button, drag to the button, and mouse-up, it shouldn’t be a click. Implementing this…

A naive implementation would have the problem you describe. However, a smarter library implementation avoids this (e.g., by generating an id for the button, saving the id on mouse-down, and checking the id on mouse-up). The user of such a library won't have to worry about it.

And how, exactly, is the id created? Some hash of the button’s text and coordinates?

I would call that a dirty hack, no to mention being implicitly stateful.

Re: Could ImGUI Be the Future of GUIs?

#67

The author does a good job explaining some benefits of an immediate mode renderer but vastly misses the disadvantages. The immediate mode renderer is great for toy programs. Similar to how you could reproduce 'look here is how simple it is to write hello world and compute the millionth digit of PI' in a new esoteric language... Occlusion, hit-testing, state changes, scrolling/animations even in the simplest forms wil…

> A retained mode renderer will use virtual scrollers, efficient culling of nodes for both display and hit-testing (scale to billions of virtual cells)

A good IMGUI will do this too (e.g. Dear IMGUI already does)

Re: Could ImGUI Be the Future of GUIs?

#68

Earlier quoted context omitted.

Specifically Unity would have been much better served using something like Electron. Unity's UI looks bad, feels bad, and is a huge pain in the ass if you're authoring extensions.

Whoa there. Electron is a catastrophic of hog of resources and performance. Electron for mobile game UI would be a disaster!

This is referring to Electron for the (PC-based) editor UI, not the deployed game UI.

(Plenty of criticisms of Electron still hold, of course.)

Re: Could ImGUI Be the Future of GUIs?

#69

Can we please just stop moving around in circles in the tech industry? Nobody seems to learn anything from past methods, tech and everything.

LOL. My favorite part of it was the last line:

"More research into ImGUI style UIs could lead to huge gains in productivity."

Don't tell this cat that the research on this stuff goes back >40 years and that the introductory chapter of any book on computer graphics would have talked about all of this. Not like it would help him - he hasn't read anything about it, didn't even do a cursory Google search. Sheesh. A low, low bar.

Re: Could ImGUI Be the Future of GUIs?

#70

Really probably not. I love them and they're very handy in certain situations (debugging tools, quick UIs) but once you need a lot of customization they become extremely cumbersome. Also really kind of makes it impossible for designers or less technical people to do anything. Also, while I think separating view logic is slightly overrated, it is useful, and it's very hard to do that with IMGUI. Also it doesn't thread…

Unity 2019.1 has a new retained mode GUI system for editor UI.
Post reply on HN