mvlabat / bevy_egui

This crate provides an Egui integration for the Bevy game engine. 🇺🇦 Please support the Ukrainian army: https://savelife.in.ua/en/
MIT License
957 stars 248 forks source link

World-space UI #207

Closed TheButlah closed 2 months ago

TheButlah commented 1 year ago

(reposted from #193)

I would like to be able to do world-space egui based UI in bevy. Think, rendering to a wall in a game, or even a mesh like a curved computer monitor. I think this would require rendering to a bevy Image as an output texture. As a jank demo of what I mean, I've managed to do something similar with egui_wgpu here (WIP code, danger).

Is there any interest in adding this as a feature to bevy_egui? I need to do make this anyway, so it probably makes sense for me to add it here instead of in another crate.

https://github.com/mvlabat/bevy_egui/assets/6969415/a4c820b0-8f67-4f01-9f94-e596cac0e722

mvlabat commented 1 year ago

Hey! Thanks for creating the issue. Yes, this is something I'd be absolutely happy to see in bevy_egui. Unfortunately, I have very limited time lately, so I don't know how long it will take me to implement this. I have some drafts locally that aren't even remotely functional, so if anyone wants to try to tackle it as well, I'll happily accept such a PR.

TheButlah commented 1 year ago

I've managed to get my wgpu prototype turned into a bevy prototype: https://github.com/NexusSocial/skilltree/pull/23 I'm using egui_wgpu still, but I saw that bevy_egui uses bevy directly.

Putting aside for a moment the question of how to handle input, do you think its wiser to integrate with this plugin and use bevy directly, or for me to make a separate plugin and double down on egui_wgpu? Are there any important performance downsides to egui_wgpu over bevy-native?

If I try to make a PR, how much bandwidth do you have for coaching me? I'm unfamiliar with bevy's high and mid level rendering apis still so it may take me some time and I'll have questions.

Screenshot 2023-09-17 at 11 55 37 PM
mvlabat commented 1 year ago

Wow, that's awesome progress!

Putting aside for a moment the question of how to handle input, do you think its wiser to integrate with this plugin and use bevy directly

I don't have any good arguments atm, but intuitively I think it would be better to build this with Bevy abstractions if possible.

If I try to make a PR, how much bandwidth do you have for coaching me?

I'll do my best to review it at soon as possible, not so sure on coaching though :( I'm re-learning rendering almost from scratch each time I touch it, lol, as I don't do it too often. But I'm sure there are many folks in the Bevy discord who will be willing to assist.

Having that said, fill free to ping me with any questions on bevy_egui itself (I'm also @mvlabat in Discord).

afpro commented 3 months ago

Any progress buddy? I'm not very familiar with egui and wgpu, but maybe I can do something if you already have a PR.

mvlabat commented 2 months ago

Rendering UI to worldspace should now be possible (we still lack a proper input handling though, I'll probably fix this once Bevy 0.15 lands).