@plastic-software/three 0.178.0 → 0.179.0

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 (141) hide show
  1. package/README.md +1 -1
  2. package/build/three.cjs +856 -196
  3. package/build/three.core.js +647 -123
  4. package/build/three.core.min.js +1 -1
  5. package/build/three.module.js +211 -76
  6. package/build/three.module.min.js +1 -1
  7. package/build/three.tsl.js +70 -21
  8. package/build/three.tsl.min.js +1 -1
  9. package/build/three.webgpu.js +1796 -557
  10. package/build/three.webgpu.min.js +1 -1
  11. package/build/three.webgpu.nodes.js +1754 -557
  12. package/build/three.webgpu.nodes.min.js +1 -1
  13. package/examples/jsm/Addons.js +1 -2
  14. package/examples/jsm/capabilities/WebGPU.js +1 -1
  15. package/examples/jsm/csm/CSMShadowNode.js +4 -4
  16. package/examples/jsm/environments/RoomEnvironment.js +8 -3
  17. package/examples/jsm/exporters/USDZExporter.js +676 -299
  18. package/examples/jsm/geometries/RoundedBoxGeometry.js +47 -8
  19. package/examples/jsm/interactive/HTMLMesh.js +5 -3
  20. package/examples/jsm/libs/meshopt_decoder.module.js +75 -58
  21. package/examples/jsm/lights/LightProbeGenerator.js +14 -3
  22. package/examples/jsm/loaders/EXRLoader.js +210 -22
  23. package/examples/jsm/loaders/FBXLoader.js +1 -1
  24. package/examples/jsm/loaders/MaterialXLoader.js +212 -30
  25. package/examples/jsm/loaders/TTFLoader.js +13 -1
  26. package/examples/jsm/loaders/USDLoader.js +219 -0
  27. package/examples/jsm/loaders/USDZLoader.js +4 -892
  28. package/examples/jsm/loaders/usd/USDAParser.js +741 -0
  29. package/examples/jsm/loaders/usd/USDCParser.js +17 -0
  30. package/examples/jsm/objects/LensflareMesh.js +3 -3
  31. package/examples/jsm/objects/SkyMesh.js +2 -2
  32. package/examples/jsm/physics/RapierPhysics.js +14 -5
  33. package/examples/jsm/postprocessing/GTAOPass.js +10 -9
  34. package/examples/jsm/postprocessing/OutlinePass.js +17 -17
  35. package/examples/jsm/postprocessing/SSAOPass.js +10 -9
  36. package/examples/jsm/shaders/UnpackDepthRGBAShader.js +11 -2
  37. package/examples/jsm/transpiler/GLSLDecoder.js +2 -2
  38. package/examples/jsm/tsl/display/BloomNode.js +8 -7
  39. package/examples/jsm/tsl/display/GaussianBlurNode.js +6 -8
  40. package/examples/jsm/tsl/display/{TRAAPassNode.js → TRAANode.js} +181 -172
  41. package/examples/jsm/tsl/lighting/TiledLightsNode.js +1 -1
  42. package/package.json +1 -1
  43. package/src/Three.Core.js +1 -0
  44. package/src/Three.TSL.js +69 -20
  45. package/src/animation/KeyframeTrack.js +1 -1
  46. package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
  47. package/src/animation/tracks/StringKeyframeTrack.js +1 -1
  48. package/src/cameras/Camera.js +14 -0
  49. package/src/cameras/OrthographicCamera.js +1 -1
  50. package/src/cameras/PerspectiveCamera.js +1 -1
  51. package/src/constants.js +1 -1
  52. package/{examples/jsm/misc → src/core}/Timer.js +4 -42
  53. package/src/extras/PMREMGenerator.js +11 -0
  54. package/src/helpers/CameraHelper.js +41 -11
  55. package/src/helpers/SkeletonHelper.js +35 -6
  56. package/src/lights/LightShadow.js +21 -8
  57. package/src/lights/PointLightShadow.js +1 -1
  58. package/src/loaders/FileLoader.js +25 -2
  59. package/src/loaders/ImageBitmapLoader.js +23 -0
  60. package/src/loaders/Loader.js +14 -0
  61. package/src/loaders/LoadingManager.js +23 -0
  62. package/src/materials/MeshBasicMaterial.js +1 -1
  63. package/src/materials/nodes/Line2NodeMaterial.js +0 -8
  64. package/src/materials/nodes/NodeMaterial.js +1 -1
  65. package/src/materials/nodes/PointsNodeMaterial.js +5 -0
  66. package/src/materials/nodes/manager/NodeMaterialObserver.js +87 -2
  67. package/src/math/Frustum.js +19 -8
  68. package/src/math/FrustumArray.js +10 -5
  69. package/src/math/Line3.js +129 -2
  70. package/src/math/Matrix4.js +48 -27
  71. package/src/math/Spherical.js +2 -2
  72. package/src/nodes/Nodes.js +1 -0
  73. package/src/nodes/TSL.js +1 -0
  74. package/src/nodes/accessors/Camera.js +12 -12
  75. package/src/nodes/accessors/Normal.js +11 -11
  76. package/src/nodes/accessors/ReferenceNode.js +18 -3
  77. package/src/nodes/accessors/SceneNode.js +1 -1
  78. package/src/nodes/accessors/StorageTextureNode.js +1 -1
  79. package/src/nodes/accessors/TextureNode.js +12 -0
  80. package/src/nodes/core/ArrayNode.js +12 -0
  81. package/src/nodes/core/AssignNode.js +3 -0
  82. package/src/nodes/core/ContextNode.js +20 -1
  83. package/src/nodes/core/Node.js +14 -2
  84. package/src/nodes/core/NodeBuilder.js +25 -20
  85. package/src/nodes/core/NodeUtils.js +4 -1
  86. package/src/nodes/core/StackNode.js +42 -0
  87. package/src/nodes/core/UniformNode.js +63 -5
  88. package/src/nodes/core/VarNode.js +91 -2
  89. package/src/nodes/display/PassNode.js +148 -2
  90. package/src/nodes/display/ViewportTextureNode.js +67 -7
  91. package/src/nodes/functions/PhysicalLightingModel.js +2 -2
  92. package/src/nodes/gpgpu/AtomicFunctionNode.js +1 -1
  93. package/src/nodes/gpgpu/ComputeNode.js +67 -23
  94. package/src/nodes/gpgpu/WorkgroupInfoNode.js +28 -3
  95. package/src/nodes/lighting/ProjectorLightNode.js +19 -6
  96. package/src/nodes/lighting/ShadowFilterNode.js +1 -1
  97. package/src/nodes/materialx/MaterialXNodes.js +131 -2
  98. package/src/nodes/materialx/lib/mx_noise.js +165 -1
  99. package/src/nodes/math/ConditionalNode.js +1 -1
  100. package/src/nodes/math/MathNode.js +78 -54
  101. package/src/nodes/math/OperatorNode.js +22 -22
  102. package/src/nodes/tsl/TSLCore.js +64 -9
  103. package/src/nodes/utils/DebugNode.js +1 -1
  104. package/src/nodes/utils/EventNode.js +83 -0
  105. package/src/nodes/utils/RTTNode.js +9 -0
  106. package/src/objects/BatchedMesh.js +4 -2
  107. package/src/renderers/WebGLRenderer.js +21 -22
  108. package/src/renderers/common/Bindings.js +19 -18
  109. package/src/renderers/common/Color4.js +2 -2
  110. package/src/renderers/common/PostProcessing.js +60 -5
  111. package/src/renderers/common/Renderer.js +18 -15
  112. package/src/renderers/common/SampledTexture.js +3 -71
  113. package/src/renderers/common/Sampler.js +79 -0
  114. package/src/renderers/common/Storage3DTexture.js +21 -0
  115. package/src/renderers/common/StorageArrayTexture.js +21 -0
  116. package/src/renderers/common/StorageTexture.js +19 -0
  117. package/src/renderers/common/Textures.js +19 -3
  118. package/src/renderers/common/XRManager.js +26 -8
  119. package/src/renderers/common/nodes/NodeSampledTexture.js +0 -12
  120. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +20 -2
  121. package/src/renderers/shaders/ShaderLib/depth.glsl.js +11 -2
  122. package/src/renderers/webgl/WebGLCapabilities.js +2 -2
  123. package/src/renderers/webgl/WebGLMaterials.js +6 -6
  124. package/src/renderers/webgl/WebGLProgram.js +22 -16
  125. package/src/renderers/webgl/WebGLPrograms.js +4 -4
  126. package/src/renderers/webgl/WebGLShadowMap.js +11 -1
  127. package/src/renderers/webgl/WebGLTextures.js +19 -7
  128. package/src/renderers/webgl-fallback/WebGLBackend.js +22 -12
  129. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +2 -2
  130. package/src/renderers/webgpu/WebGPUBackend.js +54 -15
  131. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +53 -73
  132. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +35 -31
  133. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +1 -1
  134. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +11 -64
  135. package/src/renderers/webgpu/utils/WebGPUUtils.js +2 -17
  136. package/src/renderers/webxr/WebXRDepthSensing.js +6 -10
  137. package/src/renderers/webxr/WebXRManager.js +68 -8
  138. package/src/textures/ExternalTexture.js +45 -0
  139. package/src/textures/FramebufferTexture.js +2 -2
  140. package/src/textures/Source.js +11 -1
  141. package/src/textures/VideoTexture.js +30 -2
@@ -0,0 +1,17 @@
1
+ import {
2
+ Group
3
+ } from 'three';
4
+
5
+ class USDCParser {
6
+
7
+ parse( buffer ) {
8
+
9
+ // TODO
10
+
11
+ return new Group();
12
+
13
+ }
14
+
15
+ }
16
+
17
+ export { USDCParser };
@@ -110,7 +110,7 @@ class LensflareMesh extends Mesh {
110
110
  material1a.type = 'Lensflare-1a';
111
111
 
112
112
  material1a.vertexNode = vertexNode;
113
- material1a.fragmentNode = vec4( 1.0, 0.0, 1.0, 1.0 );
113
+ material1a.colorNode = vec4( 1.0, 0.0, 1.0, 1.0 );
114
114
 
115
115
  const material1b = new NodeMaterial();
116
116
 
@@ -121,7 +121,7 @@ class LensflareMesh extends Mesh {
121
121
  material1b.type = 'Lensflare-1b';
122
122
 
123
123
  material1b.vertexNode = vertexNode;
124
- material1b.fragmentNode = texture( tempMap, vec2( uv().flipY() ) );
124
+ material1b.colorNode = texture( tempMap, vec2( uv().flipY() ) );
125
125
 
126
126
  // the following object is used for occlusionMap generation
127
127
 
@@ -174,7 +174,7 @@ class LensflareMesh extends Mesh {
174
174
 
175
175
  } )();
176
176
 
177
- material2.fragmentNode = Fn( () => {
177
+ material2.colorNode = Fn( () => {
178
178
 
179
179
  const color = reference( 'color', 'color' );
180
180
  const map = reference( 'map', 'texture' );
@@ -165,7 +165,7 @@ class SkyMesh extends Mesh {
165
165
 
166
166
  } )();
167
167
 
168
- const fragmentNode = /*@__PURE__*/ Fn( () => {
168
+ const colorNode = /*@__PURE__*/ Fn( () => {
169
169
 
170
170
  // constants for atmospheric scattering
171
171
  const pi = float( 3.141592653589793238462643383279502884197169 );
@@ -234,7 +234,7 @@ class SkyMesh extends Mesh {
234
234
  material.depthWrite = false;
235
235
 
236
236
  material.vertexNode = vertexNode;
237
- material.fragmentNode = fragmentNode;
237
+ material.colorNode = colorNode;
238
238
 
239
239
  }
240
240
 
@@ -15,7 +15,16 @@ function getShape( geometry ) {
15
15
 
16
16
  // TODO change type to is*
17
17
 
18
- if ( geometry.type === 'BoxGeometry' ) {
18
+ if ( geometry.type === 'RoundedBoxGeometry' ) {
19
+
20
+ const sx = parameters.width !== undefined ? parameters.width / 2 : 0.5;
21
+ const sy = parameters.height !== undefined ? parameters.height / 2 : 0.5;
22
+ const sz = parameters.depth !== undefined ? parameters.depth / 2 : 0.5;
23
+ const radius = parameters.radius !== undefined ? parameters.radius : 0.1;
24
+
25
+ return RAPIER.ColliderDesc.roundCuboid( sx - radius, sy - radius, sz - radius, radius );
26
+
27
+ } else if ( geometry.type === 'BoxGeometry' ) {
19
28
 
20
29
  const sx = parameters.width !== undefined ? parameters.width / 2 : 0.5;
21
30
  const sy = parameters.height !== undefined ? parameters.height / 2 : 0.5;
@@ -273,17 +282,17 @@ async function RapierPhysics() {
273
282
  function addHeightfield( mesh, width, depth, heights, scale ) {
274
283
 
275
284
  const shape = RAPIER.ColliderDesc.heightfield( width, depth, heights, scale );
276
-
285
+
277
286
  const bodyDesc = RAPIER.RigidBodyDesc.fixed();
278
287
  bodyDesc.setTranslation( mesh.position.x, mesh.position.y, mesh.position.z );
279
288
  bodyDesc.setRotation( mesh.quaternion );
280
-
289
+
281
290
  const body = world.createRigidBody( bodyDesc );
282
291
  world.createCollider( shape, body );
283
-
292
+
284
293
  if ( ! mesh.userData.physics ) mesh.userData.physics = {};
285
294
  mesh.userData.physics.body = body;
286
-
295
+
287
296
  return body;
288
297
 
289
298
  }
@@ -103,7 +103,7 @@ class GTAOPass extends Pass {
103
103
  */
104
104
  this.output = 0;
105
105
  this._renderGBuffer = true;
106
- this._visibilityCache = new Map();
106
+ this._visibilityCache = [];
107
107
 
108
108
  /**
109
109
  * The AO blend intensity.
@@ -655,9 +655,12 @@ class GTAOPass extends Pass {
655
655
 
656
656
  scene.traverse( function ( object ) {
657
657
 
658
- cache.set( object, object.visible );
658
+ if ( ( object.isPoints || object.isLine || object.isLine2 ) && object.visible ) {
659
659
 
660
- if ( object.isPoints || object.isLine ) object.visible = false;
660
+ object.visible = false;
661
+ cache.push( object );
662
+
663
+ }
661
664
 
662
665
  } );
663
666
 
@@ -665,17 +668,15 @@ class GTAOPass extends Pass {
665
668
 
666
669
  _restoreVisibility() {
667
670
 
668
- const scene = this.scene;
669
671
  const cache = this._visibilityCache;
670
672
 
671
- scene.traverse( function ( object ) {
673
+ for ( let i = 0; i < cache.length; i ++ ) {
672
674
 
673
- const visible = cache.get( object );
674
- object.visible = visible;
675
+ cache[ i ].visible = true;
675
676
 
676
- } );
677
+ }
677
678
 
678
- cache.clear();
679
+ cache.length = 0;
679
680
 
680
681
  }
681
682
 
@@ -494,37 +494,37 @@ class OutlinePass extends Pass {
494
494
 
495
495
  function VisibilityChangeCallBack( object ) {
496
496
 
497
- if ( object.isMesh || object.isSprite ) {
497
+ if ( object.isPoints || object.isLine || object.isLine2 ) {
498
498
 
499
- // only meshes and sprites are supported by OutlinePass
499
+ // the visibility of points and lines is always set to false in order to
500
+ // not affect the outline computation
500
501
 
501
- if ( ! selectionCache.has( object ) ) {
502
+ if ( bVisible === true ) {
502
503
 
503
- const visibility = object.visible;
504
+ object.visible = visibilityCache.get( object ); // restore
504
505
 
505
- if ( bVisible === false || visibilityCache.get( object ) === true ) {
506
+ } else {
506
507
 
507
- object.visible = bVisible;
508
+ visibilityCache.set( object, object.visible );
509
+ object.visible = bVisible;
508
510
 
509
- }
511
+ }
510
512
 
511
- visibilityCache.set( object, visibility );
513
+ } else if ( object.isMesh || object.isSprite) {
512
514
 
513
- }
515
+ // only meshes and sprites are supported by OutlinePass
514
516
 
515
- } else if ( object.isPoints || object.isLine ) {
517
+ if ( ! selectionCache.has( object ) ) {
516
518
 
517
- // the visibility of points and lines is always set to false in order to
518
- // not affect the outline computation
519
+ const visibility = object.visible;
519
520
 
520
- if ( bVisible === true ) {
521
+ if ( bVisible === false || visibilityCache.get( object ) === true ) {
521
522
 
522
- object.visible = visibilityCache.get( object ); // restore
523
+ object.visible = bVisible;
523
524
 
524
- } else {
525
+ }
525
526
 
526
- visibilityCache.set( object, object.visible );
527
- object.visible = bVisible;
527
+ visibilityCache.set( object, visibility );
528
528
 
529
529
  }
530
530
 
@@ -139,7 +139,7 @@ class SSAOPass extends Pass {
139
139
  */
140
140
  this.maxDistance = 0.1;
141
141
 
142
- this._visibilityCache = new Map();
142
+ this._visibilityCache = [];
143
143
 
144
144
  //
145
145
 
@@ -489,9 +489,12 @@ class SSAOPass extends Pass {
489
489
 
490
490
  scene.traverse( function ( object ) {
491
491
 
492
- cache.set( object, object.visible );
492
+ if ( ( object.isPoints || object.isLine || object.isLine2 ) && object.visible ) {
493
493
 
494
- if ( object.isPoints || object.isLine ) object.visible = false;
494
+ object.visible = false;
495
+ cache.push( object );
496
+
497
+ }
495
498
 
496
499
  } );
497
500
 
@@ -499,17 +502,15 @@ class SSAOPass extends Pass {
499
502
 
500
503
  _restoreVisibility() {
501
504
 
502
- const scene = this.scene;
503
505
  const cache = this._visibilityCache;
504
506
 
505
- scene.traverse( function ( object ) {
507
+ for ( let i = 0; i < cache.length; i ++ ) {
506
508
 
507
- const visible = cache.get( object );
508
- object.visible = visible;
509
+ cache[ i ].visible = true;
509
510
 
510
- } );
511
+ }
511
512
 
512
- cache.clear();
513
+ cache.length = 0;
513
514
 
514
515
  }
515
516
 
@@ -43,8 +43,17 @@ const UnpackDepthRGBAShader = {
43
43
 
44
44
  void main() {
45
45
 
46
- float depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );
47
- gl_FragColor = vec4( vec3( depth ), opacity );
46
+ float depth = unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );
47
+
48
+ #ifdef USE_REVERSEDEPTHBUF
49
+
50
+ gl_FragColor = vec4( vec3( depth ), opacity );
51
+
52
+ #else
53
+
54
+ gl_FragColor = vec4( vec3( 1.0 - depth ), opacity );
55
+
56
+ #endif
48
57
 
49
58
  }`
50
59
 
@@ -11,7 +11,7 @@ const arithmeticOperators = [
11
11
  ];
12
12
 
13
13
  const precedenceOperators = [
14
- '*', '/', '%',
14
+ '/', '*', '%',
15
15
  '-', '+',
16
16
  '<<', '>>',
17
17
  '<', '>', '<=', '>=',
@@ -861,7 +861,7 @@ class GLSLDecoder {
861
861
 
862
862
  const switchDeterminantTokens = this.readTokensUntil( ')' );
863
863
 
864
- // Parse expresison between parentheses. Index 1: char after '('. Index -1: char before ')'
864
+ // Parse expression between parentheses. Index 1: char after '('. Index -1: char before ')'
865
865
  const discriminant = this.parseExpressionFromTokens( switchDeterminantTokens.slice( 1, - 1 ) );
866
866
 
867
867
  // Validate curly braces
@@ -364,7 +364,9 @@ class BloomNode extends TempNode {
364
364
 
365
365
  // gaussian blur materials
366
366
 
367
- const kernelSizeArray = [ 3, 5, 7, 9, 11 ];
367
+ // These sizes have been changed to account for the altered coefficents-calculation to avoid blockiness,
368
+ // while retaining the same blur-strength. For details see https://github.com/mrdoob/three.js/pull/31528
369
+ const kernelSizeArray = [ 6, 10, 14, 18, 22 ];
368
370
 
369
371
  for ( let i = 0; i < this._nMips; i ++ ) {
370
372
 
@@ -449,10 +451,11 @@ class BloomNode extends TempNode {
449
451
  _getSeparableBlurMaterial( builder, kernelRadius ) {
450
452
 
451
453
  const coefficients = [];
454
+ const sigma = kernelRadius / 3;
452
455
 
453
456
  for ( let i = 0; i < kernelRadius; i ++ ) {
454
457
 
455
- coefficients.push( 0.39894 * Math.exp( - 0.5 * i * i / ( kernelRadius * kernelRadius ) ) / kernelRadius );
458
+ coefficients.push( 0.39894 * Math.exp( - 0.5 * i * i / ( sigma * sigma ) ) / sigma );
456
459
 
457
460
  }
458
461
 
@@ -468,8 +471,7 @@ class BloomNode extends TempNode {
468
471
 
469
472
  const separableBlurPass = Fn( () => {
470
473
 
471
- const weightSum = gaussianCoefficients.element( 0 ).toVar();
472
- const diffuseSum = sampleTexel( uvNode ).rgb.mul( weightSum ).toVar();
474
+ const diffuseSum = sampleTexel( uvNode ).rgb.mul( gaussianCoefficients.element( 0 ) ).toVar();
473
475
 
474
476
  Loop( { start: int( 1 ), end: int( kernelRadius ), type: 'int', condition: '<' }, ( { i } ) => {
475
477
 
@@ -478,12 +480,11 @@ class BloomNode extends TempNode {
478
480
  const uvOffset = direction.mul( invSize ).mul( x );
479
481
  const sample1 = sampleTexel( uvNode.add( uvOffset ) ).rgb;
480
482
  const sample2 = sampleTexel( uvNode.sub( uvOffset ) ).rgb;
481
- diffuseSum.addAssign( add( sample1, sample2 ).mul( w ) );
482
- weightSum.addAssign( float( 2.0 ).mul( w ) );
483
+ diffuseSum.addAssign( add( sample1, sample2 ).mul( w ) );
483
484
 
484
485
  } );
485
486
 
486
- return vec4( diffuseSum.div( weightSum ), 1.0 );
487
+ return vec4( diffuseSum, 1.0 );
487
488
 
488
489
  } );
489
490
 
@@ -1,5 +1,5 @@
1
1
  import { RenderTarget, Vector2, NodeMaterial, RendererUtils, QuadMesh, TempNode, NodeUpdateType } from 'three/webgpu';
2
- import { nodeObject, Fn, float, uv, uniform, convertToTexture, vec2, vec4, passTexture, mul, premultiplyAlpha, unpremultiplyAlpha } from 'three/tsl';
2
+ import { nodeObject, Fn, float, uv, uniform, convertToTexture, vec2, vec4, passTexture, premultiplyAlpha, unpremultiplyAlpha } from 'three/tsl';
3
3
 
4
4
  const _quadMesh = /*@__PURE__*/ new QuadMesh();
5
5
 
@@ -26,7 +26,7 @@ class GaussianBlurNode extends TempNode {
26
26
  * @param {Node<vec2|float>} directionNode - Defines the direction and radius of the blur.
27
27
  * @param {number} sigma - Controls the kernel of the blur filter. Higher values mean a wider blur radius.
28
28
  */
29
- constructor( textureNode, directionNode = null, sigma = 2 ) {
29
+ constructor( textureNode, directionNode = null, sigma = 4 ) {
30
30
 
31
31
  super( 'vec4' );
32
32
 
@@ -267,8 +267,7 @@ class GaussianBlurNode extends TempNode {
267
267
  const invSize = this._invSize;
268
268
  const direction = directionNode.mul( this._passDirection );
269
269
 
270
- const weightSum = float( gaussianCoefficients[ 0 ] ).toVar();
271
- const diffuseSum = vec4( sampleTexture( uvNode ).mul( weightSum ) ).toVar();
270
+ const diffuseSum = vec4( sampleTexture( uvNode ).mul( gaussianCoefficients[ 0 ] ) ).toVar();
272
271
 
273
272
  for ( let i = 1; i < kernelSize; i ++ ) {
274
273
 
@@ -281,11 +280,9 @@ class GaussianBlurNode extends TempNode {
281
280
  const sample2 = sampleTexture( uvNode.sub( uvOffset ) );
282
281
 
283
282
  diffuseSum.addAssign( sample1.add( sample2 ).mul( w ) );
284
- weightSum.addAssign( mul( 2.0, w ) );
285
-
286
283
  }
287
284
 
288
- return output( diffuseSum.div( weightSum ) );
285
+ return output( diffuseSum );
289
286
 
290
287
  } );
291
288
 
@@ -328,10 +325,11 @@ class GaussianBlurNode extends TempNode {
328
325
  _getCoefficients( kernelRadius ) {
329
326
 
330
327
  const coefficients = [];
328
+ const sigma = kernelRadius / 3;
331
329
 
332
330
  for ( let i = 0; i < kernelRadius; i ++ ) {
333
331
 
334
- coefficients.push( 0.39894 * Math.exp( - 0.5 * i * i / ( kernelRadius * kernelRadius ) ) / kernelRadius );
332
+ coefficients.push( 0.39894 * Math.exp( - 0.5 * i * i / ( sigma * sigma ) ) / sigma );
335
333
 
336
334
  }
337
335