Home

Awesome

WebGPU Ray Tracing eXtension

Introduction

WebGPU Ray Tracing Extension (WebRTX) extends the WebGPU API with ray tracing capabilities. The Javascript programming interface is based on Vulkan's Ray Tracing API and is heavily influenced by the dawn-ray-tracing spec. On GPU side, you can directly use the five shader stages introduced by the GLSL_EXT_ray_tracing extension for building GLSL shaders.

Unlike the dawn-ray-tracing project which requires a new Chromium build for translating WebGPU commands to calls to native backends, WebRTX is not hardware ray tracing and is a pure compute shader implementation. This means WebRTX works as long as your browser supports WebGPU (only tested on Chrome so far).

Specification

See types.ts. Note that the spec is unstable in current state and might change in future development.

Examples

triangle

shadowray

How it works

Ray Tracing Pipeline

[recreated based on Khronos' diagram]

The five stage shaders (light green) are provided by users, while the acceleration structure traversal and the (recursive) invocations of user shader functions are implemented by WebRTX's internal compute shader code.

More specifically,

Development

Code structure

Building

Dependencies

npm run build