@plasius/gpu-renderer 0.1.13 → 0.1.15

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 CHANGED
@@ -23,11 +23,10 @@ All notable changes to this project will be documented in this file.
23
23
  - **Security**
24
24
  - (placeholder)
25
25
 
26
- ## [0.1.13] - 2026-06-01
26
+ ## [0.1.15] - 2026-06-04
27
27
 
28
28
  - **Added**
29
- - Added wavefront path-tracing queue/buffer contracts and bounce-schedule
30
- metadata beneath `createRayTracingRenderPlan(...)`.
29
+ - (placeholder)
31
30
 
32
31
  - **Changed**
33
32
  - (placeholder)
@@ -38,6 +37,84 @@ All notable changes to this project will be documented in this file.
38
37
  - **Security**
39
38
  - (placeholder)
40
39
 
40
+ ## [0.1.14] - 2026-06-04
41
+
42
+ - **Added**
43
+ - Added wavefront path-tracing queue/buffer contracts and bounce-schedule
44
+ metadata beneath `createRayTracingRenderPlan(...)`.
45
+ - Added a tiled WebGPU wavefront compute renderer with scene-object buffers,
46
+ GPU ray queues, hit records, material continuation, emissive/environment
47
+ termination, ambient residual expiry, denoise resolve, and presentation.
48
+ - Added triangle mesh normalization, GPU-source mesh packing, triangle/BVH
49
+ buffer contracts, and display-quality guards requiring mesh BVH input.
50
+ - Added GPU mesh-source buffer packing and GPU build-pass entry points for
51
+ triangle assembly, GPU Morton leaf sorting, sorted leaf materialization,
52
+ and deterministic, level-concurrent BVH node construction.
53
+ - Added public BVH sort-stage and build-level scheduling metadata for worker/queue
54
+ integration.
55
+ - Expanded GPU hit records with primitive id, material reference, medium
56
+ reference, barycentric coordinates, and UV coordinates.
57
+ - Added mesh BVH tests for flat normals, smooth normals, stable triangle
58
+ identity, leaf splitting, and GPU record layout stability.
59
+ - Added public scene-object packing/config helpers for Product Studio and
60
+ other package consumers.
61
+ - Updated the browser demo to mount the wavefront compute renderer directly
62
+ and consume a `@plasius/gpu-lighting` environment preset.
63
+ - Added `samplesPerPixel` support for GPU wavefront renders so quality
64
+ presets can accumulate multiple primary-ray samples without increasing
65
+ tile-queue buffer size.
66
+ - Added a two-stage full-frame GPU denoise pass that filters linear
67
+ `rgba16float` radiance through a scratch texture after all tiles complete,
68
+ then tone-maps into the final `rgba8unorm` output while avoiding tile-local
69
+ denoise artifacts.
70
+ - Added GPU emissive-triangle continuation guidance stored in the BVH buffer
71
+ tail so active diffuse rays sample finite mesh light geometry more often
72
+ without adding a ninth trace storage buffer or separate direct-light/shadow
73
+ accumulation path.
74
+ - Added WebGPU environment-light portal records so rooms and studio interiors
75
+ can guide and gate sky/HDRI contribution through openings such as windows.
76
+
77
+ - **Changed**
78
+ - Wavefront environment misses now evaluate a direction-aware sky/key-light
79
+ environment payload instead of only using a flat environment colour.
80
+ - Wavefront environment misses now respect `environmentPortalMode`; in
81
+ `guide-and-gate` mode, misses outside configured portals fall back to the
82
+ ambient residual instead of receiving full sky radiance.
83
+ - Display-quality wavefront configuration now uses GPU-built mesh
84
+ acceleration; CPU-built mesh acceleration is treated as debug-only.
85
+ - Replaced the one-thread BVH internal-node build kernel with bottom-up
86
+ level dispatches so parent nodes at the same depth build concurrently on
87
+ the GPU.
88
+ - Reordered mesh BVH leaves on the GPU by Morton-style centroid keys before
89
+ internal node construction, avoiding author/index-order BVH layout as the
90
+ display-quality baseline.
91
+ - Removed the direct `@plasius/gpu-shared` dependency from the renderer to
92
+ keep shared demo adapters dependent on the renderer rather than the reverse.
93
+ - Wavefront surface resolution now removes the separate direct key-light
94
+ accumulation term, clamps high-energy path samples in linear radiance, and
95
+ applies a bounded estimator weight to guided emissive hits while relying on
96
+ active emissive/environment path hits plus ambient residual expiry for
97
+ preview output.
98
+ - Wavefront primary-ray jitter and bounce sampling now use mixed
99
+ pixel/sample/bounce/frame seeds to reduce row-correlated low-sample noise.
100
+ - Wavefront frames now reuse a static GPU-built mesh BVH after the first
101
+ acceleration build and batch tile/sample tracing, tile output, optional
102
+ denoise, and presentation into one frame command submission.
103
+
104
+ - **Fixed**
105
+ - Fixed primary-ray jitter seeding to use absolute screen pixel ids instead
106
+ of tile-local pixel ids, preventing repeated sampling patterns across
107
+ tiles.
108
+ - Fixed environment portal WGSL reserved-word usage and now request the
109
+ required 9-storage-buffer trace limit from capable WebGPU adapters before
110
+ creating the mesh-BVH trace pipeline.
111
+ - Fixed the WebGPU hit-buffer stride to match the WGSL `HitRecord` layout
112
+ and added a continuation-queue capacity guard, preventing tile-row
113
+ corruption in mesh BVH wavefront renders.
114
+
115
+ - **Security**
116
+ - (placeholder)
117
+
41
118
  ## [0.1.12] - 2026-05-13
42
119
 
43
120
  - **Added**
@@ -209,4 +286,5 @@ All notable changes to this project will be documented in this file.
209
286
  [0.1.10]: https://github.com/Plasius-LTD/gpu-renderer/releases/tag/v0.1.10
210
287
  [0.1.11]: https://github.com/Plasius-LTD/gpu-renderer/releases/tag/v0.1.11
211
288
  [0.1.12]: https://github.com/Plasius-LTD/gpu-renderer/releases/tag/v0.1.12
212
- [0.1.13]: https://github.com/Plasius-LTD/gpu-renderer/releases/tag/v0.1.13
289
+ [0.1.14]: https://github.com/Plasius-LTD/gpu-renderer/releases/tag/v0.1.14
290
+ [0.1.15]: https://github.com/Plasius-LTD/gpu-renderer/releases/tag/v0.1.15
package/README.md CHANGED
@@ -106,6 +106,117 @@ performance packages. It now also exposes the renderer-owned wavefront queue
106
106
  model, versioned ray/hit/surface/material/medium/accumulation contracts, and
107
107
  the termination policy for emissive/environment path completion.
108
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
+ For static mesh scenes, the GPU acceleration build is submitted once and then
204
+ reused by subsequent frames. Per-frame tracing writes one dynamic uniform slot
205
+ per tile/sample or post-process pass and batches tile tracing, tile output,
206
+ optional denoise, and presentation into a single command submission. WebGPU
207
+ still preserves ordering between dependent bounce passes, but the renderer no
208
+ longer forces one CPU queue submission per tile/sample.
209
+ Environment-light portals can additionally guide and gate sky/HDRI contribution
210
+ through rectangular openings such as windows. `environmentPortalMode: "guide"`
211
+ biases diffuse continuation rays toward configured openings, while
212
+ `"guide-and-gate"` requires an environment miss to pass through a portal before
213
+ it receives sky radiance; misses outside a portal fall back to the ambient
214
+ residual. This keeps interior rooms from treating the whole sky as visible from
215
+ every bounce.
216
+ Texture sampling, dynamic TLAS updates, higher-grade LBVH/SAH construction,
217
+ runtime execution behind the `@plasius/gpu-worker` lock-free queue, and broader
218
+ material lookup remain follow-up work.
219
+
109
220
  ## XR integration
110
221
 
111
222
  ```js
@@ -129,6 +240,17 @@ renderer.bindXrManager(xr, {
129
240
  - `getRendererWorkerProfile(name?)`
130
241
  - `getRendererWorkerManifest(name?)`
131
242
  - `createRayTracingRenderPlan(options)`
243
+ - `createWavefrontPathTracingComputeRenderer(options)`
244
+ - `createWavefrontPathTracingComputeConfig(options)`
245
+ - `normalizeWavefrontMesh(input)`
246
+ - `createWavefrontGpuMeshSource(meshes)`
247
+ - `createWavefrontBvhSortStages(itemCount)`
248
+ - `createWavefrontBvhBuildLevels(triangleCount)`
249
+ - `createWavefrontMeshAcceleration(meshes)`
250
+ - `normalizeWavefrontSceneObject(input)`
251
+ - `packWavefrontSceneObjects(sceneObjects, capacity?)`
252
+ - `packWavefrontTriangles(triangles, capacity?)`
253
+ - `packWavefrontBvhNodes(nodes, capacity?)`
132
254
  - `bindRendererToXrManager(renderer, xrManager, options)`
133
255
  - `defaultRendererClearColor`
134
256
  - `rendererDebugOwner`
@@ -149,8 +271,11 @@ npm run demo
149
271
 
150
272
  Then open `http://localhost:8000/gpu-renderer/demo/`.
151
273
 
152
- The demo now reports explicit canvas state so it is clear whether the renderer
153
- is mounted, idle, running, or blocked by secure-context / WebGPU support.
274
+ The demo now mounts the mesh BVH WebGPU wavefront renderer directly and passes a
275
+ `@plasius/gpu-lighting` environment preset into the render. It reports the
276
+ active wavefront depth, tile count, triangle/BVH counts, lighting preset, probe
277
+ luminance, and hot buffer memory so it is clear whether the renderer is tracing
278
+ mesh paths rather than only showing planning metadata.
154
279
 
155
280
  ## Development Checks
156
281