wgpuEngine
is an open-source engine designed for creating desktop, XR (extended reality), and 3D web applications. Built on top of the newest graphics API WebGPU, it provides a cross-platform solution to render complex scenes, animations, and immersive experiences.
It uses Dawn, which provides WebGPU for desktop and web (via emscripten). We are still using a forked version until the official one adds XR support. For desktop XR it uses OpenXR.
Important
Web XR still not available until WebGPU and WebXR are integrated.
See Rooms for an example of how to use this engine.
- Web export (Still no XR enabled)
- Flat screen Desktop VR Rendering Supported
- Supported platforms:
- Windows
- Web Chrome
- Mac OS
- Supported formats:
- .obj (using tinyobjloader)
- .gltf/.glb (using tinygltf)
- .ply (using happly)
- .vdb (using easyVDB)
- Rendering features:
- XR Rendering
- Physically Based Materials (PBR)
- HDR IBL Lighting
- Instancing
- Gaussian Splatting Renderer
- Scene node management
- Support for Rigid and Skeletal animations
- UI Features:
- 2D and 3D User Interface
- 3D Text Rendering
- 2D and 3D Gizmo (ImGuizmo for 2D)
int main()
{
Engine* engine = new Engine();
Renderer* renderer = new Renderer();
if (engine->initialize(renderer)) {
return 1;
}
engine->start_loop();
engine->clean();
delete engine;
delete renderer;
return 0;
}
To start creating your application, override the Engine
class! You can also override the Renderer class to customize the render passes:
- custom_pre_opaque_pass, custom_post_opaque_pass
- custom_pre_transparent_pass, custom_post_transparent_pass
- custom_pre_2d_pass, custom_post_2d_pass
Customize engine parameters using sEngineConfiguration
when calling Engine::initialize
:
sEngineConfiguration engine_config = {
.window_title = "Application",
};
if (engine->initialize(renderer, engine_config)) {
return 1;
}
Customize also renderer parameters using sRendererConfiguration
when instancing your renderer to modify WebGPU context parameters. E.g. required limits or features:
sRendererConfiguration render_config;
render_config.required_limits.limits.maxStorageBuffersPerShaderStage = 8;
render_config.required_limits.limits.maxComputeInvocationsPerWorkgroup = 1024;
Renderer* renderer = new Renderer(render_config);
You will need to install the following tools:
and clone the Github repository, also initializing the submodules:
git clone https://github.com/upf-gti/rooms.git
git submodule update --init --recursive
mkdir build
cd build
cmake ..
Download emscripten and follow the installation guide.
On Windows you may need to download ninja and include the folder in your PATH environment variable, then:
mkdir build-web
cd build-web
emcmake cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .