@plasius/gpu-renderer 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -0
- package/README.md +118 -3
- package/dist/index.cjs +3447 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3421 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
- package/src/index.d.ts +582 -0
- package/src/index.js +213 -0
- package/src/wavefront-compute.js +3460 -0
package/CHANGELOG.md
CHANGED
|
@@ -23,6 +23,73 @@ All notable changes to this project will be documented in this file.
|
|
|
23
23
|
- **Security**
|
|
24
24
|
- (placeholder)
|
|
25
25
|
|
|
26
|
+
## [0.1.14] - 2026-06-04
|
|
27
|
+
|
|
28
|
+
- **Added**
|
|
29
|
+
- Added wavefront path-tracing queue/buffer contracts and bounce-schedule
|
|
30
|
+
metadata beneath `createRayTracingRenderPlan(...)`.
|
|
31
|
+
- Added a tiled WebGPU wavefront compute renderer with scene-object buffers,
|
|
32
|
+
GPU ray queues, hit records, material continuation, emissive/environment
|
|
33
|
+
termination, ambient residual expiry, denoise resolve, and presentation.
|
|
34
|
+
- Added triangle mesh normalization, GPU-source mesh packing, triangle/BVH
|
|
35
|
+
buffer contracts, and display-quality guards requiring mesh BVH input.
|
|
36
|
+
- Added GPU mesh-source buffer packing and GPU build-pass entry points for
|
|
37
|
+
triangle assembly, GPU Morton leaf sorting, sorted leaf materialization,
|
|
38
|
+
and deterministic, level-concurrent BVH node construction.
|
|
39
|
+
- Added public BVH sort-stage and build-level scheduling metadata for worker/queue
|
|
40
|
+
integration.
|
|
41
|
+
- Expanded GPU hit records with primitive id, material reference, medium
|
|
42
|
+
reference, barycentric coordinates, and UV coordinates.
|
|
43
|
+
- Added mesh BVH tests for flat normals, smooth normals, stable triangle
|
|
44
|
+
identity, leaf splitting, and GPU record layout stability.
|
|
45
|
+
- Added public scene-object packing/config helpers for Product Studio and
|
|
46
|
+
other package consumers.
|
|
47
|
+
- Updated the browser demo to mount the wavefront compute renderer directly
|
|
48
|
+
and consume a `@plasius/gpu-lighting` environment preset.
|
|
49
|
+
- Added `samplesPerPixel` support for GPU wavefront renders so quality
|
|
50
|
+
presets can accumulate multiple primary-ray samples without increasing
|
|
51
|
+
tile-queue buffer size.
|
|
52
|
+
- Added a two-stage full-frame GPU denoise pass that filters linear
|
|
53
|
+
`rgba16float` radiance through a scratch texture after all tiles complete,
|
|
54
|
+
then tone-maps into the final `rgba8unorm` output while avoiding tile-local
|
|
55
|
+
denoise artifacts.
|
|
56
|
+
- Added GPU emissive-triangle continuation guidance stored in the BVH buffer
|
|
57
|
+
tail so active diffuse rays sample finite mesh light geometry more often
|
|
58
|
+
without adding a ninth trace storage buffer or separate direct-light/shadow
|
|
59
|
+
accumulation path.
|
|
60
|
+
|
|
61
|
+
- **Changed**
|
|
62
|
+
- Wavefront environment misses now evaluate a direction-aware sky/key-light
|
|
63
|
+
environment payload instead of only using a flat environment colour.
|
|
64
|
+
- Display-quality wavefront configuration now uses GPU-built mesh
|
|
65
|
+
acceleration; CPU-built mesh acceleration is treated as debug-only.
|
|
66
|
+
- Replaced the one-thread BVH internal-node build kernel with bottom-up
|
|
67
|
+
level dispatches so parent nodes at the same depth build concurrently on
|
|
68
|
+
the GPU.
|
|
69
|
+
- Reordered mesh BVH leaves on the GPU by Morton-style centroid keys before
|
|
70
|
+
internal node construction, avoiding author/index-order BVH layout as the
|
|
71
|
+
display-quality baseline.
|
|
72
|
+
- Removed the direct `@plasius/gpu-shared` dependency from the renderer to
|
|
73
|
+
keep shared demo adapters dependent on the renderer rather than the reverse.
|
|
74
|
+
- Wavefront surface resolution now removes the separate direct key-light
|
|
75
|
+
accumulation term, clamps high-energy path samples in linear radiance, and
|
|
76
|
+
applies a bounded estimator weight to guided emissive hits while relying on
|
|
77
|
+
active emissive/environment path hits plus ambient residual expiry for
|
|
78
|
+
preview output.
|
|
79
|
+
- Wavefront primary-ray jitter and bounce sampling now use mixed
|
|
80
|
+
pixel/sample/bounce/frame seeds to reduce row-correlated low-sample noise.
|
|
81
|
+
|
|
82
|
+
- **Fixed**
|
|
83
|
+
- Fixed primary-ray jitter seeding to use absolute screen pixel ids instead
|
|
84
|
+
of tile-local pixel ids, preventing repeated sampling patterns across
|
|
85
|
+
tiles.
|
|
86
|
+
- Fixed the WebGPU hit-buffer stride to match the WGSL `HitRecord` layout
|
|
87
|
+
and added a continuation-queue capacity guard, preventing tile-row
|
|
88
|
+
corruption in mesh BVH wavefront renders.
|
|
89
|
+
|
|
90
|
+
- **Security**
|
|
91
|
+
- (placeholder)
|
|
92
|
+
|
|
26
93
|
## [0.1.12] - 2026-05-13
|
|
27
94
|
|
|
28
95
|
- **Added**
|
|
@@ -194,3 +261,4 @@ All notable changes to this project will be documented in this file.
|
|
|
194
261
|
[0.1.10]: https://github.com/Plasius-LTD/gpu-renderer/releases/tag/v0.1.10
|
|
195
262
|
[0.1.11]: https://github.com/Plasius-LTD/gpu-renderer/releases/tag/v0.1.11
|
|
196
263
|
[0.1.12]: https://github.com/Plasius-LTD/gpu-renderer/releases/tag/v0.1.12
|
|
264
|
+
[0.1.14]: https://github.com/Plasius-LTD/gpu-renderer/releases/tag/v0.1.14
|
package/README.md
CHANGED
|
@@ -96,12 +96,113 @@ const plan = createRayTracingRenderPlan({
|
|
|
96
96
|
console.log(plan.inputBoundary);
|
|
97
97
|
console.log(plan.renderStages.map((stage) => stage.key));
|
|
98
98
|
console.log(plan.representationBands);
|
|
99
|
+
console.log(plan.wavefront.queueLayout.strategy);
|
|
99
100
|
```
|
|
100
101
|
|
|
101
102
|
The plan makes the stable visual snapshot boundary explicit, publishes the
|
|
102
103
|
required RT-first stage ordering, and exposes representation-band plus
|
|
103
104
|
acceleration-structure update policy metadata for downstream lighting and
|
|
104
|
-
performance packages.
|
|
105
|
+
performance packages. It now also exposes the renderer-owned wavefront queue
|
|
106
|
+
model, versioned ray/hit/surface/material/medium/accumulation contracts, and
|
|
107
|
+
the termination policy for emissive/environment path completion.
|
|
108
|
+
|
|
109
|
+
## WebGPU Wavefront Compute Renderer
|
|
110
|
+
|
|
111
|
+
The package also exposes an executable WebGPU wavefront renderer for active-ray
|
|
112
|
+
debug validation scenes. It is compute-driven, tiled, and breadth-first by
|
|
113
|
+
bounce depth, so queue buffers are bounded by tile size instead of presentation
|
|
114
|
+
resolution. Renderer-owned GPU record sizes are part of the public compute
|
|
115
|
+
limits so ray, hit, triangle, BVH, and accumulation buffers stay aligned with
|
|
116
|
+
their WGSL layouts.
|
|
117
|
+
|
|
118
|
+
```js
|
|
119
|
+
import {
|
|
120
|
+
createWavefrontPathTracingComputeRenderer,
|
|
121
|
+
} from "@plasius/gpu-renderer";
|
|
122
|
+
|
|
123
|
+
const renderer = await createWavefrontPathTracingComputeRenderer({
|
|
124
|
+
canvas: document.querySelector("#product-render"),
|
|
125
|
+
width: 1280,
|
|
126
|
+
height: 720,
|
|
127
|
+
maxDepth: 6,
|
|
128
|
+
samplesPerPixel: 8,
|
|
129
|
+
displayQuality: true,
|
|
130
|
+
meshes: [
|
|
131
|
+
{
|
|
132
|
+
id: 1,
|
|
133
|
+
positions: [-1, -1, 0, 1, -1, 0, 0, 1, 0],
|
|
134
|
+
indices: [0, 1, 2],
|
|
135
|
+
normals: [0, 0, 1, 0, 0, 1, 0, 0, 1],
|
|
136
|
+
emission: [8, 7, 5, 1],
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
renderer.renderOnce();
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Analytic scene objects remain available for debug fixtures:
|
|
145
|
+
|
|
146
|
+
```js
|
|
147
|
+
const debugRenderer = await createWavefrontPathTracingComputeRenderer({
|
|
148
|
+
canvas: document.querySelector("#debug-render"),
|
|
149
|
+
width: 1280,
|
|
150
|
+
height: 720,
|
|
151
|
+
maxDepth: 6,
|
|
152
|
+
sceneObjects: [
|
|
153
|
+
{
|
|
154
|
+
type: "sphere",
|
|
155
|
+
center: [0, 1.8, -0.5],
|
|
156
|
+
radius: 0.35,
|
|
157
|
+
emission: [8, 7, 5, 1],
|
|
158
|
+
materialKind: "emissive",
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
debugRenderer.renderOnce();
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Scene objects currently support analytic `sphere` and axis-aligned `box`
|
|
167
|
+
records with colour, emission, roughness, metallic, opacity, and IOR fields.
|
|
168
|
+
These records are debug fixtures only. Product Studio visual rendering requires
|
|
169
|
+
the mesh BVH path described in
|
|
170
|
+
`docs/adrs/adr-0007-triangle-mesh-wavefront-path-tracing.md`. This is a
|
|
171
|
+
project-wide display-quality baseline for path-traced rendering, not a
|
|
172
|
+
Product-Studio-only requirement.
|
|
173
|
+
|
|
174
|
+
Mesh inputs are normalized into triangle records, packed into GPU buffers, and
|
|
175
|
+
uploaded as source buffers for GPU triangle assembly and GPU BVH construction.
|
|
176
|
+
Vertex normals are preserved for smooth shading; when normals are absent the
|
|
177
|
+
triangle geometric normal is used. The display-quality path uses
|
|
178
|
+
`accelerationBuildMode: "gpu"` and rejects CPU-built acceleration. The
|
|
179
|
+
`createWavefrontMeshAcceleration(...)` helper remains available only for debug
|
|
180
|
+
fixtures and deterministic layout tests. GPU BVH construction now uses
|
|
181
|
+
Morton-style centroid keys to sort leaf references before sorted leaves and
|
|
182
|
+
level-concurrent internal nodes are materialized. The current mesh path is the
|
|
183
|
+
GPU runtime baseline under active hardening.
|
|
184
|
+
|
|
185
|
+
`samplesPerPixel` controls how many GPU primary-ray samples are accumulated per
|
|
186
|
+
screen pixel within a single render. This multiplies dispatch work but does not
|
|
187
|
+
increase the tile queue memory footprint, so 720p/1080p/4K targets remain
|
|
188
|
+
bounded by `tileSize`. When `denoise` is enabled the renderer writes raw
|
|
189
|
+
linear radiance to an `rgba16float` texture first, then runs a two-stage
|
|
190
|
+
full-frame GPU denoise through an `rgba16float` scratch texture before final
|
|
191
|
+
tone mapping into the presented `rgba8unorm` output. Filtering in linear
|
|
192
|
+
radiance space lets the denoise pass cross tile boundaries without compressing
|
|
193
|
+
energy/detail before the final resolve. The renderer also stores compact
|
|
194
|
+
emissive-triangle metadata in the existing BVH buffer tail and uses it to guide
|
|
195
|
+
diffuse continuation rays toward finite mesh light geometry without adding a
|
|
196
|
+
ninth trace storage buffer. This is not a separate shadow/direct-light pass: the
|
|
197
|
+
active ray still has to hit emissive geometry or miss into the environment
|
|
198
|
+
before radiance is accumulated. Guided emissive hits carry a bounded estimator
|
|
199
|
+
weight so finite light guidance does not over-expose low-sample renders before
|
|
200
|
+
full material PDFs/MIS are implemented. High-energy samples are clamped in
|
|
201
|
+
linear radiance space to keep low-sample preview output stable while production
|
|
202
|
+
sampling, temporal accumulation, and better material PDFs are hardened.
|
|
203
|
+
Texture sampling, dynamic TLAS updates, higher-grade LBVH/SAH construction,
|
|
204
|
+
runtime execution behind the `@plasius/gpu-worker` lock-free queue, and broader
|
|
205
|
+
material lookup remain follow-up work.
|
|
105
206
|
|
|
106
207
|
## XR integration
|
|
107
208
|
|
|
@@ -126,6 +227,17 @@ renderer.bindXrManager(xr, {
|
|
|
126
227
|
- `getRendererWorkerProfile(name?)`
|
|
127
228
|
- `getRendererWorkerManifest(name?)`
|
|
128
229
|
- `createRayTracingRenderPlan(options)`
|
|
230
|
+
- `createWavefrontPathTracingComputeRenderer(options)`
|
|
231
|
+
- `createWavefrontPathTracingComputeConfig(options)`
|
|
232
|
+
- `normalizeWavefrontMesh(input)`
|
|
233
|
+
- `createWavefrontGpuMeshSource(meshes)`
|
|
234
|
+
- `createWavefrontBvhSortStages(itemCount)`
|
|
235
|
+
- `createWavefrontBvhBuildLevels(triangleCount)`
|
|
236
|
+
- `createWavefrontMeshAcceleration(meshes)`
|
|
237
|
+
- `normalizeWavefrontSceneObject(input)`
|
|
238
|
+
- `packWavefrontSceneObjects(sceneObjects, capacity?)`
|
|
239
|
+
- `packWavefrontTriangles(triangles, capacity?)`
|
|
240
|
+
- `packWavefrontBvhNodes(nodes, capacity?)`
|
|
129
241
|
- `bindRendererToXrManager(renderer, xrManager, options)`
|
|
130
242
|
- `defaultRendererClearColor`
|
|
131
243
|
- `rendererDebugOwner`
|
|
@@ -146,8 +258,11 @@ npm run demo
|
|
|
146
258
|
|
|
147
259
|
Then open `http://localhost:8000/gpu-renderer/demo/`.
|
|
148
260
|
|
|
149
|
-
The demo now
|
|
150
|
-
|
|
261
|
+
The demo now mounts the mesh BVH WebGPU wavefront renderer directly and passes a
|
|
262
|
+
`@plasius/gpu-lighting` environment preset into the render. It reports the
|
|
263
|
+
active wavefront depth, tile count, triangle/BVH counts, lighting preset, probe
|
|
264
|
+
luminance, and hot buffer memory so it is clear whether the renderer is tracing
|
|
265
|
+
mesh paths rather than only showing planning metadata.
|
|
151
266
|
|
|
152
267
|
## Development Checks
|
|
153
268
|
|