-
I've created a basic UI in egui and now I need to have a window where I display 3D objects which the user can pan around, I was wondering what the best way to approach this would be. So far I've been thinking that I use a linear algebra lib to do the necessary projections on the 3D data and then somehow convert that to triangles for epaint to draw. Or maybe there is an easier way of allowing a 3D lib to use the area within an egui window? This is a web-base app by the way. Any help would be much appreciated. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
Update: As mentioned by @emilk in another reply, in egui 0.18.1, one can now do 3D drawing directly in egui (and avoid roundtripping the render through CPU memory) with (note: I'm not @emilk, but I'm a fan of both Dear ImGui and egui) I think the simplest way to show 3D content with the libraries as they exist today:
If you're like to have The Some more options that haven't (yet) been implemented in
|
Beta Was this translation helpful? Give feedback.
-
Doing 3D rendering of any kind is way out of scope for the egui project, but of course integrating 3D graphics (or graphics of any kind that is rendered by something other than Egui) is a very important use case to support! How to integrate with 3D graphics depends on the need and the integration. In some cases you would draw your 3D stuff first and then draw Egui on top of it. This is what people are already doing with other integrations. If you want to show 3D graphics inside an Egui window (as opposed to behind the windows), that I agree with @tangmi that rendering to a texture is the cleanest solution. How to render to texture depends on the integration. Now for your specific case of targeting web: Unless you want to write a full 3D renderer yourself, then However, In fact, I think it would be pretty awesome if |
Beta Was this translation helpful? Give feedback.
-
You can now embed 3D graphics in egui using https://github.com/emilk/egui/tree/master/examples/custom_3d_glow |
Beta Was this translation helpful? Give feedback.
-
According to 636a39c there is no simple path for now? |
Beta Was this translation helpful? Give feedback.
Doing 3D rendering of any kind is way out of scope for the egui project, but of course integrating 3D graphics (or graphics of any kind that is rendered by something other than Egui) is a very important use case to support!
How to integrate with 3D graphics depends on the need and the integration. In some cases you would draw your 3D stuff first and then draw Egui on top of it. This is what people are already doing with other integrations. If you want to show 3D graphics inside an Egui window (as opposed to behind the windows), that I agree with @tangmi that rendering to a texture is the cleanest solution. How to render to texture depends on the integration.
Now for your specific case of …