-
-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Evaluate options for core GUI #116
Comments
Looks like egui only has OpenGL backends? (glow and glium in the repo) iced supports wgpu, so you could avoid depending on GL. But to be honest I'm not a fan of the "core GUI" concept, my ideal dream structure is:
|
Hey @unrelentingtech, thank you for your comment!
I am pretty sure I saw a wgpu backend somewhere, but I don't remember where. My impression is that integrating egui into existing backends is a core feature. Depending on GL (or anything else that would somehow work in parallel with wgpu) would definitely be a non-starter. Thanks for reminding me of iced. I had forgotten about it, and I think in the past I got the wrong impression that it is not suited for this kind of use case. But judging from the feature list, integration with existing systems should be possible, so it's definitely a contender here.
I should clarify that this issue is meant to track an actionable task that can be implemented in the near term, and doesn't necessarily reflect the long-term vision. Just a change that makes sense right now. And right now I see the need for a platform-agnostic GUI that is available everywhere the renderer is. Something for implementing sliders to change model parameters, for example, that works regardless of whether you're creating a model on a Mac, or viewing a website that has a model embedded in it. Whether that concept will endure long-term, I don't know. It might, or it might turn out that authors of those various GUIs want more freedom, and the core GUI is in their way. We'll see. That dream structure you describe is definitely where things are going. Right now, everything is bundled up in a single host application, for the sake of developer convenience. But I absolutely do intend to split the project into reusable components. I want Fornjot to spawn an ecosystem of related tools. That reminds me, I should open an issue about splitting the project into smaller modules. This is definitely something that can happen in the near-term, as key components like the kernel and the graphics already sit in their own module trees and have clearly defined interfaces between each other. I'm just a bit worried about doing it before there's a need, as it's going to introduce some friction into the development process. |
As a follow-up to my previous comment here, I've opened an issue about splitting Fornjot into self-contained components (#141). |
[One more drive-by comment from me after seeing Fornjot on HN again. :)] My experience of
|
Thank you, @follower, this is very helpful!
This is fine by me. What we need is a practical solution for the current and upcoming problems. I think trying to choose the perfect GUI approach at this point is probably a fool's errand. Especially since it doesn't seem unlikely that long-term, things will develop along the lines outlined by @unrelentingtech in his comment above.
Seems like this is the main issue here, figuring out how to integrate egui and Fornjot in a way that works well, but doesn't bind our whole graphics architecture to egui.
Please stop resisting, I'd appreciate the help 😁 But seriously, this is a very important topic (lots of issues are blocked on this one), and for me to handle this would mean taking away time from other very important topics. Tackling the GUI question would certainly be a great way to help the project out, for anyone who's inclined to do so! |
My first post here, hi all. A while back I tinkered around with integrating egui with truck. Nothing really useful came out of that, but I learnt a lot about egui, CAD kernels and wgpu. I think over time people will integrate fornjot with all kind of GUIs. I started to look into building a Fornjot GUI with rui, which is very, very alpha but I like very much its approach (all GPU, SDF based, no CPU tessellation, but has currently no 3D backend). When I have something to show, I will post it here of course. But it is very specific thing, tailored to my personal interest, and not along the lines of what generally makes most sense, outlined by @unrelentingtech above. To facilitate external GUIs I think fj-app should be refactored into several modules. I also noticed that the current Fornjot GUI app is only for rendering one model. But for efficiently rendering multiple models, some optimizations at the rendering pipeline are needed, like pooling all models which have been scaled, translated, rotated from the same base model and then apply wgpu instances technique. Another thing to consider is the quality of the 3d rendering currently implemented in fj-app. Now it is simple and at this stage could probably be ported easily to a non-wgpu platform. But once proper materials are implemented, and Phong shading (or whatever makes more sense), I assume this project is really tied to wgpu (which is fine for me). Or is Fornjot not at ll about the rendering ? One last thing I think each 3d modeling Gui developer would like to approach differently is the camera. So it should be as pluggable as possible. |
Thank you for the comment, @rsaccon! rui sounds interesting. I didn't know there were GUIs based on SDFs. I'm looking forward to see what you come up with, so make sure to post it here somewhere!
That's already happening: #141
The current graphics code is simply what it needed to be to get us where we are now. It can and should be improved, both for more efficiency and better visuals. Doing so is not a priority for me right now, not because I think it's not important, but because I have so many other things to do. Tying the graphics code to wgpu is fine by me. I think it's already a great technology, and it will only get better once WebGPU shows up in browsers. Although one thing we might want to consider, is to switch to a higher-level graphics engine at some point. I don't know if that is practical, or even desirable, but if there's something out there that is easier to use, but gives us all the capabilities we need, then that might be worth considering.
Good point. I'll keep that in mind, as I keeping working on #141. |
So, you see, I have this fatal flaw: I want to be cool & I want to be helpful... And, somewhat conveniently for you, for some reason I find CAD-related things pretty cool, so... :D A demo of egui integrated with Fornjot: fornjot-egui-poc--simple-screen-recorder-recording-01--2022-05-24_23.41.26.webm.movWhile this demo is very much at the hacky/proof-of-concept level, it does work & I think it is a realistic option for a road to go down. As shown, egui is essentially being rendered "on top" of whatever I did attempt to "play nice" with egui & let it take the window events it wanted exclusive access to but that didn't work well with how (Which leads to the unintentionally :) avoided scenario of moving the "title" bar of the egui window causing the model to rotate, which I only just noticed. :D ) (Also, the GUI "overlay" doesn't need to look like a window, that was just the default example I based the demo on. For a rather...different look...this is an example of a egui UI I put together in Bevy: https://rancidbacon.itch.io/darkrun ) Anyway, I need to get some sleep but wanted to at least post this much progress here before I ran out of momentum. I'll try to come back tomorrow with something a little more code-like for you--although I also discovered along the way that there's probably a better/easier way to achieve this which I only discovered along the way. Pretty happy to get things this far, eventually. :) |
Let me assure you, you are cool and helpful! And I'm lucky to be able to exploit that 😄 But seriously, this is awesome! I hope this will result in a pull request down the line! Since this is an incremental step based on what we already have (and what I'm already comfortable maintaining), the bar for merging this is super-low. I assume that adding what you already have here would be a good guidepost for anyone (maybe me) who's looking into adding more UI elements. So don't feel the need to submit a super-polished pull request. I'm happy to merge anything that takes us into the right direction, as long as it doesn't break existing features too badly. (Don't feel discouraged from submitting a super-polished pull request either, if that's what you want and have the time for 😄) |
Just to update this issue with links to the related PRs:
|
The current GUI infrastructure infrastructure is very basic, and extending it is probably not desirable. What is desirable, is to integrate an existing solution. I have my sights on egui, since it looks like it could meet all our needs and more, and is specifically designed for being integrated into existing render pipelines.
The objective of this issue is to evaluate egui (and possibly other options), by integrating it into our rendering pipeline, and replacing the existing UI elements (as of this writing, the only UI elements are the 3 lines of text that indicate how to enable/disable the different drawing options). If this evaluation is positive, the code should be merged.
Labeling as https://github.com/hannobraun/Fornjot/labels/good%20first%20issue, as this issue only requires familiarity with egui (or another solution being evaluated) and Fornjot's graphics code (which is wgpu-based). It doesn't require any deep expertise of Fornjot itself.
Further notes
Please note that the scope of this issue specifically is about a "core" GUI, that is integrated with our graphics code and needs to be available wherever that graphics code runs. Example use cases would be the configuration of drawing modes, visualizing the structure of the model, selecting different aspects of the model to render, etc. There might be a need for a less core, platform-specific GUI solution (for example, an "open file" dialog to select a model to load, before Fornjot proper is even launched). This is tracked in #117 .
This issue is a more specific follow-up to #4.
The text was updated successfully, but these errors were encountered: