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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-gpu-pathtracer",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "Path tracing renderer and utilities for three.js built on top of three-mesh-bvh.",
5
5
  "module": "src/index.js",
6
6
  "main": "build/index.umd.cjs",
@@ -691,7 +691,7 @@ export class PhysicalPathTracingMaterial extends MaterialBase {
691
691
  if ( material.clearcoatRoughnessMap != - 1 ) {
692
692
 
693
693
  vec3 uvPrime = material.clearcoatRoughnessMapTransform * vec3( uv, 1 );
694
- clearcoat *= texture2D( textures, vec3( uvPrime.xy, material.clearcoatRoughnessMap ) ).g;
694
+ clearcoatRoughness *= texture2D( textures, vec3( uvPrime.xy, material.clearcoatRoughnessMap ) ).g;
695
695
 
696
696
  }
697
697
 
@@ -3,12 +3,11 @@ import { DataTexture, FloatType, RedFormat, LinearFilter, DataUtils, HalfFloatTy
3
3
  function binarySearchFindClosestIndexOf( array, targetValue, offset = 0, count = array.length ) {
4
4
 
5
5
  let lower = 0;
6
- let upper = count;
6
+ let upper = count - 1;
7
7
  while ( lower < upper ) {
8
8
 
9
9
  const mid = ~ ~ ( 0.5 * upper + 0.5 * lower );
10
10
 
11
-
12
11
  // check if the middle array value is above or below the target and shift
13
12
  // which half of the array we're looking at
14
13
  if ( array[ offset + mid ] < targetValue ) {
@@ -215,12 +214,13 @@ export class EquirectHdrInfoUniform {
215
214
  const marginalDataArray = new Float32Array( height );
216
215
  const conditionalDataArray = new Float32Array( width * height );
217
216
 
217
+ // we add a half texel offset so we're sampling the center of the pixel
218
218
  for ( let i = 0; i < height; i ++ ) {
219
219
 
220
220
  const dist = ( i + 1 ) / height;
221
221
  const row = binarySearchFindClosestIndexOf( cdfMarginal, dist );
222
222
 
223
- marginalDataArray[ i ] = row / height;
223
+ marginalDataArray[ i ] = ( row + 0.5 ) / height;
224
224
 
225
225
  }
226
226
 
@@ -232,7 +232,7 @@ export class EquirectHdrInfoUniform {
232
232
  const dist = ( x + 1 ) / width;
233
233
  const col = binarySearchFindClosestIndexOf( cdfConditional, dist, y * width, width );
234
234
 
235
- conditionalDataArray[ i ] = col / width;
235
+ conditionalDataArray[ i ] = ( col + 0.5 ) / width;
236
236
 
237
237
  }
238
238
 
@@ -1,5 +1,5 @@
1
1
  import { FloatType, NearestFilter, NoBlending, RGBAFormat, Vector2, WebGLRenderTarget } from 'three';
2
- import { FullScreenQuad } from 'three/examples/jsm/postprocessing/Pass';
2
+ import { FullScreenQuad } from 'three/examples/jsm/postprocessing/Pass.js';
3
3
  import { MaterialBase } from '../materials/MaterialBase.js';
4
4
  import { shaderSobolCommon, shaderSobolGeneration } from '../shader/shaderSobolSampling.js';
5
5