three-gpu-pathtracer 0.0.9 → 0.0.11
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/build/index.module.js +11 -12
- package/build/index.module.js.map +1 -1
- package/build/index.umd.cjs +10 -10
- package/build/index.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/materials/PhysicalPathTracingMaterial.js +1 -1
- package/src/uniforms/EquirectHdrInfoUniform.js +4 -4
- package/src/utils/SobolNumberMapGenerator.js +1 -1
package/build/index.module.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ShaderMaterial, NoBlending, Vector2, WebGLRenderTarget, FloatType, RGBAFormat, NearestFilter, NormalBlending, Color, BufferAttribute, Mesh, BufferGeometry, PerspectiveCamera, Camera, SpotLight, RectAreaLight, Spherical, DataTexture, EquirectangularReflectionMapping, RepeatWrapping, ClampToEdgeWrapping, LinearFilter, Vector3, DoubleSide, BackSide, FrontSide, WebGLArrayRenderTarget, UnsignedByteType, MeshBasicMaterial, NoToneMapping, Source, HalfFloatType, DataUtils, RedFormat, Matrix4, Quaternion, Loader, MathUtils, FileLoader, PMREMGenerator, Vector4, DataArrayTexture } from 'three';
|
|
2
|
-
import { FullScreenQuad
|
|
3
|
-
import { FullScreenQuad } from 'three/examples/jsm/postprocessing/Pass';
|
|
2
|
+
import { FullScreenQuad } from 'three/examples/jsm/postprocessing/Pass.js';
|
|
4
3
|
import { StaticGeometryGenerator, SAH, MeshBVH, FloatVertexAttributeTexture, MeshBVHUniformStruct, UIntVertexAttributeTexture, shaderStructs, shaderIntersectFunction } from 'three-mesh-bvh';
|
|
5
4
|
import { mergeVertices, mergeBufferGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils.js';
|
|
6
5
|
|
|
@@ -636,8 +635,8 @@ class PathTracingRenderer {
|
|
|
636
635
|
|
|
637
636
|
this._renderer = renderer;
|
|
638
637
|
this._alpha = false;
|
|
639
|
-
this._fsQuad = new FullScreenQuad
|
|
640
|
-
this._blendQuad = new FullScreenQuad
|
|
638
|
+
this._fsQuad = new FullScreenQuad( null );
|
|
639
|
+
this._blendQuad = new FullScreenQuad( new BlendMaterial() );
|
|
641
640
|
this._task = null;
|
|
642
641
|
this._currentTile = 0;
|
|
643
642
|
|
|
@@ -2014,7 +2013,7 @@ class RenderTarget2DArray extends WebGLArrayRenderTarget {
|
|
|
2014
2013
|
|
|
2015
2014
|
};
|
|
2016
2015
|
|
|
2017
|
-
const fsQuad = new FullScreenQuad
|
|
2016
|
+
const fsQuad = new FullScreenQuad( new MeshBasicMaterial() );
|
|
2018
2017
|
this.fsQuad = fsQuad;
|
|
2019
2018
|
|
|
2020
2019
|
}
|
|
@@ -2082,12 +2081,11 @@ class RenderTarget2DArray extends WebGLArrayRenderTarget {
|
|
|
2082
2081
|
function binarySearchFindClosestIndexOf( array, targetValue, offset = 0, count = array.length ) {
|
|
2083
2082
|
|
|
2084
2083
|
let lower = 0;
|
|
2085
|
-
let upper = count;
|
|
2084
|
+
let upper = count - 1;
|
|
2086
2085
|
while ( lower < upper ) {
|
|
2087
2086
|
|
|
2088
2087
|
const mid = ~ ~ ( 0.5 * upper + 0.5 * lower );
|
|
2089
2088
|
|
|
2090
|
-
|
|
2091
2089
|
// check if the middle array value is above or below the target and shift
|
|
2092
2090
|
// which half of the array we're looking at
|
|
2093
2091
|
if ( array[ offset + mid ] < targetValue ) {
|
|
@@ -2294,12 +2292,13 @@ class EquirectHdrInfoUniform {
|
|
|
2294
2292
|
const marginalDataArray = new Float32Array( height );
|
|
2295
2293
|
const conditionalDataArray = new Float32Array( width * height );
|
|
2296
2294
|
|
|
2295
|
+
// we add a half texel offset so we're sampling the center of the pixel
|
|
2297
2296
|
for ( let i = 0; i < height; i ++ ) {
|
|
2298
2297
|
|
|
2299
2298
|
const dist = ( i + 1 ) / height;
|
|
2300
2299
|
const row = binarySearchFindClosestIndexOf( cdfMarginal, dist );
|
|
2301
2300
|
|
|
2302
|
-
marginalDataArray[ i ] = row / height;
|
|
2301
|
+
marginalDataArray[ i ] = ( row + 0.5 ) / height;
|
|
2303
2302
|
|
|
2304
2303
|
}
|
|
2305
2304
|
|
|
@@ -2311,7 +2310,7 @@ class EquirectHdrInfoUniform {
|
|
|
2311
2310
|
const dist = ( x + 1 ) / width;
|
|
2312
2311
|
const col = binarySearchFindClosestIndexOf( cdfConditional, dist, y * width, width );
|
|
2313
2312
|
|
|
2314
|
-
conditionalDataArray[ i ] = col / width;
|
|
2313
|
+
conditionalDataArray[ i ] = ( col + 0.5 ) / width;
|
|
2315
2314
|
|
|
2316
2315
|
}
|
|
2317
2316
|
|
|
@@ -2917,7 +2916,7 @@ class IESProfilesTexture extends WebGLArrayRenderTarget {
|
|
|
2917
2916
|
|
|
2918
2917
|
};
|
|
2919
2918
|
|
|
2920
|
-
const fsQuad = new FullScreenQuad
|
|
2919
|
+
const fsQuad = new FullScreenQuad( new MeshBasicMaterial() );
|
|
2921
2920
|
this.fsQuad = fsQuad;
|
|
2922
2921
|
|
|
2923
2922
|
this.iesLoader = new IESLoader();
|
|
@@ -3399,7 +3398,7 @@ class BlurredEnvMapGenerator {
|
|
|
3399
3398
|
|
|
3400
3399
|
this.renderer = renderer;
|
|
3401
3400
|
this.pmremGenerator = new PMREMGenerator( renderer );
|
|
3402
|
-
this.copyQuad = new FullScreenQuad
|
|
3401
|
+
this.copyQuad = new FullScreenQuad( new PMREMCopyMaterial() );
|
|
3403
3402
|
this.renderTarget = new WebGLRenderTarget( 1, 1, { type: FloatType, format: RGBAFormat } );
|
|
3404
3403
|
|
|
3405
3404
|
}
|
|
@@ -6234,7 +6233,7 @@ class PhysicalPathTracingMaterial extends MaterialBase {
|
|
|
6234
6233
|
if ( material.clearcoatRoughnessMap != - 1 ) {
|
|
6235
6234
|
|
|
6236
6235
|
vec3 uvPrime = material.clearcoatRoughnessMapTransform * vec3( uv, 1 );
|
|
6237
|
-
|
|
6236
|
+
clearcoatRoughness *= texture2D( textures, vec3( uvPrime.xy, material.clearcoatRoughnessMap ) ).g;
|
|
6238
6237
|
|
|
6239
6238
|
}
|
|
6240
6239
|
|