three-gpu-pathtracer 0.0.13 → 0.0.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/README.md +46 -3
- package/build/index.module.js +3107 -2141
- package/build/index.module.js.map +1 -1
- package/build/index.umd.cjs +3119 -2154
- package/build/index.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/core/PathTracingRenderer.js +1 -1
- package/src/detectors/CompatibilityDetector.js +38 -0
- package/src/detectors/MaterialCompileDetector.js +50 -0
- package/src/detectors/PrecisionDetector.js +85 -0
- package/src/detectors/PrecisionMaterial.js +160 -0
- package/src/index.js +7 -7
- package/src/materials/{GraphMaterial.js → debug/GraphMaterial.js} +1 -1
- package/src/materials/{AlphaDisplayMaterial.js → fullscreen/AlphaDisplayMaterial.js} +3 -1
- package/src/materials/{BlendMaterial.js → fullscreen/BlendMaterial.js} +1 -1
- package/src/materials/{DenoiseMaterial.js → fullscreen/DenoiseMaterial.js} +1 -1
- package/src/materials/fullscreen/GradientMapMaterial.js +82 -0
- package/src/materials/{LambertPathTracingMaterial.js → pathtracing/LambertPathTracingMaterial.js} +18 -7
- package/src/materials/pathtracing/PhysicalPathTracingMaterial.js +557 -0
- package/src/materials/pathtracing/glsl/attenuateHit.glsl.js +177 -0
- package/src/materials/pathtracing/glsl/cameraUtils.glsl.js +84 -0
- package/src/materials/pathtracing/glsl/directLightContribution.glsl.js +91 -0
- package/src/materials/pathtracing/glsl/getSurfaceRecord.glsl.js +323 -0
- package/src/materials/pathtracing/glsl/renderStructs.glsl.js +50 -0
- package/src/materials/pathtracing/glsl/traceScene.glsl.js +52 -0
- package/src/materials/{AmbientOcclusionMaterial.js → surface/AmbientOcclusionMaterial.js} +16 -8
- package/src/materials/surface/FogVolumeMaterial.js +23 -0
- package/src/objects/PhysicalCamera.js +14 -0
- package/src/objects/PhysicalSpotLight.js +11 -0
- package/src/objects/ShapedAreaLight.js +10 -0
- package/src/shader/bsdf/bsdfSampling.glsl.js +499 -0
- package/src/shader/bsdf/fog.glsl.js +22 -0
- package/src/shader/bsdf/ggx.glsl.js +102 -0
- package/src/shader/bsdf/iridescence.glsl.js +135 -0
- package/src/shader/bsdf/sheen.glsl.js +98 -0
- package/src/shader/{shaderLayerTexelFetchFunctions.js → common/arraySamplerTexelFetch.glsl.js} +1 -1
- package/src/shader/common/bvhAnyHit.glsl.js +76 -0
- package/src/shader/common/fresnel.glsl.js +98 -0
- package/src/shader/common/intersectShapes.glsl.js +62 -0
- package/src/shader/common/math.glsl.js +81 -0
- package/src/shader/common/utils.glsl.js +116 -0
- package/src/shader/{shaderRandFunctions.js → rand/pcg.glsl.js} +1 -1
- package/src/shader/{shaderSobolSampling.js → rand/sobol.glsl.js} +3 -3
- package/src/shader/sampling/equirectSampling.glsl.js +62 -0
- package/src/shader/sampling/lightSampling.glsl.js +223 -0
- package/src/shader/sampling/shapeSampling.glsl.js +86 -0
- package/src/shader/structs/cameraStruct.glsl.js +13 -0
- package/src/shader/structs/equirectStruct.glsl.js +13 -0
- package/src/shader/structs/fogMaterialBvh.glsl.js +62 -0
- package/src/shader/structs/lightsStruct.glsl.js +78 -0
- package/src/shader/{shaderStructs.js → structs/materialStruct.glsl.js} +3 -123
- package/src/uniforms/EquirectHdrInfoUniform.js +11 -15
- package/src/uniforms/MaterialsTexture.js +79 -2
- package/src/utils/BlurredEnvMapGenerator.js +2 -2
- package/src/utils/SobolNumberMapGenerator.js +3 -3
- package/src/utils/macroify.js +9 -0
- package/src/materials/PhysicalPathTracingMaterial.js +0 -1013
- package/src/shader/shaderBvhAnyHit.js +0 -76
- package/src/shader/shaderEnvMapSampling.js +0 -58
- package/src/shader/shaderGGXFunctions.js +0 -100
- package/src/shader/shaderIridescenceFunctions.js +0 -135
- package/src/shader/shaderLightSampling.js +0 -229
- package/src/shader/shaderMaterialSampling.js +0 -510
- package/src/shader/shaderSheenFunctions.js +0 -98
- package/src/shader/shaderUtils.js +0 -377
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/three-gpu-pathtracer)
|
|
4
4
|
[](https://github.com/gkjohnson/three-gpu-pathtracer/actions)
|
|
5
5
|
[](https://github.com/gkjohnson/three-gpu-pathtracer/)
|
|
6
|
-
[](https://twitter.com/garrettkjohnson)
|
|
7
7
|
[](https://github.com/sponsors/gkjohnson/)
|
|
8
8
|
|
|
9
9
|

|
|
@@ -38,6 +38,8 @@ _More features and capabilities in progress!_
|
|
|
38
38
|
|
|
39
39
|
[Spot Light Support](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/spotLights.html)
|
|
40
40
|
|
|
41
|
+
[Volumetric Fog Support](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/fog.html)
|
|
42
|
+
|
|
41
43
|
**Test Scenes**
|
|
42
44
|
|
|
43
45
|
[Material Test Orb](https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/materialBall.html)
|
|
@@ -130,7 +132,7 @@ ptMaterial.materials.updateFrom( materials, textures );
|
|
|
130
132
|
ptMaterial.lights.updateFrom( lights );
|
|
131
133
|
|
|
132
134
|
// set the environment map
|
|
133
|
-
const texture = await new RGBELoader().loadAsync( envMapUrl );
|
|
135
|
+
const texture = await new RGBELoader().setDataType( THREE.FloatType ).loadAsync( envMapUrl );
|
|
134
136
|
ptRenderer.material.envMapInfo.updateFrom( texture );
|
|
135
137
|
|
|
136
138
|
animate();
|
|
@@ -164,7 +166,7 @@ import { BlurredEnvMapGenerator } from 'three-gpu-pathtracer';
|
|
|
164
166
|
|
|
165
167
|
// ...
|
|
166
168
|
|
|
167
|
-
const envMap = await new RGBELoader().loadAsync( envMapUrl );
|
|
169
|
+
const envMap = await new RGBELoader().setDataType( THREE.FloatType ).loadAsync( envMapUrl );
|
|
168
170
|
const generator = new BlurredEnvMapGenerator( renderer );
|
|
169
171
|
const blurredEnvMap = generator.generate( envMap, 0.35 );
|
|
170
172
|
|
|
@@ -628,7 +630,10 @@ _extends MaterialBase_
|
|
|
628
630
|
```js
|
|
629
631
|
{
|
|
630
632
|
// The number of ray bounces to test. Higher is better quality but slower performance.
|
|
633
|
+
// TransmissiveBounces indicates the number of additional transparent or translucent surfaces
|
|
634
|
+
// the ray can pass through.
|
|
631
635
|
bounces = 3 : Number,
|
|
636
|
+
transmissiveBounces = 10 : Number,
|
|
632
637
|
|
|
633
638
|
// The number of additional transmissive ray bounces to allow on top of existing bounces for object opacity / transmission.
|
|
634
639
|
transmissiveBounces = 5 : Number,
|
|
@@ -684,6 +689,19 @@ _extends MaterialBase_
|
|
|
684
689
|
}
|
|
685
690
|
```
|
|
686
691
|
|
|
692
|
+
## FogVolumeMaterial
|
|
693
|
+
|
|
694
|
+
_extends MeshStandardMaterial_
|
|
695
|
+
|
|
696
|
+
A material used for rendering fog-like volumes within the scene. The `color`, `emissive`, and `emissiveIntensity` fields are all used in the render.
|
|
697
|
+
|
|
698
|
+
> *NOTE*
|
|
699
|
+
> Since fog models many particles throughout the scene and cause many extra bounces fog materials can dramatically impact render time.
|
|
700
|
+
|
|
701
|
+
### .density
|
|
702
|
+
|
|
703
|
+
The particulate density of the volume.
|
|
704
|
+
|
|
687
705
|
## DenoiseMaterial
|
|
688
706
|
|
|
689
707
|
_extends MaterialBase_
|
|
@@ -862,6 +880,29 @@ mergeMeshes( meshes : Array<Mesh> ) : {
|
|
|
862
880
|
|
|
863
881
|
Merges the set of meshes into a single geometry with a `materialIndex` vertex attribute included on the geometry identifying the associated material in the returned `materials` array.
|
|
864
882
|
|
|
883
|
+
## CompatibilityDetector
|
|
884
|
+
|
|
885
|
+
Detects whether the path tracer can run on the current device by checking whether struct precision is reliable and the material shader will compile.
|
|
886
|
+
|
|
887
|
+
### constructor
|
|
888
|
+
|
|
889
|
+
```js
|
|
890
|
+
constructor( renderer : WebGLRenderer, material : Material )
|
|
891
|
+
```
|
|
892
|
+
|
|
893
|
+
Takes a WebGLRenderer to use and material to test again.
|
|
894
|
+
|
|
895
|
+
### .detect
|
|
896
|
+
|
|
897
|
+
```js
|
|
898
|
+
detect() : {
|
|
899
|
+
pass: Boolean,
|
|
900
|
+
message: String
|
|
901
|
+
}
|
|
902
|
+
```
|
|
903
|
+
|
|
904
|
+
Returns `pass === true` if the path tracer can run. If it cannot run then a message is returned indicating why.
|
|
905
|
+
|
|
865
906
|
## Shader Chunks
|
|
866
907
|
|
|
867
908
|
**shaderMaterialSampling**
|
|
@@ -958,4 +999,6 @@ Set of randomness and other light transport utilities for use in a shader. See t
|
|
|
958
999
|
|
|
959
1000
|
[knightcrawler25/GLSL-PathTracer](https://github.com/knightcrawler25/GLSL-PathTracer/)
|
|
960
1001
|
|
|
1002
|
+
[DassaultSystemes-Technology/dspbr-pt](https://github.com/DassaultSystemes-Technology/dspbr-pt)
|
|
1003
|
+
|
|
961
1004
|
|