@plastic-software/three 0.181.3 → 0.182.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 (253) hide show
  1. package/README.md +3 -4
  2. package/build/three.cjs +1192 -522
  3. package/build/three.core.js +345 -219
  4. package/build/three.core.min.js +1 -1
  5. package/build/three.module.js +864 -328
  6. package/build/three.module.min.js +1 -1
  7. package/build/three.tsl.js +15 -3
  8. package/build/three.tsl.min.js +1 -1
  9. package/build/three.webgpu.js +3660 -1545
  10. package/build/three.webgpu.min.js +1 -1
  11. package/build/three.webgpu.nodes.js +3659 -1544
  12. package/build/three.webgpu.nodes.min.js +1 -1
  13. package/examples/jsm/controls/MapControls.js +55 -1
  14. package/examples/jsm/controls/OrbitControls.js +6 -6
  15. package/examples/jsm/controls/TrackballControls.js +6 -6
  16. package/examples/jsm/csm/CSM.js +2 -1
  17. package/examples/jsm/environments/RoomEnvironment.js +2 -0
  18. package/examples/jsm/geometries/DecalGeometry.js +1 -1
  19. package/examples/jsm/helpers/LightProbeHelperGPU.js +1 -1
  20. package/examples/jsm/helpers/TextureHelperGPU.js +1 -1
  21. package/examples/jsm/inspector/Inspector.js +53 -9
  22. package/examples/jsm/inspector/RendererInspector.js +12 -2
  23. package/examples/jsm/inspector/tabs/Console.js +2 -2
  24. package/examples/jsm/inspector/tabs/Parameters.js +2 -2
  25. package/examples/jsm/inspector/tabs/Performance.js +2 -2
  26. package/examples/jsm/inspector/tabs/Viewer.js +4 -4
  27. package/examples/jsm/inspector/ui/Profiler.js +1836 -31
  28. package/examples/jsm/inspector/ui/Style.js +948 -13
  29. package/examples/jsm/inspector/ui/Tab.js +188 -1
  30. package/examples/jsm/inspector/ui/Values.js +17 -1
  31. package/examples/jsm/loaders/3DMLoader.js +5 -4
  32. package/examples/jsm/loaders/DRACOLoader.js +5 -5
  33. package/examples/jsm/loaders/FBXLoader.js +0 -2
  34. package/examples/jsm/loaders/HDRLoader.js +0 -1
  35. package/examples/jsm/loaders/KTX2Loader.js +16 -0
  36. package/examples/jsm/loaders/LDrawLoader.js +2 -3
  37. package/examples/jsm/loaders/PCDLoader.js +1 -0
  38. package/examples/jsm/loaders/SVGLoader.js +1 -1
  39. package/examples/jsm/loaders/TDSLoader.js +0 -2
  40. package/examples/jsm/loaders/TGALoader.js +0 -2
  41. package/examples/jsm/loaders/UltraHDRLoader.js +110 -137
  42. package/examples/jsm/loaders/VOXLoader.js +660 -117
  43. package/examples/jsm/loaders/VRMLLoader.js +2 -2
  44. package/examples/jsm/loaders/usd/USDCParser.js +1 -1
  45. package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +1 -1
  46. package/examples/jsm/materials/MeshGouraudMaterial.js +0 -1
  47. package/examples/jsm/materials/WoodNodeMaterial.js +11 -11
  48. package/examples/jsm/math/Octree.js +131 -1
  49. package/examples/jsm/misc/Volume.js +0 -1
  50. package/examples/jsm/misc/VolumeSlice.js +0 -1
  51. package/examples/jsm/objects/SkyMesh.js +13 -3
  52. package/examples/jsm/physics/AmmoPhysics.js +12 -7
  53. package/examples/jsm/physics/JoltPhysics.js +3 -1
  54. package/examples/jsm/physics/RapierPhysics.js +3 -1
  55. package/examples/jsm/postprocessing/OutputPass.js +9 -0
  56. package/examples/jsm/postprocessing/RenderPass.js +10 -0
  57. package/examples/jsm/postprocessing/UnrealBloomPass.js +48 -18
  58. package/examples/jsm/renderers/Projector.js +268 -30
  59. package/examples/jsm/renderers/SVGRenderer.js +191 -58
  60. package/examples/jsm/shaders/UnpackDepthRGBAShader.js +2 -4
  61. package/examples/jsm/transpiler/AST.js +44 -0
  62. package/examples/jsm/transpiler/GLSLDecoder.js +61 -4
  63. package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -0
  64. package/examples/jsm/transpiler/TSLEncoder.js +46 -3
  65. package/examples/jsm/transpiler/TranspilerUtils.js +3 -3
  66. package/examples/jsm/transpiler/WGSLEncoder.js +27 -0
  67. package/examples/jsm/tsl/display/AnaglyphPassNode.js +2 -0
  68. package/examples/jsm/tsl/display/BloomNode.js +11 -1
  69. package/examples/jsm/tsl/display/GTAONode.js +3 -2
  70. package/examples/jsm/tsl/display/PixelationPassNode.js +2 -1
  71. package/examples/jsm/tsl/display/SSGINode.js +7 -19
  72. package/examples/jsm/tsl/display/SSRNode.js +1 -1
  73. package/examples/jsm/tsl/display/SSSNode.js +4 -2
  74. package/examples/jsm/tsl/display/StereoCompositePassNode.js +8 -1
  75. package/examples/jsm/tsl/display/TRAANode.js +265 -114
  76. package/examples/jsm/tsl/display/radialBlur.js +68 -0
  77. package/examples/jsm/utils/ShadowMapViewer.js +24 -10
  78. package/examples/jsm/utils/ShadowMapViewerGPU.js +1 -1
  79. package/examples/jsm/utils/WebGPUTextureUtils.js +1 -1
  80. package/package.json +14 -12
  81. package/src/Three.Core.js +1 -0
  82. package/src/Three.TSL.js +14 -2
  83. package/src/animation/AnimationUtils.js +1 -12
  84. package/src/animation/KeyframeTrack.js +1 -1
  85. package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
  86. package/src/animation/tracks/ColorKeyframeTrack.js +1 -1
  87. package/src/animation/tracks/NumberKeyframeTrack.js +1 -1
  88. package/src/animation/tracks/QuaternionKeyframeTrack.js +1 -1
  89. package/src/animation/tracks/StringKeyframeTrack.js +1 -1
  90. package/src/animation/tracks/VectorKeyframeTrack.js +1 -1
  91. package/src/constants.js +61 -5
  92. package/src/core/BufferGeometry.js +14 -2
  93. package/src/core/Raycaster.js +2 -2
  94. package/src/extras/PMREMGenerator.js +3 -10
  95. package/src/extras/TextureUtils.js +5 -1
  96. package/src/geometries/ExtrudeGeometry.js +2 -2
  97. package/src/geometries/PolyhedronGeometry.js +1 -1
  98. package/src/helpers/PointLightHelper.js +1 -1
  99. package/src/lights/DirectionalLight.js +13 -0
  100. package/src/lights/HemisphereLight.js +10 -0
  101. package/src/lights/Light.js +1 -11
  102. package/src/lights/LightProbe.js +0 -15
  103. package/src/lights/LightShadow.js +0 -3
  104. package/src/lights/PointLight.js +15 -0
  105. package/src/lights/PointLightShadow.js +0 -86
  106. package/src/lights/SpotLight.js +22 -1
  107. package/src/loaders/MaterialLoader.js +2 -1
  108. package/src/loaders/ObjectLoader.js +3 -1
  109. package/src/loaders/nodes/NodeLoader.js +2 -2
  110. package/src/materials/Material.js +2 -0
  111. package/src/materials/ShaderMaterial.js +20 -1
  112. package/src/materials/nodes/Line2NodeMaterial.js +2 -2
  113. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +3 -2
  114. package/src/materials/nodes/MeshStandardNodeMaterial.js +5 -4
  115. package/src/materials/nodes/NodeMaterial.js +59 -3
  116. package/src/materials/nodes/manager/NodeMaterialObserver.js +1 -1
  117. package/src/math/Matrix4.js +40 -40
  118. package/src/math/Sphere.js +1 -1
  119. package/src/math/Vector3.js +0 -2
  120. package/src/nodes/TSL.js +4 -1
  121. package/src/nodes/accessors/BatchNode.js +10 -10
  122. package/src/nodes/accessors/BufferAttributeNode.js +98 -12
  123. package/src/nodes/accessors/BufferNode.js +29 -2
  124. package/src/nodes/accessors/ClippingNode.js +4 -4
  125. package/src/nodes/accessors/CubeTextureNode.js +20 -1
  126. package/src/nodes/accessors/InstanceNode.js +69 -29
  127. package/src/nodes/accessors/MaterialNode.js +9 -1
  128. package/src/nodes/accessors/MaterialReferenceNode.js +1 -2
  129. package/src/nodes/accessors/ModelNode.js +1 -1
  130. package/src/nodes/accessors/Normal.js +2 -2
  131. package/src/nodes/accessors/ReferenceBaseNode.js +4 -4
  132. package/src/nodes/accessors/ReferenceNode.js +4 -4
  133. package/src/nodes/accessors/RendererReferenceNode.js +1 -2
  134. package/src/nodes/accessors/SkinningNode.js +15 -2
  135. package/src/nodes/accessors/StorageBufferNode.js +4 -2
  136. package/src/nodes/accessors/Tangent.js +1 -11
  137. package/src/nodes/accessors/Texture3DNode.js +26 -1
  138. package/src/nodes/accessors/UniformArrayNode.js +2 -2
  139. package/src/nodes/accessors/UserDataNode.js +1 -2
  140. package/src/nodes/accessors/VertexColorNode.js +1 -2
  141. package/src/nodes/code/FunctionNode.js +1 -2
  142. package/src/nodes/core/ArrayNode.js +20 -1
  143. package/src/nodes/core/AssignNode.js +2 -2
  144. package/src/nodes/core/AttributeNode.js +2 -2
  145. package/src/nodes/core/ContextNode.js +103 -4
  146. package/src/nodes/core/NodeBuilder.js +56 -14
  147. package/src/nodes/core/NodeFrame.js +12 -4
  148. package/src/nodes/core/NodeUtils.js +5 -5
  149. package/src/nodes/core/ParameterNode.js +1 -2
  150. package/src/nodes/core/PropertyNode.js +19 -3
  151. package/src/nodes/core/StackNode.js +56 -8
  152. package/src/nodes/core/StructNode.js +1 -2
  153. package/src/nodes/core/StructTypeNode.js +11 -17
  154. package/src/nodes/core/UniformNode.js +19 -4
  155. package/src/nodes/core/VarNode.js +46 -21
  156. package/src/nodes/display/NormalMapNode.js +37 -2
  157. package/src/nodes/display/PassNode.js +77 -7
  158. package/src/nodes/display/ScreenNode.js +1 -0
  159. package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +3 -3
  160. package/src/nodes/functions/BSDF/DFGLUT.js +56 -0
  161. package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
  162. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +1 -1
  163. package/src/nodes/functions/PhysicalLightingModel.js +102 -43
  164. package/src/nodes/gpgpu/ComputeBuiltinNode.js +1 -2
  165. package/src/nodes/gpgpu/SubgroupFunctionNode.js +1 -1
  166. package/src/nodes/gpgpu/WorkgroupInfoNode.js +2 -3
  167. package/src/nodes/lighting/AnalyticLightNode.js +53 -0
  168. package/src/nodes/lighting/LightsNode.js +2 -2
  169. package/src/nodes/lighting/PointShadowNode.js +141 -140
  170. package/src/nodes/lighting/ShadowFilterNode.js +53 -37
  171. package/src/nodes/lighting/ShadowNode.js +53 -19
  172. package/src/nodes/math/BitcountNode.js +433 -0
  173. package/src/nodes/math/PackFloatNode.js +98 -0
  174. package/src/nodes/math/UnpackFloatNode.js +96 -0
  175. package/src/nodes/pmrem/PMREMNode.js +1 -1
  176. package/src/nodes/tsl/TSLCore.js +4 -4
  177. package/src/nodes/utils/ArrayElementNode.js +13 -0
  178. package/src/nodes/utils/EventNode.js +1 -2
  179. package/src/nodes/utils/Packing.js +13 -1
  180. package/src/nodes/utils/PostProcessingUtils.js +33 -1
  181. package/src/nodes/utils/ReflectorNode.js +1 -1
  182. package/src/nodes/utils/SampleNode.js +1 -1
  183. package/src/nodes/utils/UVUtils.js +26 -0
  184. package/src/objects/BatchedMesh.js +5 -2
  185. package/src/objects/Line.js +1 -1
  186. package/src/objects/Mesh.js +1 -1
  187. package/src/objects/Points.js +1 -1
  188. package/src/objects/Skeleton.js +9 -0
  189. package/src/renderers/WebGLRenderer.js +145 -33
  190. package/src/renderers/common/Backend.js +8 -0
  191. package/src/renderers/common/Background.js +19 -9
  192. package/src/renderers/common/Binding.js +11 -0
  193. package/src/renderers/common/Bindings.js +7 -7
  194. package/src/renderers/common/Buffer.js +40 -0
  195. package/src/renderers/common/ChainMap.js +30 -6
  196. package/src/renderers/common/Geometries.js +12 -0
  197. package/src/renderers/common/RenderContexts.js +8 -1
  198. package/src/renderers/common/RenderObject.js +14 -1
  199. package/src/renderers/common/Renderer.js +53 -35
  200. package/src/renderers/common/Textures.js +1 -1
  201. package/src/renderers/common/UniformsGroup.js +1 -0
  202. package/src/renderers/common/XRManager.js +1 -0
  203. package/src/renderers/common/extras/PMREMGenerator.js +2 -8
  204. package/src/renderers/common/nodes/NodeUniformBuffer.js +52 -0
  205. package/src/renderers/shaders/DFGLUTData.js +19 -34
  206. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +5 -2
  207. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +8 -4
  208. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +90 -51
  209. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +194 -186
  210. package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +1 -1
  211. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
  212. package/src/renderers/shaders/ShaderChunk.js +3 -3
  213. package/src/renderers/shaders/ShaderLib/depth.glsl.js +3 -0
  214. package/src/renderers/shaders/ShaderLib/{distanceRGBA.glsl.js → distance.glsl.js} +1 -2
  215. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +0 -1
  216. package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +1 -2
  217. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +0 -1
  218. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -9
  219. package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +0 -1
  220. package/src/renderers/shaders/ShaderLib/shadow.glsl.js +0 -1
  221. package/src/renderers/shaders/ShaderLib/vsm.glsl.js +4 -6
  222. package/src/renderers/shaders/ShaderLib.js +3 -3
  223. package/src/renderers/webgl/WebGLCapabilities.js +3 -4
  224. package/src/renderers/webgl/WebGLLights.js +18 -1
  225. package/src/renderers/webgl/WebGLOutput.js +267 -0
  226. package/src/renderers/webgl/WebGLProgram.js +43 -107
  227. package/src/renderers/webgl/WebGLPrograms.js +35 -45
  228. package/src/renderers/webgl/WebGLShadowMap.js +188 -25
  229. package/src/renderers/webgl/WebGLState.js +20 -20
  230. package/src/renderers/webgl/WebGLTextures.js +89 -28
  231. package/src/renderers/webgl/WebGLUniforms.js +40 -3
  232. package/src/renderers/webgl/WebGLUtils.js +6 -2
  233. package/src/renderers/webgl-fallback/WebGLBackend.js +79 -13
  234. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +59 -7
  235. package/src/renderers/webgl-fallback/utils/WebGLState.js +18 -3
  236. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +5 -3
  237. package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +9 -9
  238. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +6 -2
  239. package/src/renderers/webgpu/WebGPUBackend.js +61 -4
  240. package/src/renderers/webgpu/WebGPURenderer.js +1 -1
  241. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +65 -23
  242. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +4 -17
  243. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +354 -186
  244. package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -0
  245. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +20 -7
  246. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +40 -17
  247. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +7 -7
  248. package/src/renderers/webgpu/utils/WebGPUUtils.js +7 -5
  249. package/src/textures/CubeDepthTexture.js +76 -0
  250. package/src/textures/Source.js +1 -1
  251. package/src/textures/Texture.js +1 -1
  252. package/src/utils.js +13 -1
  253. package/src/nodes/functions/BSDF/DFGApprox.js +0 -71
@@ -3167,8 +3167,8 @@ class VRMLLoader extends Loader {
3167
3167
  *
3168
3168
  * @param {BufferGeometry} geometry
3169
3169
  * @param {number} radius
3170
- * @param {array} angles
3171
- * @param {array} colors
3170
+ * @param {Array} angles
3171
+ * @param {Array} colors
3172
3172
  * @param {boolean} topDown - Whether to work top down or bottom up.
3173
3173
  */
3174
3174
  function paintFaces( geometry, radius, angles, colors, topDown ) {
@@ -4,7 +4,7 @@ import {
4
4
 
5
5
  class USDCParser {
6
6
 
7
- parse( buffer ) {
7
+ parse( /* buffer */ ) {
8
8
 
9
9
  // TODO
10
10
 
@@ -1,4 +1,4 @@
1
- import { Color } from 'three';
1
+ import { Color } from 'three/webgpu';
2
2
  import { attribute, cameraProjectionMatrix, dot, float, Fn, modelViewMatrix, modelViewProjection, NodeMaterial, normalize, positionGeometry, sign, uniform, varyingProperty, vec2, vec4 } from 'three/tsl';
3
3
 
4
4
  /**
@@ -221,7 +221,6 @@ const GouraudShader = {
221
221
  #endif
222
222
 
223
223
  #include <common>
224
- #include <packing>
225
224
  #include <dithering_pars_fragment>
226
225
  #include <color_pars_fragment>
227
226
  #include <uv_pars_fragment>
@@ -297,7 +297,7 @@ const woodParams = {
297
297
  teak: {
298
298
  transformationMatrix: new THREE.Matrix4().identity(),
299
299
  centerSize: 1.11, largeWarpScale: 0.32, largeGrainStretch: 0.24, smallWarpStrength: 0.059,
300
- smallWarpScale: 2, fineWarpStrength: 0.006, fineWarpScale: 32.8, ringThickness: 1/34,
300
+ smallWarpScale: 2, fineWarpStrength: 0.006, fineWarpScale: 32.8, ringThickness: 1 / 34,
301
301
  ringBias: 0.03, ringSizeVariance: 0.03, ringVarianceScale: 4.4, barkThickness: 0.3,
302
302
  splotchScale: 0.2, splotchIntensity: 0.541, cellScale: 910, cellSize: 0.1,
303
303
  darkGrainColor: '#0c0504', lightGrainColor: '#926c50'
@@ -305,7 +305,7 @@ const woodParams = {
305
305
  walnut: {
306
306
  transformationMatrix: new THREE.Matrix4().identity(),
307
307
  centerSize: 1.07, largeWarpScale: 0.42, largeGrainStretch: 0.34, smallWarpStrength: 0.016,
308
- smallWarpScale: 10.3, fineWarpStrength: 0.028, fineWarpScale: 12.7, ringThickness: 1/32,
308
+ smallWarpScale: 10.3, fineWarpStrength: 0.028, fineWarpScale: 12.7, ringThickness: 1 / 32,
309
309
  ringBias: 0.08, ringSizeVariance: 0.03, ringVarianceScale: 5.5, barkThickness: 0.98,
310
310
  splotchScale: 1.84, splotchIntensity: 0.97, cellScale: 710, cellSize: 0.31,
311
311
  darkGrainColor: '#311e13', lightGrainColor: '#523424'
@@ -313,7 +313,7 @@ const woodParams = {
313
313
  white_oak: {
314
314
  transformationMatrix: new THREE.Matrix4().identity(),
315
315
  centerSize: 1.23, largeWarpScale: 0.21, largeGrainStretch: 0.21, smallWarpStrength: 0.034,
316
- smallWarpScale: 2.44, fineWarpStrength: 0.01, fineWarpScale: 14.3, ringThickness: 1/34,
316
+ smallWarpScale: 2.44, fineWarpStrength: 0.01, fineWarpScale: 14.3, ringThickness: 1 / 34,
317
317
  ringBias: 0.82, ringSizeVariance: 0.16, ringVarianceScale: 1.4, barkThickness: 0.7,
318
318
  splotchScale: 0.2, splotchIntensity: 0.541, cellScale: 800, cellSize: 0.28,
319
319
  darkGrainColor: '#8b4c21', lightGrainColor: '#c57e43'
@@ -321,7 +321,7 @@ const woodParams = {
321
321
  pine: {
322
322
  transformationMatrix: new THREE.Matrix4().identity(),
323
323
  centerSize: 1.23, largeWarpScale: 0.21, largeGrainStretch: 0.18, smallWarpStrength: 0.041,
324
- smallWarpScale: 2.44, fineWarpStrength: 0.006, fineWarpScale: 23.2, ringThickness: 1/24,
324
+ smallWarpScale: 2.44, fineWarpStrength: 0.006, fineWarpScale: 23.2, ringThickness: 1 / 24,
325
325
  ringBias: 0.1, ringSizeVariance: 0.07, ringVarianceScale: 5, barkThickness: 0.35,
326
326
  splotchScale: 0.51, splotchIntensity: 3.32, cellScale: 1480, cellSize: 0.07,
327
327
  darkGrainColor: '#c58355', lightGrainColor: '#d19d61'
@@ -329,7 +329,7 @@ const woodParams = {
329
329
  poplar: {
330
330
  transformationMatrix: new THREE.Matrix4().identity(),
331
331
  centerSize: 1.43, largeWarpScale: 0.33, largeGrainStretch: 0.18, smallWarpStrength: 0.04,
332
- smallWarpScale: 4.3, fineWarpStrength: 0.004, fineWarpScale: 33.6, ringThickness: 1/37,
332
+ smallWarpScale: 4.3, fineWarpStrength: 0.004, fineWarpScale: 33.6, ringThickness: 1 / 37,
333
333
  ringBias: 0.07, ringSizeVariance: 0.03, ringVarianceScale: 3.8, barkThickness: 0.3,
334
334
  splotchScale: 1.92, splotchIntensity: 0.71, cellScale: 830, cellSize: 0.04,
335
335
  darkGrainColor: '#716347', lightGrainColor: '#998966'
@@ -337,7 +337,7 @@ const woodParams = {
337
337
  maple: {
338
338
  transformationMatrix: new THREE.Matrix4().identity(),
339
339
  centerSize: 1.4, largeWarpScale: 0.38, largeGrainStretch: 0.25, smallWarpStrength: 0.067,
340
- smallWarpScale: 2.5, fineWarpStrength: 0.005, fineWarpScale: 33.6, ringThickness: 1/35,
340
+ smallWarpScale: 2.5, fineWarpStrength: 0.005, fineWarpScale: 33.6, ringThickness: 1 / 35,
341
341
  ringBias: 0.1, ringSizeVariance: 0.07, ringVarianceScale: 4.6, barkThickness: 0.61,
342
342
  splotchScale: 0.46, splotchIntensity: 1.49, cellScale: 800, cellSize: 0.03,
343
343
  darkGrainColor: '#b08969', lightGrainColor: '#bc9d7d'
@@ -345,7 +345,7 @@ const woodParams = {
345
345
  red_oak: {
346
346
  transformationMatrix: new THREE.Matrix4().identity(),
347
347
  centerSize: 1.21, largeWarpScale: 0.24, largeGrainStretch: 0.25, smallWarpStrength: 0.044,
348
- smallWarpScale: 2.54, fineWarpStrength: 0.01, fineWarpScale: 14.5, ringThickness: 1/34,
348
+ smallWarpScale: 2.54, fineWarpStrength: 0.01, fineWarpScale: 14.5, ringThickness: 1 / 34,
349
349
  ringBias: 0.92, ringSizeVariance: 0.03, ringVarianceScale: 5.6, barkThickness: 1.01,
350
350
  splotchScale: 0.28, splotchIntensity: 3.48, cellScale: 800, cellSize: 0.25,
351
351
  darkGrainColor: '#af613b', lightGrainColor: '#e0a27a'
@@ -353,7 +353,7 @@ const woodParams = {
353
353
  cherry: {
354
354
  transformationMatrix: new THREE.Matrix4().identity(),
355
355
  centerSize: 1.33, largeWarpScale: 0.11, largeGrainStretch: 0.33, smallWarpStrength: 0.024,
356
- smallWarpScale: 2.48, fineWarpStrength: 0.01, fineWarpScale: 15.3, ringThickness: 1/36,
356
+ smallWarpScale: 2.48, fineWarpStrength: 0.01, fineWarpScale: 15.3, ringThickness: 1 / 36,
357
357
  ringBias: 0.02, ringSizeVariance: 0.04, ringVarianceScale: 6.5, barkThickness: 0.09,
358
358
  splotchScale: 1.27, splotchIntensity: 1.24, cellScale: 1530, cellSize: 0.15,
359
359
  darkGrainColor: '#913f27', lightGrainColor: '#b45837'
@@ -361,7 +361,7 @@ const woodParams = {
361
361
  cedar: {
362
362
  transformationMatrix: new THREE.Matrix4().identity(),
363
363
  centerSize: 1.11, largeWarpScale: 0.39, largeGrainStretch: 0.12, smallWarpStrength: 0.061,
364
- smallWarpScale: 1.9, fineWarpStrength: 0.006, fineWarpScale: 4.8, ringThickness: 1/25,
364
+ smallWarpScale: 1.9, fineWarpStrength: 0.006, fineWarpScale: 4.8, ringThickness: 1 / 25,
365
365
  ringBias: 0.01, ringSizeVariance: 0.07, ringVarianceScale: 6.7, barkThickness: 0.1,
366
366
  splotchScale: 0.61, splotchIntensity: 2.54, cellScale: 630, cellSize: 0.19,
367
367
  darkGrainColor: '#9a5b49', lightGrainColor: '#ae745e'
@@ -369,7 +369,7 @@ const woodParams = {
369
369
  mahogany: {
370
370
  transformationMatrix: new THREE.Matrix4().identity(),
371
371
  centerSize: 1.25, largeWarpScale: 0.26, largeGrainStretch: 0.29, smallWarpStrength: 0.044,
372
- smallWarpScale: 2.54, fineWarpStrength: 0.01, fineWarpScale: 15.3, ringThickness: 1/38,
372
+ smallWarpScale: 2.54, fineWarpStrength: 0.01, fineWarpScale: 15.3, ringThickness: 1 / 38,
373
373
  ringBias: 0.01, ringSizeVariance: 0.33, ringVarianceScale: 1.2, barkThickness: 0.07,
374
374
  splotchScale: 0.77, splotchIntensity: 1.39, cellScale: 1400, cellSize: 0.23,
375
375
  darkGrainColor: '#501d12', lightGrainColor: '#6d3722'
@@ -433,7 +433,7 @@ uniforms.lightGrainColor = TSL.uniform( new THREE.Color( params.lightGrainColor
433
433
  uniforms.transformationMatrix = TSL.uniform( new THREE.Matrix4().copy( params.transformationMatrix ) ).onObjectUpdate( ( { material } ) => material.transformationMatrix );
434
434
 
435
435
  const colorNode = wood(
436
- uniforms.transformationMatrix.mul( TSL.vec4(TSL.positionLocal, 1) ).xyz,
436
+ uniforms.transformationMatrix.mul( TSL.vec4( TSL.positionLocal, 1 ) ).xyz,
437
437
  uniforms.centerSize,
438
438
  uniforms.largeWarpScale,
439
439
  uniforms.largeGrainStretch,
@@ -17,8 +17,10 @@ const _point2 = new Vector3();
17
17
  const _plane = new Plane();
18
18
  const _line1 = new Line3();
19
19
  const _line2 = new Line3();
20
+ const _box = new Box3();
20
21
  const _sphere = new Sphere();
21
22
  const _capsule = new Capsule();
23
+ const _center = new Vector3();
22
24
 
23
25
  const _temp1 = new Vector3();
24
26
  const _temp2 = new Vector3();
@@ -373,6 +375,61 @@ class Octree {
373
375
 
374
376
  }
375
377
 
378
+ /**
379
+ * Computes the intersection between the given bounding box and triangle.
380
+ *
381
+ * @param {Box3} box - The bounding box to test.
382
+ * @param {Triangle} triangle - The triangle to test.
383
+ * @return {Object|false} The intersection object. If no intersection
384
+ * is detected, the method returns `false`.
385
+ */
386
+ triangleBoxIntersect( box, triangle ) {
387
+
388
+ // cheap check
389
+
390
+ if ( Math.max( triangle.a.x, triangle.b.x, triangle.c.x ) < box.min.x ||
391
+ Math.min( triangle.a.x, triangle.b.x, triangle.c.x ) > box.max.x ||
392
+ Math.max( triangle.a.y, triangle.b.y, triangle.c.y ) < box.min.y ||
393
+ Math.min( triangle.a.y, triangle.b.y, triangle.c.y ) > box.max.y ||
394
+ Math.max( triangle.a.z, triangle.b.z, triangle.c.z ) < box.min.z ||
395
+ Math.min( triangle.a.z, triangle.b.z, triangle.c.z ) > box.max.z ) {
396
+
397
+ return false;
398
+
399
+ }
400
+
401
+ // expensive check
402
+
403
+ if ( ! box.intersectsTriangle( triangle ) ) return false;
404
+
405
+ // there is an intersection, now compute collision data
406
+
407
+ triangle.getPlane( _plane );
408
+
409
+ // determine which corner of the box is "deepest" into the plane
410
+
411
+ _v1.x = ( _plane.normal.x > 0 ) ? box.min.x : box.max.x;
412
+ _v1.y = ( _plane.normal.y > 0 ) ? box.min.y : box.max.y;
413
+ _v1.z = ( _plane.normal.z > 0 ) ? box.min.z : box.max.z;
414
+
415
+ // Calculate the distance from the plane to that corner (the distance will be negative
416
+ // because of the intersection)
417
+
418
+ const distance = _plane.distanceToPoint( _v1 );
419
+
420
+ const intersection = {
421
+ depth: - distance, // Flip sign so depth is positive
422
+ normal: _plane.normal.clone(),
423
+ point: _v1.clone()
424
+ };
425
+
426
+ // project the point onto the triangle surface
427
+ intersection.point.addScaledVector( intersection.normal, distance );
428
+
429
+ return intersection;
430
+
431
+ }
432
+
376
433
  /**
377
434
  * Computes the intersection between the given sphere and triangle.
378
435
  *
@@ -455,6 +512,38 @@ class Octree {
455
512
 
456
513
  }
457
514
 
515
+ /**
516
+ * Computes the triangles that potentially intersect with the given bounding box.
517
+ *
518
+ * @param {Box3} box - The bounding box.
519
+ * @param {Array<Triangle>} triangles - The target array that holds the triangles.
520
+ */
521
+ getBoxTriangles( box, triangles ) {
522
+
523
+ for ( let i = 0; i < this.subTrees.length; i ++ ) {
524
+
525
+ const subTree = this.subTrees[ i ];
526
+
527
+ if ( ! box.intersectsBox( subTree.box ) ) continue;
528
+
529
+ if ( subTree.triangles.length > 0 ) {
530
+
531
+ for ( let j = 0; j < subTree.triangles.length; j ++ ) {
532
+
533
+ if ( triangles.indexOf( subTree.triangles[ j ] ) === - 1 ) triangles.push( subTree.triangles[ j ] );
534
+
535
+ }
536
+
537
+ } else {
538
+
539
+ subTree.getBoxTriangles( box, triangles );
540
+
541
+ }
542
+
543
+ }
544
+
545
+ }
546
+
458
547
  /**
459
548
  * Computes the triangles that potentially intersect with the given capsule.
460
549
  *
@@ -487,6 +576,47 @@ class Octree {
487
576
 
488
577
  }
489
578
 
579
+ /**
580
+ * Performs a bounding box intersection test with this Octree.
581
+ *
582
+ * @param {Box3} box - The bounding box to test.
583
+ * @return {Object|boolean} The intersection object. If no intersection
584
+ * is detected, the method returns `false`.
585
+ */
586
+ boxIntersect( box ) {
587
+
588
+ _box.copy( box );
589
+
590
+ const triangles = [];
591
+ let result, hit = false;
592
+
593
+ this.getBoxTriangles( box, triangles );
594
+
595
+ for ( let i = 0; i < triangles.length; i ++ ) {
596
+
597
+ if ( result = this.triangleBoxIntersect( _box, triangles[ i ] ) ) {
598
+
599
+ hit = true;
600
+
601
+ _box.translate( result.normal.multiplyScalar( result.depth ) );
602
+
603
+ }
604
+
605
+ }
606
+
607
+ if ( hit ) {
608
+
609
+ const collisionVector = _box.getCenter( _center ).sub( box.getCenter( _v1 ) );
610
+ const depth = collisionVector.length();
611
+
612
+ return { normal: collisionVector.normalize(), depth: depth };
613
+
614
+ }
615
+
616
+ return false;
617
+
618
+ }
619
+
490
620
  /**
491
621
  * Performs a bounding sphere intersection test with this Octree.
492
622
  *
@@ -558,7 +688,7 @@ class Octree {
558
688
 
559
689
  if ( hit ) {
560
690
 
561
- const collisionVector = _capsule.getCenter( new Vector3() ).sub( capsule.getCenter( _v1 ) );
691
+ const collisionVector = _capsule.getCenter( _center ).sub( capsule.getCenter( _v1 ) );
562
692
  const depth = collisionVector.length();
563
693
 
564
694
  return { normal: collisionVector.normalize(), depth: depth };
@@ -123,7 +123,6 @@ class Volume {
123
123
  case 'uint64' :
124
124
  case 'uint64_t' :
125
125
  throw new Error( 'Error in Volume constructor : this type is not supported in JavaScript' );
126
- break;
127
126
  case 'Float32' :
128
127
  case 'float32' :
129
128
  case 'float' :
@@ -54,7 +54,6 @@ class VolumeSlice {
54
54
 
55
55
  index = value;
56
56
  slice.geometryNeedsUpdate = true;
57
- return index;
58
57
 
59
58
  }
60
59
  } );
@@ -12,8 +12,8 @@ import { Fn, float, vec3, acos, add, mul, clamp, cos, dot, exp, max, mix, modelV
12
12
  * Represents a skydome for scene backgrounds. Based on [A Practical Analytic Model for Daylight](https://www.researchgate.net/publication/220720443_A_Practical_Analytic_Model_for_Daylight)
13
13
  * aka The Preetham Model, the de facto standard for analytical skydomes.
14
14
  *
15
- * Note that this class can only be used with {@link WebGLRenderer}.
16
- * When using {@link WebGPURenderer}, use {@link SkyMesh}.
15
+ * Note that this class can only be used with {@link WebGPURenderer}.
16
+ * When using {@link WebGLRenderer}, use {@link Sky}.
17
17
  *
18
18
  * More references:
19
19
  *
@@ -88,8 +88,18 @@ class SkyMesh extends Mesh {
88
88
  * @type {boolean}
89
89
  * @readonly
90
90
  * @default true
91
+ * @deprecated Use isSkyMesh instead.
91
92
  */
92
- this.isSky = true;
93
+ this.isSky = true; // @deprecated, r182
94
+
95
+ /**
96
+ * This flag can be used for type testing.
97
+ *
98
+ * @type {boolean}
99
+ * @readonly
100
+ * @default true
101
+ */
102
+ this.isSkyMesh = true;
93
103
 
94
104
  // Varyings
95
105
 
@@ -23,7 +23,7 @@ async function AmmoPhysics() {
23
23
 
24
24
  }
25
25
 
26
- const AmmoLib = await Ammo(); // eslint-disable-line no-undef
26
+ const AmmoLib = await Ammo();
27
27
 
28
28
  const frameRate = 60;
29
29
 
@@ -66,6 +66,8 @@ async function AmmoPhysics() {
66
66
 
67
67
  }
68
68
 
69
+ console.error( 'AmmoPhysics: Unsupported geometry type:', geometry.type );
70
+
69
71
  return null;
70
72
 
71
73
  }
@@ -83,7 +85,7 @@ async function AmmoPhysics() {
83
85
 
84
86
  if ( physics ) {
85
87
 
86
- addMesh( child, physics.mass );
88
+ addMesh( child, physics.mass, physics.restitution );
87
89
 
88
90
  }
89
91
 
@@ -93,7 +95,7 @@ async function AmmoPhysics() {
93
95
 
94
96
  }
95
97
 
96
- function addMesh( mesh, mass = 0 ) {
98
+ function addMesh( mesh, mass = 0, restitution = 0 ) {
97
99
 
98
100
  const shape = getShape( mesh.geometry );
99
101
 
@@ -101,11 +103,11 @@ async function AmmoPhysics() {
101
103
 
102
104
  if ( mesh.isInstancedMesh ) {
103
105
 
104
- handleInstancedMesh( mesh, mass, shape );
106
+ handleInstancedMesh( mesh, shape, mass, restitution );
105
107
 
106
108
  } else if ( mesh.isMesh ) {
107
109
 
108
- handleMesh( mesh, mass, shape );
110
+ handleMesh( mesh, shape, mass, restitution );
109
111
 
110
112
  }
111
113
 
@@ -113,7 +115,7 @@ async function AmmoPhysics() {
113
115
 
114
116
  }
115
117
 
116
- function handleMesh( mesh, mass, shape ) {
118
+ function handleMesh( mesh, shape, mass, restitution ) {
117
119
 
118
120
  const position = mesh.position;
119
121
  const quaternion = mesh.quaternion;
@@ -129,6 +131,7 @@ async function AmmoPhysics() {
129
131
  shape.calculateLocalInertia( mass, localInertia );
130
132
 
131
133
  const rbInfo = new AmmoLib.btRigidBodyConstructionInfo( mass, motionState, shape, localInertia );
134
+ rbInfo.set_m_restitution( restitution );
132
135
 
133
136
  const body = new AmmoLib.btRigidBody( rbInfo );
134
137
  // body.setFriction( 4 );
@@ -144,7 +147,7 @@ async function AmmoPhysics() {
144
147
 
145
148
  }
146
149
 
147
- function handleInstancedMesh( mesh, mass, shape ) {
150
+ function handleInstancedMesh( mesh, shape, mass, restitution ) {
148
151
 
149
152
  const array = mesh.instanceMatrix.array;
150
153
 
@@ -163,6 +166,7 @@ async function AmmoPhysics() {
163
166
  shape.calculateLocalInertia( mass, localInertia );
164
167
 
165
168
  const rbInfo = new AmmoLib.btRigidBodyConstructionInfo( mass, motionState, shape, localInertia );
169
+ rbInfo.set_m_restitution( restitution );
166
170
 
167
171
  const body = new AmmoLib.btRigidBody( rbInfo );
168
172
  world.addRigidBody( body );
@@ -302,6 +306,7 @@ async function AmmoPhysics() {
302
306
  * @name AmmoPhysics#addMesh
303
307
  * @param {Mesh} mesh The mesh to add.
304
308
  * @param {number} [mass=0] The mass in kg of the mesh.
309
+ * @param {number} [restitution=0] The restitution of the mesh, usually from 0 to 1. Represents how "bouncy" objects are when they collide with each other.
305
310
  */
306
311
  addMesh: addMesh,
307
312
 
@@ -28,6 +28,8 @@ function getShape( geometry ) {
28
28
 
29
29
  }
30
30
 
31
+ console.error( 'JoltPhysics: Unsupported geometry type:', geometry.type );
32
+
31
33
  return null;
32
34
 
33
35
  }
@@ -305,7 +307,7 @@ async function JoltPhysics() {
305
307
  * @name JoltPhysics#addMesh
306
308
  * @param {Mesh} mesh The mesh to add.
307
309
  * @param {number} [mass=0] The mass in kg of the mesh.
308
- * @param {number} [restitution=0] The restitution/friction of the mesh.
310
+ * @param {number} [restitution=0] The restitution of the mesh, usually from 0 to 1. Represents how "bouncy" objects are when they collide with each other.
309
311
  */
310
312
  addMesh: addMesh,
311
313
 
@@ -73,6 +73,8 @@ function getShape( geometry ) {
73
73
 
74
74
  }
75
75
 
76
+ console.error( 'RapierPhysics: Unsupported geometry type:', geometry.type );
77
+
76
78
  return null;
77
79
 
78
80
  }
@@ -372,7 +374,7 @@ async function RapierPhysics() {
372
374
  * @name RapierPhysics#addMesh
373
375
  * @param {Mesh} mesh The mesh to add.
374
376
  * @param {number} [mass=0] The mass in kg of the mesh.
375
- * @param {number} [restitution=0] The restitution/friction of the mesh.
377
+ * @param {number} [restitution=0] The restitution of the mesh, usually from 0 to 1. Represents how "bouncy" objects are when they collide with each other.
376
378
  */
377
379
  addMesh: addMesh,
378
380
 
@@ -39,6 +39,15 @@ class OutputPass extends Pass {
39
39
 
40
40
  super();
41
41
 
42
+ /**
43
+ * This flag indicates that this is an output pass.
44
+ *
45
+ * @type {boolean}
46
+ * @readonly
47
+ * @default true
48
+ */
49
+ this.isOutputPass = true;
50
+
42
51
  /**
43
52
  * The pass uniforms.
44
53
  *
@@ -93,6 +93,16 @@ class RenderPass extends Pass {
93
93
  * @default false
94
94
  */
95
95
  this.needsSwap = false;
96
+
97
+ /**
98
+ * This flag indicates that this pass renders the scene itself.
99
+ *
100
+ * @type {boolean}
101
+ * @readonly
102
+ * @default true
103
+ */
104
+ this.isRenderPass = true;
105
+
96
106
  this._oldClearColor = new Color();
97
107
 
98
108
  }
@@ -56,7 +56,7 @@ class UnrealBloomPass extends Pass {
56
56
  this.strength = strength;
57
57
 
58
58
  /**
59
- * The Bloom radius.
59
+ * The Bloom radius. Must be in the range `[0,1]`.
60
60
  *
61
61
  * @type {number}
62
62
  */
@@ -187,6 +187,7 @@ class UnrealBloomPass extends Pass {
187
187
  uniforms: this.copyUniforms,
188
188
  vertexShader: CopyShader.vertexShader,
189
189
  fragmentShader: CopyShader.fragmentShader,
190
+ premultipliedAlpha: true,
190
191
  blending: AdditiveBlending,
191
192
  depthTest: false,
192
193
  depthWrite: false,
@@ -399,33 +400,46 @@ class UnrealBloomPass extends Pass {
399
400
  'gaussianCoefficients': { value: coefficients } // precomputed Gaussian coefficients
400
401
  },
401
402
 
402
- vertexShader:
403
- `varying vec2 vUv;
403
+ vertexShader: /* glsl */`
404
+
405
+ varying vec2 vUv;
406
+
404
407
  void main() {
408
+
405
409
  vUv = uv;
406
410
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
411
+
407
412
  }`,
408
413
 
409
- fragmentShader:
410
- `#include <common>
414
+ fragmentShader: /* glsl */`
415
+
416
+ #include <common>
417
+
411
418
  varying vec2 vUv;
419
+
412
420
  uniform sampler2D colorTexture;
413
421
  uniform vec2 invSize;
414
422
  uniform vec2 direction;
415
423
  uniform float gaussianCoefficients[KERNEL_RADIUS];
416
424
 
417
425
  void main() {
426
+
418
427
  float weightSum = gaussianCoefficients[0];
419
428
  vec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;
420
- for( int i = 1; i < KERNEL_RADIUS; i ++ ) {
421
- float x = float(i);
429
+
430
+ for ( int i = 1; i < KERNEL_RADIUS; i ++ ) {
431
+
432
+ float x = float( i );
422
433
  float w = gaussianCoefficients[i];
423
434
  vec2 uvOffset = direction * invSize * x;
424
435
  vec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;
425
436
  vec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;
426
437
  diffuseSum += ( sample1 + sample2 ) * w;
438
+
427
439
  }
440
+
428
441
  gl_FragColor = vec4( diffuseSum, 1.0 );
442
+
429
443
  }`
430
444
  } );
431
445
 
@@ -451,15 +465,21 @@ class UnrealBloomPass extends Pass {
451
465
  'bloomRadius': { value: 0.0 }
452
466
  },
453
467
 
454
- vertexShader:
455
- `varying vec2 vUv;
468
+ vertexShader: /* glsl */`
469
+
470
+ varying vec2 vUv;
471
+
456
472
  void main() {
473
+
457
474
  vUv = uv;
458
475
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
476
+
459
477
  }`,
460
478
 
461
- fragmentShader:
462
- `varying vec2 vUv;
479
+ fragmentShader: /* glsl */`
480
+
481
+ varying vec2 vUv;
482
+
463
483
  uniform sampler2D blurTexture1;
464
484
  uniform sampler2D blurTexture2;
465
485
  uniform sampler2D blurTexture3;
@@ -470,17 +490,27 @@ class UnrealBloomPass extends Pass {
470
490
  uniform float bloomFactors[NUM_MIPS];
471
491
  uniform vec3 bloomTintColors[NUM_MIPS];
472
492
 
473
- float lerpBloomFactor(const in float factor) {
493
+ float lerpBloomFactor( const in float factor ) {
494
+
474
495
  float mirrorFactor = 1.2 - factor;
475
- return mix(factor, mirrorFactor, bloomRadius);
496
+ return mix( factor, mirrorFactor, bloomRadius );
497
+
476
498
  }
477
499
 
478
500
  void main() {
479
- gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +
480
- lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +
481
- lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +
482
- lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +
483
- lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );
501
+
502
+ // 3.0 for backwards compatibility with previous alpha-based intensity
503
+ vec3 bloom = 3.0 * bloomStrength * (
504
+ lerpBloomFactor( bloomFactors[ 0 ] ) * bloomTintColors[ 0 ] * texture2D( blurTexture1, vUv ).rgb +
505
+ lerpBloomFactor( bloomFactors[ 1 ] ) * bloomTintColors[ 1 ] * texture2D( blurTexture2, vUv ).rgb +
506
+ lerpBloomFactor( bloomFactors[ 2 ] ) * bloomTintColors[ 2 ] * texture2D( blurTexture3, vUv ).rgb +
507
+ lerpBloomFactor( bloomFactors[ 3 ] ) * bloomTintColors[ 3 ] * texture2D( blurTexture4, vUv ).rgb +
508
+ lerpBloomFactor( bloomFactors[ 4 ] ) * bloomTintColors[ 4 ] * texture2D( blurTexture5, vUv ).rgb
509
+ );
510
+
511
+ float bloomAlpha = max( bloom.r, max( bloom.g, bloom.b ) );
512
+ gl_FragColor = vec4( bloom, bloomAlpha );
513
+
484
514
  }`
485
515
  } );
486
516