three-gpu-pathtracer 0.0.24 → 0.0.25

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.
Files changed (73) hide show
  1. package/README.md +53 -530
  2. package/build/index.module.js +262 -50
  3. package/build/index.module.js.map +1 -1
  4. package/build/index.umd.cjs +261 -48
  5. package/build/index.umd.cjs.map +1 -1
  6. package/package.json +28 -11
  7. package/src/core/WebGLPathTracer.js +8 -0
  8. package/src/core/utils/sceneUpdateUtils.js +8 -12
  9. package/src/detectors/PrecisionMaterial.js +9 -9
  10. package/src/index.js +1 -0
  11. package/src/objects/PhysicalSpotLight.js +2 -0
  12. package/src/shader/bsdf/bsdf_functions.glsl.js +0 -1
  13. package/src/textures/BlueNoiseTexture.js +6 -6
  14. package/src/textures/ProceduralEquirectTexture.js +8 -7
  15. package/src/textures/turquinMetal.png +0 -0
  16. package/src/uniforms/EquirectHdrInfoUniform.js +9 -4
  17. package/src/uniforms/FloatAttributeTextureArray.js +11 -11
  18. package/src/uniforms/MaterialsTexture.js +9 -9
  19. package/src/webgpu/API.md +762 -0
  20. package/src/webgpu/AtlasTexture.js +471 -0
  21. package/src/webgpu/BlurredEnvMapGenerator.js +129 -0
  22. package/src/webgpu/EquirectBackgroundInfo.js +97 -0
  23. package/src/webgpu/EquirectHdrInfoNode.js +151 -0
  24. package/src/webgpu/LightsInfoNode.js +224 -0
  25. package/src/webgpu/MegaKernelPathTracer.js +277 -0
  26. package/src/webgpu/PathTracerBackend.js +216 -0
  27. package/src/webgpu/TurquinTexture.js +169 -0
  28. package/src/webgpu/WaveFrontPathTracer.js +586 -0
  29. package/src/webgpu/WebGPUPathTracer.js +1302 -0
  30. package/src/webgpu/compute/ComputeKernel.js +92 -0
  31. package/src/webgpu/compute/CopyBufferKernel.js +40 -0
  32. package/src/webgpu/compute/PathTracerMegaKernel.js +470 -0
  33. package/src/webgpu/compute/SampleDebugKernel.js +51 -0
  34. package/src/webgpu/compute/TallySampleCountsKernel.js +111 -0
  35. package/src/webgpu/compute/ZeroOutBufferKernel.js +35 -0
  36. package/src/webgpu/compute/ZeroOutKernel.js +31 -0
  37. package/src/webgpu/compute/wavefront/LogicKernel.js +349 -0
  38. package/src/webgpu/compute/wavefront/MaterialKernel.js +371 -0
  39. package/src/webgpu/compute/wavefront/PopulatePixelIndicesKernel.js +72 -0
  40. package/src/webgpu/compute/wavefront/QueueLengthToDispatchKernel.js +38 -0
  41. package/src/webgpu/compute/wavefront/ResetSlotsKernel.js +66 -0
  42. package/src/webgpu/compute/wavefront/TraceRayKernel.js +71 -0
  43. package/src/webgpu/compute/wavefront/TraceShadowRayKernel.js +67 -0
  44. package/src/webgpu/compute/wavefront/structs.js +155 -0
  45. package/src/webgpu/constants.js +62 -0
  46. package/src/webgpu/denoise/OIDNDenoiser.js +431 -0
  47. package/src/webgpu/index.d.ts +176 -0
  48. package/src/webgpu/index.js +11 -0
  49. package/src/webgpu/materials/GltfCompliantMaterial.js +608 -0
  50. package/src/webgpu/materials/GraphMaterial.js +331 -0
  51. package/src/webgpu/materials/PathtracingMaterial.js +89 -0
  52. package/src/webgpu/materials/RenderToScreenMaterial.js +150 -0
  53. package/src/webgpu/materials/debug/AtlasDebugMaterial.js +41 -0
  54. package/src/webgpu/materials/debug/SampleDensityMaterial.js +61 -0
  55. package/src/webgpu/nodes/PathtracerBVHComputeData.js +1037 -0
  56. package/src/webgpu/nodes/debugBounds.wgsl.js +228 -0
  57. package/src/webgpu/nodes/eon.wgsl.js +262 -0
  58. package/src/webgpu/nodes/ggx.wgsl.js +190 -0
  59. package/src/webgpu/nodes/lights.wgsl.js +203 -0
  60. package/src/webgpu/nodes/material.wgsl.js +990 -0
  61. package/src/webgpu/nodes/rand/bluedither.wgsl.js +92 -0
  62. package/src/webgpu/nodes/rand/pcg.wgsl.js +81 -0
  63. package/src/webgpu/nodes/rand/sobol.wgsl.js +287 -0
  64. package/src/webgpu/nodes/random.wgsl.js +20 -0
  65. package/src/webgpu/nodes/reset.wgsl.js +21 -0
  66. package/src/webgpu/nodes/sampling.wgsl.js +193 -0
  67. package/src/webgpu/nodes/sheen.wgsl.js +148 -0
  68. package/src/webgpu/nodes/structs.wgsl.js +272 -0
  69. package/src/webgpu/nodes/utils.wgsl.js +366 -0
  70. package/src/webgpu/shims/ArrayCameraShim.js +74 -0
  71. package/src/webgpu/shims/EquirectCameraShim.js +37 -0
  72. package/src/webgpu/shims/PhysicalCameraShim.js +151 -0
  73. package/src/webgpu/upscale/FSRUpscaler.js +108 -0
package/README.md CHANGED
@@ -6,88 +6,69 @@
6
6
  [![twitter](https://flat.badgen.net/badge/twitter/@garrettkjohnson/?icon&label)](https://twitter.com/garrettkjohnson)
7
7
  [![sponsors](https://img.shields.io/github/sponsors/gkjohnson?style=flat-square&color=1da1f2)](https://github.com/sponsors/gkjohnson/)
8
8
 
9
- ![](https://user-images.githubusercontent.com/734200/162287477-96696b18-890b-4c1b-8a73-d662e577cc48.png)
9
+ ![](./docs/banner.webp)
10
10
 
11
- Path tracing project using [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh) and WebGL 2 to accelerate high quality, physically based rendering on the GPU. Features include support for GGX surface model, material information, textures, normal maps, emission, environment maps, tiled rendering, and more!
12
-
13
- _More features and capabilities in progress!_
11
+ Path tracing project using [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh) and WebGPU compute shaders to accelerate high quality, physically based rendering on the GPU.
14
12
 
15
13
  # Examples
16
14
 
17
- [GLB Drag and Drop Viewer](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/viewer.html)
18
-
19
15
  **Setup**
20
16
 
21
- [Basic glTF Setup Example](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/basic.html)
17
+ [Basic glTF Setup Example](https://gkjohnson.github.io/three-gpu-pathtracer/basic.html)
22
18
 
23
- [Basic Primitive Geometry Example](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/primitives.html)
19
+ [Basic Primitive Geometry Example](https://gkjohnson.github.io/three-gpu-pathtracer/primitives.html)
24
20
 
25
21
  **Beauty Demos**
26
22
 
27
- [Physically Based Materials](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/index.html)
28
-
29
- [Lego Models](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/lego.html)
23
+ [Physically Based Materials](https://gkjohnson.github.io/three-gpu-pathtracer/index.html)
30
24
 
31
- [Interior Scene w/ Equirect Rendering](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/interior.html)
25
+ [Interior Scene w/ Equirect Rendering](https://gkjohnson.github.io/three-gpu-pathtracer/equirect.html)
32
26
 
33
- [Depth of Field](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/depthOfField.html)
27
+ [Depth of Field](https://gkjohnson.github.io/three-gpu-pathtracer/depthOfField.html)
34
28
 
35
- [HDR Image](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/hdr.html)
29
+ [HDR Image](https://gkjohnson.github.io/three-gpu-pathtracer/hdr.html)
36
30
 
37
31
  **Features**
38
32
 
39
- [Skinned Geometry Support](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/skinnedMesh.html)
40
-
41
- [Morph Target Support](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/skinnedMesh.html#morphtarget)
42
-
43
- [Area Light Support](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/areaLight.html)
33
+ [Area Light Support](https://gkjohnson.github.io/three-gpu-pathtracer/areaLight.html)
44
34
 
45
- [Spot Light Support](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/spotLights.html)
35
+ [Spot Light Support](https://gkjohnson.github.io/three-gpu-pathtracer/spotLights.html)
46
36
 
47
- [Volumetric Fog Support](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/fog.html)
37
+ [Denoising and Upscaling](https://gkjohnson.github.io/three-gpu-pathtracer/denoise.html)
48
38
 
49
39
  **Test Scenes**
50
40
 
51
- [Material Test Orb](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/materialBall.html)
41
+ [Material Test Orb](https://gkjohnson.github.io/three-gpu-pathtracer/materialOrb.html)
52
42
 
53
- [Transmission Preset Orb](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/materialBall.html#transmission)
54
-
55
- [Model Viewer Fidelity Scene Comparisons](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/viewerTest.html)
56
-
57
- [Physical Material Database](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/materialDatabase.html)
43
+ [Model Viewer Fidelity Scene Comparisons](https://gkjohnson.github.io/three-gpu-pathtracer/viewerTest.html)
58
44
 
59
45
  **Tools**
60
46
 
61
- [Animation Rendering](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/renderVideo.html)
62
-
63
- [Ambient Occlusion Material](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/aoRender.html)
47
+ [Animation Rendering](https://gkjohnson.github.io/three-gpu-pathtracer/renderVideo.html)
64
48
 
65
49
  ## Running examples locally
66
50
 
67
- To run and modify the examples locally, make sure you have Node and NPM installed. Check the supported versions in [the test configuration](./.github/workflows/node.js.yml).
68
-
69
- In order to install dependencies, you will need `make` and a C++ compiler available.
70
-
71
- On Debian or Ubuntu, run `sudo apt install build-essential`. It should just work on MacOS.
51
+ To run and modify the examples locally, make sure you have Node and NPM installed. Check the supported versions in [the test configuration](./.github/workflows/node.js.yml).
72
52
 
73
53
  - To install dependencies, run `npm install`
74
54
  - To start the demos run `npm start`
75
- - Visit `http://localhost:1234/<demo-name.html>`
55
+ - Visit `http://localhost:5173/<demo-name.html>`
76
56
 
77
57
  # Use
78
58
 
79
59
  **Basic Renderer**
80
60
 
81
61
  ```js
82
- import * as THREE from 'three';
83
- import { WebGLPathTracer } from 'three-gpu-pathtracer';
62
+ import * as THREE from 'three/webgpu';
63
+ import { WebGPUPathTracer } from 'three-gpu-pathtracer/webgpu';
84
64
 
85
65
  // init scene, camera, controls, etc
86
66
 
87
- renderer = new THREE.WebGLRenderer();
67
+ renderer = new THREE.WebGPURenderer();
88
68
  renderer.toneMapping = THREE.ACESFilmicToneMapping;
69
+ await renderer.init();
89
70
 
90
- pathTracer = new WebGLPathTracer( renderer );
71
+ pathTracer = new WebGPUPathTracer( renderer );
91
72
  pathTracer.setScene( scene, camera );
92
73
 
93
74
  animate();
@@ -102,544 +83,84 @@ function animate() {
102
83
 
103
84
  **Blurred Environment Map**
104
85
 
105
- Using a pre blurred envioronment map can help improve frame convergence time at the cost of sharp environment reflections. If performance is concern then multiple importance sampling can be disabled and blurred environment map used.
86
+ Using a pre blurred environment map can help improve frame convergence time at the cost of sharp environment reflections. If performance is a concern then multiple importance sampling can be disabled and a blurred environment map used.
106
87
 
107
88
  ```js
108
- import { BlurredEnvMapGenerator } from 'three-gpu-pathtracer';
89
+ import { BlurredEnvMapGenerator } from 'three-gpu-pathtracer/webgpu';
109
90
 
110
91
  // ...
111
92
 
112
- const envMap = await new HDRLoader().setDataType( THREE.FloatType ).loadAsync( envMapUrl );
93
+ const envMap = await new HDRLoader().loadAsync( envMapUrl );
113
94
  const generator = new BlurredEnvMapGenerator( renderer );
114
- const blurredEnvMap = generator.generate( envMap, 0.35 );
115
-
116
- // render!
117
-
118
- ```
119
-
120
- # Exports
121
-
122
- ## WebGLPathTracer
123
-
124
- ### constructor
125
-
126
- ```
127
- constructor( renderer : WebGLRenderer )
128
- ```
129
-
130
- ### .bounces
131
-
132
- ```js
133
- bounces = 10 : Number
134
- ```
135
-
136
- Max number of lights bounces to trace.
137
-
138
- ### .filterGlossyFactor
139
-
140
- ```js
141
- filterGlossyFactor = 0 : Number
142
- ```
143
-
144
- Factor for alleviating bright pixels from rays that hit diffuse surfaces then specular surfaces. Setting this higher alleviates fireflies but will remove some specular caustics.
145
-
146
- ### .tiles
147
-
148
- ```js
149
- tiles = ( 3, 3 ) : Vector2
150
- ```
151
-
152
- Number of tiles on x and y to render to. Can be used to improve the responsiveness of a page while still rendering a high resolution target.
153
-
154
- ### .renderDelay
155
-
156
- ```js
157
- renderDelay = 100 : Number
158
- ```
159
-
160
- Number of milliseconds to delay rendering samples after the path tracer has been reset.
161
-
162
- ### .fadeDuration
163
-
164
- ```js
165
- fadeDuration = 500 : Number
166
- ```
167
-
168
- How long to take to fade the fully path traced scene in in milliseconds wen rendering to the canvas.
169
-
170
- ### .minSamples
171
-
172
- ```js
173
- minSamples = 5 : Number
174
- ```
175
-
176
- How many samples to render before displaying to the canvas.
177
-
178
- ### .dynamicLowRes
179
-
180
- ```js
181
- dynamicLowRes = false : Boolean
182
- ```
183
-
184
- Whether to render an extra low resolution of the scene while the full resolution renders. The scale is defined by `lowResScale`.
185
-
186
- ### .lowResScale
187
-
188
- ```js
189
- lowResScale = 0.1 : Number
190
- ```
191
-
192
- The scale to render the low resolution pass at.
193
-
194
- ### .synchronizeRenderSize
195
-
196
- ```js
197
- synchronizeRenderSize = true : Boolean
198
- ```
199
-
200
- Whether to automatically update the sie of the path traced buffer when the canvas size changes.
201
-
202
- ### .renderScale
203
-
204
- ```js
205
- renderScale = 1 : Number
206
- ```
207
-
208
- The scale to render the path traced image at. Only relevant if `synchronizeRenderSize` is true.
209
-
210
- ### .renderToCanvas
211
-
212
- ```js
213
- renderToCanvas = true : Boolean
214
- ```
215
-
216
- Whether to automatically render the path traced buffer to the canvas when `renderSample` is called.
217
-
218
- ### .rasterizeScene
219
-
220
- ```js
221
- rasterizeScene = true : Boolean
222
- ```
223
-
224
- Whether to automatically rasterize the scene with the three.js renderer while the path traced buffer is rendering.
225
-
226
- ### .textureSize
227
-
228
- ```js
229
- textureSize = ( 1024, 1024 ) : Vector2
230
- ```
231
-
232
- The dimensions to expand or shrink all textures to so all scene textures can be packed into a single texture array.
233
-
234
- ### .samples
235
-
236
- ```js
237
- readonly samples : Number
238
- ```
239
-
240
- The number of samples that have been rendered.
241
-
242
- ### .target
243
-
244
- ```js
245
- readonly target : WebGLRenderTarget
246
- ```
247
-
248
- The path traced render target. This potentially changes every call to `renderSample`.
249
-
250
- ### .setScene
251
-
252
- ```js
253
- setScene( scene : Scene, camera : Camera ) : void
254
- ```
255
-
256
- Sets the scene and camera to render. Must be called again when the camera object changes, the geometry in the scene changes, or new materials are assigned.
257
-
258
- While only changed data is updated it is still a relatively expensive function. Prefer to use the other "update" functions where possible.
259
-
260
- ### .setSceneAsync
261
-
262
- ```js
263
- setSceneAsync(
264
- scene : Scene,
265
- camera : Camera,
266
- options = {
267
- onProgress = null : value => void,
268
- } : Object
269
- ) : void
270
- ```
271
-
272
- Asynchronous version of `setScene`. Requires calling `setBVHWorker` first.
273
-
274
- ### .updateCamera
275
-
276
- ```js
277
- updateCamera() : void
278
- ```
279
-
280
- Updates the camera parameters. Must be called if any of the parameters on the previously set camera change.
281
-
282
- ### .updateMaterials
283
-
284
- ```js
285
- updateMaterials() : void
286
- ```
287
-
288
- Updates the material properties. Must be called when properties change for any materials already being used.
289
-
290
- Note that materials used with WebGLPathTracer support the following additional properties:
291
-
292
- ```js
293
- // Whether to render the object as completely transparent against the rest
294
- // of the environment so other objects can be composited later
295
- matte = false : Boolean;
296
-
297
- // Whether the object should cast a shadow
298
- castShadow = true : Boolean;
299
- ```
300
-
301
- ### .updateEnvironment
302
-
303
- ```js
304
- updateEnvironment() : void
305
- ```
306
-
307
- Updates lighting from the scene environment and background properties. Must be called if any associated scene settings change on the set scene object.
308
-
309
- ### .updateLights
310
-
311
- ```js
312
- updateLights() : void
313
- ```
314
-
315
- Updates lights used in path tracing. Must be called if any lights are added or removed or properties change.
316
-
317
- ### .renderSample
318
-
319
- ```js
320
- renderSample() : void
321
- ```
322
-
323
- Render a single sample to the path tracer target. If `renderToCanvas` is true then the image is rendered to the canvas.
324
-
325
- ### .reset
326
-
327
- ```js
328
- reset() : void
329
- ```
330
-
331
- Restart the rendering.
332
-
333
- ### .dispose
334
-
335
- ```js
336
- dispose() : void
337
- ```
95
+ const blurredEnvMap = await generator.generate( envMap, 0.35 );
96
+ generator.dispose();
338
97
 
339
- Dispose the path tracer assets. Any materials or textures used must be disposed separately.
98
+ scene.environment = blurredEnvMap;
340
99
 
341
- ## PhysicalCamera
342
-
343
- _extends THREE.PerspectiveCamera_
344
-
345
- An extension of the three.js PerspectiveCamera with some other parameters associated with depth of field. These parameters otherwise do not affect the camera behavior are are for convenience of use with the PhysicalCameraUniform and pathtracer.
346
-
347
- ### .focusDistance
348
-
349
- ```js
350
- focusDistance = 25 : Number
351
- ```
352
-
353
- The distance from the camera in meters that everything is is perfect focus.
354
-
355
- ### .fStop
356
-
357
- ```js
358
- fStop = 1.4 : Number
359
- ```
360
-
361
- The fstop value of the camera. If this is changed then the `bokehSize` field is implicitly updated.
362
-
363
- ### .bokehSize
364
-
365
- ```js
366
- bokehSize : Number
367
- ```
368
-
369
- The bokeh size as derived from the fStop and focal length in millimeters. If this is set then the fStop is implicitly updated.
370
-
371
- ### .apertureBlades
372
-
373
- ```js
374
- apertureBlades = 0 : Number
375
- ```
376
-
377
- The number of sides / blades on the aperture.
378
-
379
- ### .apertureRotation
380
-
381
- ```js
382
- apertureRotation = 0 : Number
383
- ```
384
-
385
- The rotation of the aperture shape in radians.
386
-
387
- ### .anamorphicRatio
388
-
389
- ```js
390
- anamorphicRatio = 1 : Number
391
- ```
392
-
393
- The anamorphic ratio of the lens. A higher value will stretch the bokeh effect horizontally.
394
-
395
- ## EquirectCamera
396
-
397
- _extends THREE.Camera_
398
-
399
- A class indicating that the path tracer should render an equirectangular view. Does not work with three.js raster rendering.
400
-
401
- ## PhysicalSpotLight
402
-
403
- _extends THREE.SpotLight_
404
-
405
- ### .radius
406
-
407
- ```js
408
- radius = 0 : Number
409
- ```
410
-
411
- The radius of the spotlight surface. Increase this value to add softness to shadows.
412
-
413
- ### .iesMap
414
-
415
- ```js
416
- iesMap = null : Texture
417
- ```
418
-
419
- The loaded IES texture describing directional light intensity. These can be loaded with the `IESLoader`.
420
-
421
- Premade IES profiles can be downloaded from [ieslibrary.com]. And custom profiles can be generated using [CNDL](https://cndl.io/).
422
-
423
- ## ShapedAreaLight
424
-
425
- _extends THREE.RectAreaLight_
426
-
427
- ### .isCircular
428
-
429
- ```js
430
- isCircular = false : Boolean
431
- ```
432
-
433
- Whether the area light should be rendered as a circle or a rectangle.
434
-
435
- ## IESLoader
436
-
437
- _extends Loader_
438
-
439
- Loader for loading and parsing IES profile data. Load and parse functions return a `DataTexture` with the profile contents.
440
-
441
- ## BlurredEnvMapGenerator
442
-
443
- Utility for generating a PMREM blurred environment map that can be used with the path tracer.
444
-
445
- ### constructor
446
-
447
- ```js
448
- constructor( renderer : WebGLRenderer )
449
- ```
450
-
451
- ### .generate
452
-
453
- ```js
454
- generate( texture : Texture, blur : Number ) : DataTexture
455
- ```
456
-
457
- Takes a texture to blur and the amount to blur it. Returns a new `DataTexture` that has been PMREM blurred environment map that can have distribution data generated for importance sampling.
458
-
459
- ### .dispose
460
-
461
- ```js
462
- dispose() : void
463
- ```
464
-
465
- Disposes of the temporary files and textures for generation.
466
-
467
- ## GradientEquirectTexture
468
-
469
- ### .exponent
470
-
471
- ```js
472
- exponent = 2 : Number
473
- ```
474
-
475
- ### .topColor
476
-
477
- ```js
478
- topColor = 0xffffff : Color
479
- ```
480
-
481
- ### .bottomColor
482
-
483
- ```js
484
- bottomColor = 0x000000 : Color
485
- ```
486
-
487
- ### constructor
488
-
489
- ```js
490
- constructor( resolution = 512 : Number )
491
- ```
492
-
493
- ### .update
494
-
495
- ```js
496
- update() : void
497
- ```
498
-
499
- ## MaterialBase
500
-
501
- _extends THREE.ShaderMaterial_
502
-
503
- Convenience base class that adds additional functions and implicitly adds object definitions for all uniforms of the shader to the object.
504
-
505
- ### .setDefine
506
-
507
- ```js
508
- setDefine( name : string, value = undefined : any ) : void
509
- ```
510
-
511
- Sets the define of the given name to the provided value. If the value is set to null or undefined then it is deleted from the defines of the material. If the define changed from the previous value then `Material.needsUpdate` is set to `true`.
512
-
513
- ## FogVolumeMaterial
514
-
515
- _extends MeshStandardMaterial_
516
-
517
- A material used for rendering fog-like volumes within the scene. The `color`, `emissive`, and `emissiveIntensity` fields are all used in the render.
518
-
519
- > *NOTE*
520
- > Since fog models many particles throughout the scene and cause many extra bounces fog materials can dramatically impact render time.
521
-
522
- ### .density
523
-
524
- The particulate density of the volume.
525
-
526
- ## DenoiseMaterial
527
-
528
- _extends MaterialBase_
529
-
530
- Denoise material based on [BrutPitt/glslSmartDeNoise](https://github.com/BrutPitt/glslSmartDeNoise) intended to be the final pass to the screen. Includes tonemapping and color space conversions.
531
-
532
- **Uniforms**
533
-
534
- ```js
535
- {
536
-
537
- // sigma - sigma Standard Deviation
538
- // kSigma - sigma coefficient
539
- // kSigma * sigma = radius of the circular kernel
540
- sigma = 5.0 : Number,
541
- kSigma = 1.0 : Number,
542
-
543
- // edge sharpening threshold
544
- threshold = 0.03 : Number,
545
-
546
- }
547
- ```
548
- <!--
549
-
550
- ## CompatibilityDetector
551
-
552
- Detects whether the path tracer can run on the current device by checking whether struct precision is reliable and the material shader will compile.
553
-
554
- ### constructor
555
-
556
- ```js
557
- constructor( renderer : WebGLRenderer, material : Material )
558
- ```
559
-
560
- Takes a WebGLRenderer to use and material to test again.
561
-
562
- ### .detect
100
+ // render!
563
101
 
564
- ```js
565
- detect() : {
566
- pass: Boolean,
567
- message: String
568
- }
569
102
  ```
570
103
 
571
- Returns `pass === true` if the path tracer can run. If it cannot run then a message is returned indicating why.
104
+ # API
572
105
 
573
- -->
106
+ See [API.md](./src/webgpu/API.md) for the WebGPU API documentation.
574
107
 
575
108
  # Gotchas
576
109
 
577
- - The project requires use of WebGL2.
578
- - All textures must use the same wrap and interpolation flags.
110
+ - The project requires WebGPU.
579
111
  - SpotLights, DirectionalLights, and PointLights are only supported with MIS.
580
112
  - Only MeshStandardMaterial and MeshPhysicalMaterial are supported.
581
- - Instanced geometry and interleaved buffers are not supported.
582
113
  - Emissive materials are supported but do not take advantage of MIS.
114
+ - "Upscaling" does not currently work with a transparent background.
583
115
 
584
116
  # Screenshots
585
117
 
586
- ![](https://user-images.githubusercontent.com/734200/162584469-68e6df38-92da-4a13-b352-ca0bdea14548.png)
587
-
588
118
  <p align="center">
589
- <i>Sample materials</i>
119
+ <img src="./docs/rover.webp" />
590
120
  </p>
591
121
 
592
- ![](https://user-images.githubusercontent.com/734200/163835927-be75d2c0-f27b-4e4b-a3eb-2371043fa5e1.png)
593
-
594
- ![](https://user-images.githubusercontent.com/734200/163839431-ed75e64d-9ae4-4423-afca-55162a44873e.png)
595
-
596
122
  <p align="center">
597
- <i>"SD Macross City Standoff Diorama" scene by <a href="https://sketchfab.com/3d-models/sd-macross-city-standoff-diorama-b154220f7e7441799d6be2f7ff9658c7">tipatat</a></i>
123
+ <img src="./docs/lit-stairway.webp" />
598
124
  </p>
599
125
 
600
- ![](./docs/interior-scene-cropped.png)
601
-
602
126
  <p align="center">
603
- <i>"Interior Scene" model by <a href="https://sketchfab.com/3d-models/interior-scene-45ddbbc4c2dc4f8ca9ed99da9a78326a">Allay Design</a></i>
127
+ <img src="./docs/kitchen.webp" />
604
128
  </p>
605
129
 
606
- ![](https://user-images.githubusercontent.com/734200/161820794-df0da371-ee5c-4368-9e7b-5e7daf6cf3c7.png)
607
-
608
- ![](https://user-images.githubusercontent.com/734200/162550315-3cdabf40-3dea-4d7d-bcfc-eb543eea2d93.png)
609
-
610
130
  <p align="center">
611
- <i>Perseverance Rover, Ingenuity Helicopter models by <a href="https://mars.nasa.gov/resources/25042/mars-perseverance-rover-3d-model/">NASA / JPL-Caltech</a></i>
131
+ <img src="./docs/tropical-island.webp" />
612
132
  </p>
613
133
 
614
- ![](https://user-images.githubusercontent.com/734200/161877900-566652e4-c799-4940-bccb-0c8f4cea5387.png)
615
-
616
134
  <p align="center">
617
- <i>Gelatinous Cube model by <a href="https://sketchfab.com/3d-models/gelatinous-cube-e08385238f4d4b59b012233a9fbdca21">glenatron</a></i>
135
+ <img src="./docs/coffee-maker.webp" />
618
136
  </p>
619
137
 
620
- ![](https://user-images.githubusercontent.com/734200/161822206-c27bf594-d648-4735-868e-4baf4e414802.png)
138
+ <p align="center">
139
+ <img src="./docs/porsche.webp" />
140
+ </p>
621
141
 
622
- ![](https://user-images.githubusercontent.com/734200/161822214-eace4297-03c4-4adc-b472-efe29a862685.png)
142
+ <p align="center">
143
+ <img src="./docs/insight.webp" />
144
+ </p>
623
145
 
624
146
  <p align="center">
625
- <i>Lego models courtesy of the <a href="https://omr.ldraw.org/">LDraw Official Model Repository</a></i>
147
+ <img src="./docs/apollo-lego.webp" />
626
148
  </p>
627
149
 
628
- ![](https://user-images.githubusercontent.com/734200/161877196-7ae2769e-7e54-4694-9ca8-e8f5219d1c2d.png)
150
+ <p align="center">
151
+ <img src="./docs/stormtroopers.webp" />
152
+ </p>
629
153
 
630
154
  <p align="center">
631
- <i>Octopus Tea model by <a href="https://sketchfab.com/3d-models/cartoon-octopus-takes-a-tea-bath-107260cf0fd24202a67eb037a6c760a5
632
- ">AzTiZ</a></i>
155
+ <img src="./docs/tea-set.webp" />
633
156
  </p>
634
157
 
635
- ![](https://user-images.githubusercontent.com/734200/173212652-de6a83e5-dd2c-49b5-8ed7-484ff8969b5b.png)
636
158
  <p align="center">
637
- <i>Botanists Study model by <a href="https://sketchfab.com/3d-models/the-botanists-study-8b7b5743b1c848ed8ea58f5518c44e7e">riikkakilpelainen</a></i>
159
+ <img src="./docs/octopus-tea.webp" />
638
160
  </p>
639
161
 
640
- ![](https://user-images.githubusercontent.com/734200/173170459-849b9343-efe3-4635-8719-346511472965.png)
641
162
  <p align="center">
642
- <i>Japanese Bridge Garden model by <a href="https://sketchfab.com/3d-models/japanese-bridge-garden-d122e17593eb4012913cde927486d15a">kristenlee</a></i>
163
+ <img src="./docs/sasha-ring.webp" />
643
164
  </p>
644
165
 
645
166
  ### Resources
@@ -650,6 +171,8 @@ Returns `pass === true` if the path tracer can run. If it cannot run then a mess
650
171
 
651
172
  [knightcrawler25/GLSL-PathTracer](https://github.com/knightcrawler25/GLSL-PathTracer/)
652
173
 
653
- [DassaultSystemes-Technology/dspbr-pt](https://github.com/DassaultSystemes-Technology/dspbr-pt)
174
+ [blender/cycles](https://github.com/blender/cycles)
175
+
176
+ [AcademySoftwareFoundation/OpenPBR](https://github.com/AcademySoftwareFoundation/OpenPBR)
654
177
 
655
178