|
I would like to build a game engine in rust with gpui and gpui-components. I would like to know if it is possible to render a 3D viewport or build things like node graph, timeline, inspector. I mean the component parts are easier but 3D viewport? Renderer |
Replies: 2 comments 1 reply
|
Yes for the editor shell; not yet as a drop-in, cross-platform 3D viewport host. GPUI/GPUI Component are a reasonable fit for the inspector, hierarchy, dock panels, menus, property editors, and similar tooling. A node graph and timeline are possible too, but they would be custom interactive components rather than game-engine widgets supplied by this crate. The 3D viewport is the boundary to be careful about. GPUI's public custom-drawing primitive is Your proposed path can be made into a proof of concept: GPUI does have There is one platform-specific exception: GPUI currently has For a production viewport, I would choose one of these designs:
A practical sequence would be:
Also pin GPUI to an exact Zed commit while doing this. GPUI Component currently consumes GPUI directly from the Zed Git repository rather than a stable crates.io release (workspace dependency), so building an engine integration against a moving So the short answer is: GPUI Component can be the editor UI, but the zero-copy 3D viewport shown in your diagram is not an existing supported component/API. CPU RGBA frames are a workable prototype, not the architecture I would keep for a 60 FPS editor. |
|
AFAIK, state of the art of everything 3D in gpui is https://github.com/Far-Beyond-Pulsar. They maintain a gpui fork, WGPUI: https://github.com/Far-Beyond-Pulsar/WGPUI Basic idea is that you patch gpui to add an escape hatch to wgpu, allowing you to have a raw surface within gpui element. Then you could use any 3D engine to draw there. Another approach is gpui_embedded: https://github.com/zed-industries/embedded_gpui |
Yes for the editor shell; not yet as a drop-in, cross-platform 3D viewport host.
GPUI/GPUI Component are a reasonable fit for the inspector, hierarchy, dock panels, menus, property editors, and similar tooling. A node graph and timeline are possible too, but they would be custom interactive components rather than game-engine widgets supplied by this crate.
The 3D viewport is the boundary to be careful about. GPUI's public custom-drawing primitive is
canvas(...), which gives a callback into GPUI's own low-level 2D paint API (source). It does not expose an API such as “import thiswgpu::Textureand composite it here.”Your proposed path can be made into a proof of concept: