Greetings from the Unity Graphics team. We’re excited to announce that starting with Unity 2023.3, the Unity Web Player now provides experimental support for the new WebGPU graphics API. The introduction of support for the new WebGPU API marks a significant milestone for web-based graphics acceleration, and paves the way for unprecedented leaps in graphics rendering fidelity for Unity web applications. In this post, we share some useful information on how to enable WebGPU, along with various guidelines and limitations that should be taken into account. WebGPU: The future of graphics and compute on the Web Widely adopted and supported by all major browsers, the WebGL 2.0 API is the industry standard for web-based real-time graphics applications. However, as WebGL shares much of the feature set of OpenGL ES 3.0, it isn’t able to leverage all of the capabilities present in modern GPUs. WebGL 2.0’s most notable limitation is lack of support for Compute Shaders, which are crucial for the mass parallelization and acceleration of general computations on the GPU. This shortcoming manifests as lack of support for newer (compute based) Unity features such as GPU Skinning, VFX Graph and more advanced GPU-driven rendering techniques currently in development. In turn, this significantly limits the scope and fidelity of Web-based Unity applications. Furthermore, WebGL is based on the stateful "bind-and-draw" design of the OpenGL API. Modern graphics APIs all provide a lower-level interface that exposes greater control over the graphics context, and reveals new opportunities for the acceleration of CPU and GPU performance. In order to address the limitations of WebGL, and enable the future of Web-based graphics acceleration, the W3 Consortium (with collaboration from industry leaders such as Google, Apple, Mozilla, Microsoft and Unity) recently published the specifications of the new WebGPU standard. WebGPU was designed with the goal of harnessing and exposing modern GPU capabilities to the Web. This new web API achieves this by providing a modern graphics acceleration interface that is implemented internally via native GPU APIs, such as DirectX12/Vulkan/Metal. The native implementation in use will depend on the browser’s platform and available graphics drivers. The new capabilities exposed by the WebGPU backend will unlock support for new and exciting rendering features, and enable a level of graphics fidelity previously unseen on the Web. Similarly to other modern graphics APIs, lower level control over the rendering setup and GPU execution unlocks new optimization opportunities, which could lead to reduced CPU and GPU overhead and improved throughput and latency. A good example is the case of Compute Skinning support (previously unavailable on Web platforms) which can significantly improve the rendering performance of complex and detailed skinned mesh renderers, by offloading vertex transformations to the GPU. In the following test scenario, the WebGPU backend was observed to run significantly faster compared to the WebGL backend, when rendering a large amount of animated character models:: Compute Skinning in WebGPU (Click here to open a Web Player) Note: WebGPU support is currently limited to compatible desktop browsers. See the "Platform Support" section below for more information. WebGPU vs WebGL - Skinned Mesh Rendering Comparison Another example is the introduction of Indirect Drawing support, which allows to procedurally generate geometry and drawing parameter data, directly within compute shaders. This technique can be used in order to massively-parallelize the transformation, culling, and rendering of complex geometries. This technique is often used when implementing advanced particle systems such as Unity’s own VFX graph. The following demo utilizes VFX Graph in order to efficiently simulate and render over a million particles: VFX Graph on WebGPU (Click here to open a Web Player) - Development in progress Enabling the new WebGPU graphics backend Unity’s new WebGPU backend is in early access, and can be enabled by launching the Editor using the following Project Settings flag “webGLEnableWebGPU”: Navigate to an existing Unity project and open the ProjectSettings.asset file (located at <project folder>/ProjectSettings/ProjectSettings.asset) using a text editor. Search for a setting titled “webGLEnableWebGPU”: If found, change the line to “webGLEnableWebGPU: 1”. If not found, add a line “webGLEnableWebGPU: 1”. (This line can be added anywhere in the file, preferably next to other web-related settings. Open the project in the Unity Editor, using the latest 2023.3 release. The WebGPU backend should now be exposed in the Editor’s Player Settings. Follow the next steps for setting WebGPU as the target graphics API in use: Open the project’s Build Settings panel (“File”->”Build Settings”). In the Platforms list, select “Web” and then click “Switch Platform”. Open the project’s Player Settings panel (“File->”Project Settings”->”Player”) Under the “Other Settings” section, disable the “Auto Graphics API” checkbox. Add “WebGPU” to the Graphics API list, and set it as the first priority above WebGL. You can now build the web project as usual. The WebGPU graphics API will be utilized when running the build on a compatible device and browser. Platform support WebGPU’s specification has recently reached version 1.0, and active development is still ongoing. WebGPU is enabled by default today in Google Chrome on ChromeOS, Mac and Windows, and in Chrome Canary on Android. Browser support is still in development, and we only recommend using WebGPU with Chromium versions 119+ and later, on supported desktop platforms. Driver related issues were identified on older browser releases. Additional browsers (Firefox, Safari) may enable WebGPU via a developer flag. Please refer to the relevant browser’s documentation in order to determine support for the new graphics API. Guidelines and limitations Unity’s WebGPU graphics backend is still in development, and we do not recommend using it for production use cases. Support is currently limited to the Universal Render Pipeline: URP BoatAttack in WebGPU (Click here to open a Web Player) When experimenting with the new backend, please bear in mind that the following key packages and features are not yet supported: VFX Graph (In development) Forward+ Rendering Path Graphics Jobs Dynamic Resolution Entities and Entities Graphics High Definition Render Pipeline (and it’s various features) Async Compute API Additional features (not listed above) may be unsupported or unstable. Moving forward, we are working to stabilize and improve the performance of the new graphics backend. We eventually aim to provide compatibility for all features that could be supported by the new (and evolving) WebGPU standard. You can follow our progress via the public roadmap. If you cannot find the feature you are looking for, feel free to submit a feature request, or contact the team directly in the graphics forum. Please give the new WebGPU backend a try and let us know what you think!