UE5 Nanite in WebGPU
The Nanite WebGPU project replicates Unreal Engine 5's technology for web rendering using WebGPU in Chrome, featuring meshlet LOD, software rasterization, and interactive demo scenes for real-time adjustments.
Read original articleThe Nanite WebGPU project on GitHub aims to replicate the Nanite technology from Unreal Engine 5, enabling the rendering of high-detail 3D models in web browsers using WebGPU, which is currently supported only in Chrome. The project features a meshlet level of detail (LOD) hierarchy, a software rasterizer, and various culling techniques to enhance rendering performance. It supports a custom file format for meshes while also accommodating OBJ files. Users can interact with demo scenes that showcase the technology's capabilities, allowing for real-time adjustments to rendering parameters. The repository includes links to demo scenes, such as the Jinx Scene and Many Objects Scene, which can be explored directly in the browser. This project represents a significant advancement in web-based 3D rendering, demonstrating the potential of modern web technologies for high-fidelity graphics.
- The project replicates Unreal Engine 5's Nanite technology for web rendering.
- It utilizes WebGPU, currently supported only in Chrome.
- Features include a meshlet LOD system, software rasterization, and culling techniques.
- Users can interact with demo scenes and adjust rendering parameters in real-time.
- The project serves as a practical implementation of advanced rendering techniques for the web.
Related
20x Faster Background Removal in the Browser Using ONNX Runtime with WebGPU
Using ONNX Runtime with WebGPU and WebAssembly in browsers achieves 20x speedup for background removal, reducing server load, enhancing scalability, and improving data security. ONNX models run efficiently with WebGPU support, offering near real-time performance. Leveraging modern technology, IMG.LY aims to enhance design tools' accessibility and efficiency.
GPU profiling for WebGPU workloads on Windows with Chrome
Challenges of GPU profiling for WebGPU in Chrome on Windows are addressed. A workaround using a custom DLL enables GPU profiling with tools like AMD's Radeon GPU Profiler and Nvidia's Nsight, enhancing performance metrics for WebGPU applications.
Show HN: Free e-book about WebGPU Programming
"WebGPU Unleashed" is a tutorial for beginners in graphics programming using the WebGPU API, covering foundational concepts, basic tasks, and advanced techniques like Gaussian splatting in an interactive format.
Diffusion Models Are Real-Time Game Engines
GameNGen, developed by Google and Tel Aviv University, simulates DOOM in real-time at over 20 frames per second using a two-phase training process, highlighting the potential of neural models in gaming.
Notan: Cross-Platform Multimedia Layer
Notan is a cross-platform multimedia framework that simplifies application development with user-friendly APIs, modular design, and promising rendering capabilities, supporting WebAssembly and various operating systems. Contributions are encouraged.
- Several users discuss the technical aspects of Nanite, including its mesh representation and the need for GPU hardware improvements to fully utilize its capabilities.
- There is confusion regarding the project's name, with some clarifying that it is not the same as Unreal Engine 5's Nanite but rather an independent implementation of similar concepts.
- Users express concerns about compatibility issues with different browsers and devices, particularly regarding WebGPU support.
- Some commenters highlight the performance of the demos, noting impressive frame rates despite the complexity of the scenes.
- There is interest in how other game engines handle level of detail (LOD) systems compared to Nanite's approach.
Nanite is a very clever representation of graphics meshes. They're directed acyclic graphs rather than trees. Repetition is a link, not a copy. It's recursive; meshes can share submeshes, which in turn can share submeshes, all the way down. It's also set up for within-mesh level of detail support, so the submeshes drop out when they're small enough. So you can have repetitive content of very large size with a finite amount of data and fast rendering times. The insight is that there are only so many pixels on screen, so there's an upper bound on rendering work really needed.
There's a really good SIGGRAPH video on this from someone at Epic.
Current GPU designs are a mismatch for Nanite, Some new hardware operations are needed to do more of this in the GPU, where it belongs. Whether that will happen, with NVidia distracted by the AI market, is a good question.
The scene needs a lot of instancing for this to pay off. Unreal Engine demos show such things as a hall of identical statues. If each statue was different, Nanite would help far less. So it works best for projects where a limited number of objects are reused to create large areas of content. That's the case for most AAA titles. Watch a video of Cyberpunk 2077, and look for railings and trash heaps. You'll see the same ones over and over in totally different contexts.
Making a nanite mesh is complicated, with a lot of internal offsets for linking, and so far only Unreal Engine's editor does it. With playback now open source, someone will probably do that.
Those internal offsets in the format present an attack surface which probably can be exploited with carefully crafted bad content, like hostile Microsoft Word .doc files.
As for this project, Scthe did a great job! I've been talking with them about several parts of the process, culminating in some improvements to Bevy's code based on their experience (https://github.com/bevyengine/bevy/pull/15023). Always happy to see more people working on this, Nanite has a ton of cool ideas.
I am on Chromium, not Chrome, and use WebGPU all the time, but the demos tell me to use Chrome, which I cannot do ethically. Would love to try the demos out, this looks like a lot of hard work!
https://vcg.isti.cnr.it/~ponchio/download/ponchio_phd.pdf (107 pages!)
[1] https://webgpu.github.io/webgpu-samples/?sample=texturedCube
There is also Bevy's Virtual Geometry that provides similar functionality and is probably much more useful since it's written in Rust and integrated with a game engine: https://jms55.github.io/posts/2024-06-09-virtual-geometry-be...
This technique is starting to appear in a variety of places. Nanite definitely made the idea famous, but Nanite is the name a specific implementation, not the name of the technique.
Godot has automatic LOD which seems pretty cool for what it is: https://docs.godotengine.org/en/stable/tutorials/3d/mesh_lod...
Unity also has an LOD system, though despite how popular the engine is, you have to create LOD models manually: https://docs.unity3d.com/Manual/LevelOfDetail.html (unless you dig through the asset store and find a plugin)
I did see an interesting approach in a lesser known engine called NeoAxis: https://www.neoaxis.com/docs/html/NeoAxis_Levels.htm however that engine ran very poorly for me on my old RX580, although I haven't tried on my current A580.
As far as I can tell, Unreal is really quite far ahead of the competition when it comes to putting lots of things on the screen, except the downside of this is that artists will be tempted to include higher quality assets in their games, bloating the install sizes quite far.
WebGPU error [frame][validation]: Fill size (7398781) is not a multiple of 4
bytes.
- While encoding [CommandEncoder "main-frame-cmd-buffer"].ClearBuffer([Buffer
"rasterize-sw"], 0, 7398781).
ID3D12Device::GetDeviceRemovedReason failed with DXGI_ERROR_DEVICE_HUNG (0x887A0006)
- While handling unexpected error type Internal when allowed errors are (Validation|DeviceLost).
at CheckHRESULTImpl (..\..\third_party\dawn\src\dawn\native\d3d\D3DError.cpp:119)
at CheckAndUpdateCompletedSerials (..\..\third_party\dawn\src\dawn\native\d3d12\QueueD3D12.cpp:179)
at CheckPassedSerials (..\..\third_party\dawn\src\dawn\native\ExecutionQueue.cpp:48)
at Tick (..\..\third_party\dawn\src\dawn\native\Device.cpp:1730)
Backend messages:
\* Device removed reason: DXGI_ERROR_DEVICE_HUNG (0x887A0006)
it's closed source, but I found the discussion and description of the tradeoffs interesting
Just a disclaimer that it will only work on WebGPU-enabled browser on Windows (Chrome, Edge, etc) unfortunately Mac has issues for now. Also, there is no Nanite in this demo, but it will be possible in the future.
> UE5's Nanite implementation using WebGPU. Includes the meshlet LOD hierarchy, software rasterizer and billboard impostors. Culling on both per-instance and per-meshlet basis.
Getting that on Chromium, lol.
No WebGPU available. Please use Chrome.
on chrome (Version 129.0.6668.29 (Official Build) beta (64-bit)) , under windows> I could have built this with Vulkan and Rust. None would touch it.
Fucking .. bravo man.
Related
20x Faster Background Removal in the Browser Using ONNX Runtime with WebGPU
Using ONNX Runtime with WebGPU and WebAssembly in browsers achieves 20x speedup for background removal, reducing server load, enhancing scalability, and improving data security. ONNX models run efficiently with WebGPU support, offering near real-time performance. Leveraging modern technology, IMG.LY aims to enhance design tools' accessibility and efficiency.
GPU profiling for WebGPU workloads on Windows with Chrome
Challenges of GPU profiling for WebGPU in Chrome on Windows are addressed. A workaround using a custom DLL enables GPU profiling with tools like AMD's Radeon GPU Profiler and Nvidia's Nsight, enhancing performance metrics for WebGPU applications.
Show HN: Free e-book about WebGPU Programming
"WebGPU Unleashed" is a tutorial for beginners in graphics programming using the WebGPU API, covering foundational concepts, basic tasks, and advanced techniques like Gaussian splatting in an interactive format.
Diffusion Models Are Real-Time Game Engines
GameNGen, developed by Google and Tel Aviv University, simulates DOOM in real-time at over 20 frames per second using a two-phase training process, highlighting the potential of neural models in gaming.
Notan: Cross-Platform Multimedia Layer
Notan is a cross-platform multimedia framework that simplifies application development with user-friendly APIs, modular design, and promising rendering capabilities, supporting WebAssembly and various operating systems. Contributions are encouraged.