three-gpu-pathtracer 0.0.11 → 0.0.13
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/README.md +81 -6
- package/build/index.module.js +502 -125
- package/build/index.module.js.map +1 -1
- package/build/index.umd.cjs +501 -123
- package/build/index.umd.cjs.map +1 -1
- package/package.json +6 -2
- package/src/core/PathTracingRenderer.js +86 -15
- package/src/core/PathTracingSceneGenerator.js +1 -1
- package/src/core/QuiltPathTracingRenderer.js +223 -0
- package/src/index.js +1 -0
- package/src/materials/PhysicalPathTracingMaterial.js +80 -49
- package/src/shader/shaderBvhAnyHit.js +76 -0
- package/src/shader/shaderIridescenceFunctions.js +7 -2
- package/src/shader/shaderMaterialSampling.js +59 -47
- package/src/shader/shaderStructs.js +2 -0
- package/src/shader/shaderUtils.js +16 -0
- package/src/uniforms/EquirectHdrInfoUniform.js +20 -6
- package/src/uniforms/LightsInfoUniformStruct.js +9 -4
- package/src/uniforms/MaterialsTexture.js +1 -1
package/README.md
CHANGED
|
@@ -54,6 +54,9 @@ _More features and capabilities in progress!_
|
|
|
54
54
|
|
|
55
55
|
[Ambient Occlusion Material](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/aoRender.html)
|
|
56
56
|
|
|
57
|
+
[Looking Glass Portrait Quilt Render](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/lkg.html)
|
|
58
|
+
|
|
59
|
+
|
|
57
60
|
## Running examples locally
|
|
58
61
|
|
|
59
62
|
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).
|
|
@@ -222,6 +225,9 @@ readonly target : WebGLRenderTarget
|
|
|
222
225
|
|
|
223
226
|
The target being rendered to. The size of the target is updated with `setSize` and is initialized to a FloatType texture.
|
|
224
227
|
|
|
228
|
+
> **Note**
|
|
229
|
+
> Target will swap render targets after every full sample when alpha is enabled.
|
|
230
|
+
|
|
225
231
|
### .camera
|
|
226
232
|
|
|
227
233
|
```js
|
|
@@ -271,7 +277,7 @@ alpha = false : Boolean
|
|
|
271
277
|
Whether to support rendering scenes with transparent backgrounds. When transparent backgrounds are used two extra render targets are used, custom blending is performed, and PathTracingRenderer.target will change on every completed sample.
|
|
272
278
|
|
|
273
279
|
> **Note**
|
|
274
|
-
> When a transparent background is used
|
|
280
|
+
> When a transparent background is used the material used for the final render to the canvas must use the same "premultipliedAlpha" setting as the canvas otherwise the final image may look incorrect.
|
|
275
281
|
|
|
276
282
|
### constructor
|
|
277
283
|
|
|
@@ -303,6 +309,68 @@ reset() : void
|
|
|
303
309
|
|
|
304
310
|
Resets and restarts the render from scratch.
|
|
305
311
|
|
|
312
|
+
## QuiltPathTracingRenderer
|
|
313
|
+
|
|
314
|
+
Renderer that supports rendering to a quilt renderer to rendering on displays such as the Looking Glass display.
|
|
315
|
+
|
|
316
|
+
### .viewCount
|
|
317
|
+
|
|
318
|
+
```js
|
|
319
|
+
viewCount = 48 : Number
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
The number of views to be rendered. If this is less than the product of the quiltDimensions then there will be gaps at the end of the quilt.
|
|
323
|
+
|
|
324
|
+
### .quiltDimensions
|
|
325
|
+
```js
|
|
326
|
+
quiltDimensions = Vector2( 8, 6 ) : Vector2
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
The number of quilt patches in each dimension.
|
|
330
|
+
|
|
331
|
+
### .viewCone
|
|
332
|
+
```js
|
|
333
|
+
viewCone = 35 * DEG2RAD : Number
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
The total angle sweep for the camera views rendered across the quilt.
|
|
337
|
+
|
|
338
|
+
### .viewFoV
|
|
339
|
+
|
|
340
|
+
```js
|
|
341
|
+
viewFoV = 14 * DEG2RAD : Number
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
The camera field of view to render.
|
|
345
|
+
|
|
346
|
+
### .displayDistance
|
|
347
|
+
|
|
348
|
+
```js
|
|
349
|
+
displayDistance = 1 : Number
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
The distance of the viewer to the display.
|
|
353
|
+
|
|
354
|
+
### .displayAspect
|
|
355
|
+
|
|
356
|
+
```js
|
|
357
|
+
displayAspect = 0.75 : Number
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
The aspect ratio of the display.
|
|
361
|
+
|
|
362
|
+
### .setFromDisplayView
|
|
363
|
+
|
|
364
|
+
```js
|
|
365
|
+
setFromDisplayView(
|
|
366
|
+
displayDistance : Number,
|
|
367
|
+
displayWidth : Number,
|
|
368
|
+
displayHeight : Number,
|
|
369
|
+
) : void
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Updates the `displayDistance`, `displayAspect`, and the `viewFoV` from viewer and display information.
|
|
373
|
+
|
|
306
374
|
## PathTracingSceneGenerator
|
|
307
375
|
|
|
308
376
|
Utility class for generating the set of data required for initializing the path tracing material with a bvh, geometry, materials, and textures.
|
|
@@ -505,7 +573,7 @@ dispose() : void
|
|
|
505
573
|
|
|
506
574
|
Disposes of the temporary files and textures for generation.
|
|
507
575
|
|
|
508
|
-
##
|
|
576
|
+
## GradientEquirectTexture
|
|
509
577
|
|
|
510
578
|
### .exponent
|
|
511
579
|
|
|
@@ -562,6 +630,9 @@ _extends MaterialBase_
|
|
|
562
630
|
// The number of ray bounces to test. Higher is better quality but slower performance.
|
|
563
631
|
bounces = 3 : Number,
|
|
564
632
|
|
|
633
|
+
// The number of additional transmissive ray bounces to allow on top of existing bounces for object opacity / transmission.
|
|
634
|
+
transmissiveBounces = 5 : Number,
|
|
635
|
+
|
|
565
636
|
// The physical camera parameters to use
|
|
566
637
|
physicalCamera : PhysicalCameraUniform,
|
|
567
638
|
|
|
@@ -603,11 +674,12 @@ _extends MaterialBase_
|
|
|
603
674
|
```js
|
|
604
675
|
{
|
|
605
676
|
|
|
606
|
-
// Whether to use multiple importance sampling to help the image converge more quickly
|
|
677
|
+
// Whether to use multiple importance sampling to help the image converge more quickly.
|
|
607
678
|
FEATURE_MIS = 1 : Number,
|
|
608
679
|
|
|
609
|
-
//
|
|
610
|
-
|
|
680
|
+
// Whether to use russian roulette path termination. Path termination will kick in after
|
|
681
|
+
// a minimum three bounces have been performed.
|
|
682
|
+
FEATURE_RUSSIAN_ROULETTE = 1 : Number,
|
|
611
683
|
|
|
612
684
|
}
|
|
613
685
|
```
|
|
@@ -812,7 +884,10 @@ Set of randomness and other light transport utilities for use in a shader. See t
|
|
|
812
884
|
|
|
813
885
|
- The project requires use of WebGL2.
|
|
814
886
|
- All textures must use the same wrap and interpolation flags.
|
|
815
|
-
-
|
|
887
|
+
- SpotLights, DirectionalLights, and PointLights are only supported with MIS.
|
|
888
|
+
- Only MeshStandardMaterial and MeshPhysicalMaterial are supported.
|
|
889
|
+
- Instanced geometry and interleaved buffers are not supported.
|
|
890
|
+
- Emissive materials are supported but do not take advantage of MIS.
|
|
816
891
|
|
|
817
892
|
# Screenshots
|
|
818
893
|
|