super-three 0.168.0 → 0.169.1

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 (288) hide show
  1. package/build/three.cjs +384 -700
  2. package/build/three.module.js +384 -700
  3. package/build/three.module.min.js +1 -1
  4. package/build/three.webgpu.js +24644 -22406
  5. package/build/three.webgpu.min.js +1 -1
  6. package/build/three.webgpu.nodes.js +79941 -0
  7. package/build/three.webgpu.nodes.min.js +6 -0
  8. package/examples/jsm/Addons.js +0 -6
  9. package/examples/jsm/controls/TrackballControls.js +32 -12
  10. package/examples/jsm/controls/TransformControls.js +97 -62
  11. package/examples/jsm/exporters/DRACOExporter.js +4 -2
  12. package/examples/jsm/exporters/EXRExporter.js +19 -11
  13. package/examples/jsm/exporters/KTX2Exporter.js +21 -13
  14. package/examples/jsm/exporters/OBJExporter.js +5 -1
  15. package/examples/jsm/exporters/PLYExporter.js +9 -7
  16. package/examples/jsm/geometries/DecalGeometry.js +4 -1
  17. package/examples/jsm/geometries/InstancedPointsGeometry.js +1 -1
  18. package/examples/jsm/helpers/LightProbeHelper.js +1 -1
  19. package/examples/jsm/helpers/LightProbeHelperGPU.js +65 -0
  20. package/examples/jsm/libs/basis/basis_transcoder.js +8 -10
  21. package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
  22. package/examples/jsm/libs/ktx-parse.module.js +1 -1
  23. package/examples/jsm/lights/LightProbeGenerator.js +24 -10
  24. package/examples/jsm/loaders/ColladaLoader.js +9 -6
  25. package/examples/jsm/loaders/DRACOLoader.js +3 -1
  26. package/examples/jsm/loaders/FBXLoader.js +30 -20
  27. package/examples/jsm/loaders/GLTFLoader.js +5 -10
  28. package/examples/jsm/loaders/KTX2Loader.js +10 -7
  29. package/examples/jsm/loaders/MTLLoader.js +4 -3
  30. package/examples/jsm/loaders/MaterialXLoader.js +29 -10
  31. package/examples/jsm/loaders/OBJLoader.js +5 -3
  32. package/examples/jsm/loaders/PCDLoader.js +5 -4
  33. package/examples/jsm/loaders/PDBLoader.js +3 -2
  34. package/examples/jsm/loaders/PLYLoader.js +8 -5
  35. package/examples/jsm/loaders/STLLoader.js +3 -2
  36. package/examples/jsm/loaders/VRMLLoader.js +10 -10
  37. package/examples/jsm/loaders/VTKLoader.js +4 -3
  38. package/examples/jsm/loaders/XYZLoader.js +3 -2
  39. package/examples/jsm/misc/Timer.js +1 -1
  40. package/examples/jsm/modifiers/CurveModifierGPU.js +233 -0
  41. package/examples/jsm/objects/LensflareMesh.js +322 -0
  42. package/examples/jsm/objects/SkyMesh.js +1 -2
  43. package/examples/jsm/objects/Water2Mesh.js +2 -3
  44. package/examples/jsm/objects/WaterMesh.js +1 -2
  45. package/examples/jsm/physics/JoltPhysics.js +1 -1
  46. package/examples/jsm/physics/RapierPhysics.js +1 -1
  47. package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
  48. package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -2
  49. package/examples/jsm/utils/GeometryCompressionUtils.js +37 -122
  50. package/examples/jsm/utils/ShadowMapViewer.js +3 -8
  51. package/examples/jsm/utils/ShadowMapViewerGPU.js +201 -0
  52. package/examples/jsm/utils/SkeletonUtils.js +84 -66
  53. package/examples/jsm/utils/TextureUtils.js +1 -0
  54. package/examples/jsm/utils/TextureUtilsGPU.js +63 -0
  55. package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
  56. package/package.json +2 -2
  57. package/src/Three.WebGPU.Nodes.js +200 -0
  58. package/src/Three.WebGPU.js +2 -1
  59. package/src/audio/Audio.js +2 -2
  60. package/src/constants.js +1 -1
  61. package/src/core/BufferAttribute.js +0 -9
  62. package/src/core/Clock.js +1 -1
  63. package/src/core/InterleavedBuffer.js +0 -9
  64. package/src/extras/Controls.js +1 -1
  65. package/src/geometries/CylinderGeometry.js +11 -4
  66. package/src/loaders/MaterialLoader.js +7 -1
  67. package/src/loaders/nodes/NodeLoader.js +24 -4
  68. package/src/loaders/nodes/NodeMaterialLoader.js +21 -17
  69. package/src/loaders/nodes/NodeObjectLoader.js +19 -0
  70. package/src/materials/nodes/InstancedPointsNodeMaterial.js +19 -34
  71. package/src/materials/nodes/Line2NodeMaterial.js +26 -26
  72. package/src/materials/nodes/LineBasicNodeMaterial.js +7 -3
  73. package/src/materials/nodes/LineDashedNodeMaterial.js +7 -3
  74. package/src/materials/nodes/MeshBasicNodeMaterial.js +7 -3
  75. package/src/materials/nodes/MeshLambertNodeMaterial.js +7 -3
  76. package/src/materials/nodes/MeshMatcapNodeMaterial.js +7 -3
  77. package/src/materials/nodes/MeshNormalNodeMaterial.js +7 -3
  78. package/src/materials/nodes/MeshPhongNodeMaterial.js +7 -3
  79. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +6 -3
  80. package/src/materials/nodes/MeshSSSNodeMaterial.js +6 -3
  81. package/src/materials/nodes/MeshStandardNodeMaterial.js +7 -3
  82. package/src/materials/nodes/MeshToonNodeMaterial.js +7 -3
  83. package/src/materials/nodes/NodeMaterial.js +20 -45
  84. package/src/materials/nodes/NodeMaterials.js +2 -0
  85. package/src/materials/nodes/PointsNodeMaterial.js +7 -3
  86. package/src/materials/nodes/ShadowNodeMaterial.js +7 -3
  87. package/src/materials/nodes/SpriteNodeMaterial.js +39 -6
  88. package/src/materials/nodes/VolumeNodeMaterial.js +13 -9
  89. package/src/materials/nodes/manager/NodeMaterialObserver.js +302 -0
  90. package/src/math/Triangle.js +24 -0
  91. package/src/nodes/Nodes.js +3 -3
  92. package/src/nodes/TSL.js +96 -93
  93. package/src/nodes/accessors/BatchNode.js +7 -3
  94. package/src/nodes/accessors/BufferAttributeNode.js +6 -3
  95. package/src/nodes/accessors/BufferNode.js +6 -3
  96. package/src/nodes/accessors/Camera.js +10 -16
  97. package/src/nodes/accessors/ClippingNode.js +7 -3
  98. package/src/nodes/accessors/CubeTextureNode.js +6 -3
  99. package/src/nodes/accessors/InstanceNode.js +11 -11
  100. package/src/nodes/accessors/InstancedPointsMaterialNode.js +6 -3
  101. package/src/nodes/accessors/Lights.js +51 -0
  102. package/src/nodes/accessors/MaterialNode.js +8 -4
  103. package/src/nodes/accessors/MaterialReferenceNode.js +6 -3
  104. package/src/nodes/accessors/ModelNode.js +42 -7
  105. package/src/nodes/accessors/ModelViewProjectionNode.js +9 -5
  106. package/src/nodes/accessors/MorphNode.js +7 -3
  107. package/src/nodes/accessors/Normal.js +32 -6
  108. package/src/nodes/accessors/Object3DNode.js +11 -27
  109. package/src/nodes/accessors/PointUVNode.js +7 -3
  110. package/src/nodes/accessors/ReferenceBaseNode.js +32 -4
  111. package/src/nodes/accessors/ReferenceNode.js +40 -3
  112. package/src/nodes/accessors/RendererReferenceNode.js +9 -3
  113. package/src/nodes/accessors/SceneNode.js +7 -3
  114. package/src/nodes/accessors/SkinningNode.js +7 -3
  115. package/src/nodes/accessors/StorageBufferNode.js +21 -3
  116. package/src/nodes/accessors/StorageTextureNode.js +7 -4
  117. package/src/nodes/accessors/Texture3DNode.js +7 -4
  118. package/src/nodes/accessors/TextureNode.js +19 -8
  119. package/src/nodes/accessors/TextureSizeNode.js +8 -5
  120. package/src/nodes/accessors/UniformArrayNode.js +12 -9
  121. package/src/nodes/accessors/UserDataNode.js +9 -6
  122. package/src/nodes/accessors/VelocityNode.js +74 -23
  123. package/src/nodes/accessors/VertexColorNode.js +6 -3
  124. package/src/nodes/code/CodeNode.js +7 -3
  125. package/src/nodes/code/ExpressionNode.js +8 -4
  126. package/src/nodes/code/FunctionCallNode.js +6 -3
  127. package/src/nodes/code/FunctionNode.js +6 -3
  128. package/src/nodes/code/ScriptableNode.js +11 -6
  129. package/src/nodes/code/ScriptableValueNode.js +7 -3
  130. package/src/nodes/core/AssignNode.js +9 -6
  131. package/src/nodes/core/AttributeNode.js +7 -3
  132. package/src/nodes/core/BypassNode.js +8 -4
  133. package/src/nodes/core/CacheNode.js +8 -4
  134. package/src/nodes/core/ConstNode.js +6 -3
  135. package/src/nodes/core/ContextNode.js +7 -3
  136. package/src/nodes/core/IndexNode.js +25 -3
  137. package/src/nodes/core/InputNode.js +7 -3
  138. package/src/nodes/core/MRTNode.js +6 -3
  139. package/src/nodes/core/Node.js +10 -51
  140. package/src/nodes/core/NodeBuilder.js +71 -5
  141. package/src/nodes/core/NodeUtils.js +48 -6
  142. package/src/nodes/core/OutputStructNode.js +8 -4
  143. package/src/nodes/core/ParameterNode.js +6 -3
  144. package/src/nodes/core/PropertyNode.js +7 -3
  145. package/src/nodes/core/StackNode.js +7 -3
  146. package/src/nodes/core/StructTypeNode.js +7 -3
  147. package/src/nodes/core/TempNode.js +8 -4
  148. package/src/nodes/core/UniformGroupNode.js +10 -6
  149. package/src/nodes/core/UniformNode.js +6 -3
  150. package/src/nodes/core/VarNode.js +8 -4
  151. package/src/nodes/core/VaryingNode.js +7 -3
  152. package/src/nodes/display/AfterImageNode.js +6 -0
  153. package/src/nodes/display/AnaglyphPassNode.js +6 -0
  154. package/src/nodes/display/AnamorphicNode.js +6 -0
  155. package/src/nodes/display/BloomNode.js +6 -0
  156. package/src/nodes/display/BumpMapNode.js +6 -0
  157. package/src/nodes/display/ColorSpaceFunctions.js +4 -4
  158. package/src/nodes/display/ColorSpaceNode.js +43 -14
  159. package/src/nodes/display/DenoiseNode.js +6 -3
  160. package/src/nodes/display/DepthOfFieldNode.js +6 -3
  161. package/src/nodes/display/DotScreenNode.js +8 -5
  162. package/src/nodes/display/FXAANode.js +6 -3
  163. package/src/nodes/display/FilmNode.js +6 -3
  164. package/src/nodes/display/FrontFacingNode.js +7 -3
  165. package/src/nodes/display/GTAONode.js +6 -3
  166. package/src/nodes/display/GaussianBlurNode.js +6 -3
  167. package/src/nodes/display/Lut3DNode.js +6 -3
  168. package/src/nodes/display/NormalMapNode.js +8 -6
  169. package/src/nodes/display/ParallaxBarrierPassNode.js +8 -5
  170. package/src/nodes/display/PassNode.js +18 -7
  171. package/src/nodes/display/PixelationPassNode.js +12 -5
  172. package/src/nodes/display/PosterizeNode.js +6 -3
  173. package/src/nodes/display/RGBShiftNode.js +6 -3
  174. package/src/nodes/display/RenderOutputNode.js +12 -8
  175. package/src/nodes/display/SSAAPassNode.js +6 -3
  176. package/src/nodes/display/ScreenNode.js +181 -0
  177. package/src/nodes/display/SobelOperatorNode.js +6 -3
  178. package/src/nodes/display/StereoCompositePassNode.js +6 -3
  179. package/src/nodes/display/StereoPassNode.js +6 -3
  180. package/src/nodes/display/ToneMappingFunctions.js +12 -12
  181. package/src/nodes/display/ToneMappingNode.js +8 -7
  182. package/src/nodes/display/ToonOutlinePassNode.js +111 -0
  183. package/src/nodes/display/TransitionNode.js +6 -3
  184. package/src/nodes/display/ViewportDepthNode.js +7 -3
  185. package/src/nodes/display/ViewportDepthTextureNode.js +8 -5
  186. package/src/nodes/display/ViewportSharedTextureNode.js +8 -5
  187. package/src/nodes/display/ViewportTextureNode.js +8 -5
  188. package/src/nodes/fog/FogExp2Node.js +6 -3
  189. package/src/nodes/fog/FogNode.js +7 -3
  190. package/src/nodes/fog/FogRangeNode.js +6 -3
  191. package/src/nodes/functions/PhysicalLightingModel.js +2 -2
  192. package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
  193. package/src/nodes/geometry/RangeNode.js +7 -3
  194. package/src/nodes/gpgpu/AtomicFunctionNode.js +99 -0
  195. package/src/nodes/gpgpu/BarrierNode.js +40 -0
  196. package/src/nodes/gpgpu/ComputeBuiltinNode.js +98 -0
  197. package/src/nodes/gpgpu/ComputeNode.js +8 -4
  198. package/src/nodes/gpgpu/WorkgroupInfoNode.js +100 -0
  199. package/src/nodes/lighting/AONode.js +6 -3
  200. package/src/nodes/lighting/AmbientLightNode.js +6 -3
  201. package/src/nodes/lighting/AnalyticLightNode.js +198 -30
  202. package/src/nodes/lighting/BasicEnvironmentNode.js +6 -3
  203. package/src/nodes/lighting/BasicLightMapNode.js +6 -3
  204. package/src/nodes/lighting/DirectionalLightNode.js +7 -4
  205. package/src/nodes/lighting/EnvironmentNode.js +6 -3
  206. package/src/nodes/lighting/HemisphereLightNode.js +10 -6
  207. package/src/nodes/lighting/IESSpotLightNode.js +6 -3
  208. package/src/nodes/lighting/IrradianceNode.js +6 -3
  209. package/src/nodes/lighting/LightProbeNode.js +8 -31
  210. package/src/nodes/lighting/LightingContextNode.js +6 -3
  211. package/src/nodes/lighting/LightingNode.js +7 -3
  212. package/src/nodes/lighting/LightsNode.js +24 -5
  213. package/src/nodes/lighting/PointLightNode.js +11 -7
  214. package/src/nodes/lighting/RectAreaLightNode.js +11 -7
  215. package/src/nodes/lighting/SpotLightNode.js +13 -10
  216. package/src/nodes/math/ConditionalNode.js +23 -6
  217. package/src/nodes/math/MathNode.js +6 -3
  218. package/src/nodes/math/OperatorNode.js +6 -3
  219. package/src/nodes/pmrem/PMREMNode.js +6 -3
  220. package/src/nodes/utils/ArrayElementNode.js +8 -4
  221. package/src/nodes/utils/ConvertNode.js +7 -3
  222. package/src/nodes/utils/CubeMapNode.js +6 -3
  223. package/src/nodes/utils/EquirectUVNode.js +6 -3
  224. package/src/nodes/utils/FlipNode.js +7 -4
  225. package/src/nodes/utils/FunctionOverloadingNode.js +7 -3
  226. package/src/nodes/utils/JoinNode.js +6 -3
  227. package/src/nodes/utils/LoopNode.js +7 -3
  228. package/src/nodes/utils/MatcapUVNode.js +6 -3
  229. package/src/nodes/utils/MaxMipLevelNode.js +6 -3
  230. package/src/nodes/utils/OscNode.js +7 -3
  231. package/src/nodes/utils/RTTNode.js +6 -3
  232. package/src/nodes/utils/ReflectorNode.js +8 -5
  233. package/src/nodes/utils/RemapNode.js +7 -3
  234. package/src/nodes/utils/RotateNode.js +6 -3
  235. package/src/nodes/utils/SetNode.js +7 -4
  236. package/src/nodes/utils/SplitNode.js +7 -3
  237. package/src/nodes/utils/SpriteSheetUVNode.js +7 -3
  238. package/src/nodes/utils/StorageArrayElementNode.js +9 -8
  239. package/src/nodes/utils/TimerNode.js +6 -3
  240. package/src/nodes/utils/TriplanarTexturesNode.js +7 -3
  241. package/src/nodes/utils/ViewportUtils.js +2 -2
  242. package/src/objects/BatchedMesh.js +76 -10
  243. package/src/objects/LOD.js +21 -0
  244. package/src/objects/Line.js +1 -0
  245. package/src/objects/Mesh.js +7 -23
  246. package/src/objects/Points.js +2 -0
  247. package/src/renderers/WebGLRenderer.js +65 -50
  248. package/src/renderers/common/BundleGroup.js +26 -0
  249. package/src/renderers/common/ClippingContext.js +4 -3
  250. package/src/renderers/common/RenderContext.js +4 -5
  251. package/src/renderers/common/RenderObject.js +116 -5
  252. package/src/renderers/common/RenderObjects.js +8 -1
  253. package/src/renderers/common/Renderer.js +57 -49
  254. package/src/renderers/common/extras/PMREMGenerator.js +7 -9
  255. package/src/renderers/common/nodes/NodeBuilderState.js +3 -3
  256. package/src/renderers/common/nodes/Nodes.js +33 -14
  257. package/src/renderers/shaders/ShaderLib/sprite.glsl.js +2 -4
  258. package/src/renderers/webgl/WebGLAttributes.js +45 -14
  259. package/src/renderers/webgl/WebGLCapabilities.js +9 -0
  260. package/src/renderers/webgl/WebGLProgram.js +2 -0
  261. package/src/renderers/webgl/WebGLPrograms.js +21 -17
  262. package/src/renderers/webgl/WebGLState.js +21 -0
  263. package/src/renderers/webgl/WebGLTextures.js +22 -0
  264. package/src/renderers/webgl-fallback/WebGLBackend.js +50 -45
  265. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +4 -4
  266. package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +6 -0
  267. package/src/renderers/webgl-fallback/utils/WebGLState.js +1 -4
  268. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +61 -16
  269. package/src/renderers/webgpu/WebGPUBackend.js +33 -25
  270. package/src/renderers/webgpu/WebGPURenderer.Nodes.js +42 -0
  271. package/src/renderers/webgpu/WebGPURenderer.js +5 -2
  272. package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +59 -0
  273. package/src/renderers/{common → webgpu}/nodes/StandardNodeLibrary.js +11 -11
  274. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +91 -11
  275. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +6 -16
  276. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +1 -1
  277. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +7 -5
  278. package/src/renderers/webgpu/utils/WebGPUUtils.js +1 -1
  279. package/src/utils.js +33 -1
  280. package/examples/jsm/geometries/SDFGeometryGenerator.js +0 -144
  281. package/examples/jsm/loaders/TiltLoader.js +0 -520
  282. package/examples/jsm/utils/GPUStatsPanel.js +0 -95
  283. package/examples/jsm/utils/PackedPhongMaterial.js +0 -178
  284. package/src/nodes/display/ViewportNode.js +0 -138
  285. package/src/nodes/lighting/LightNode.js +0 -57
  286. package/src/renderers/common/StandardRenderer.js +0 -18
  287. package/src/renderers/webvr/WebVRManager.js +0 -495
  288. package/src/renderers/webvr/WebVRUtils.js +0 -66
@@ -1,19 +1,22 @@
1
- import { registerNode } from '../core/Node.js';
2
1
  import LightingNode from './LightingNode.js';
3
2
  import { NodeUpdateType } from '../core/constants.js';
4
3
  import { uniform } from '../core/UniformNode.js';
5
- import { float, vec2, vec3, vec4 } from '../tsl/TSLBase.js';
4
+ import { float, vec2, vec3, vec4, If, int, Fn } from '../tsl/TSLBase.js';
6
5
  import { reference } from '../accessors/ReferenceNode.js';
7
6
  import { texture } from '../accessors/TextureNode.js';
8
7
  import { positionWorld } from '../accessors/Position.js';
9
8
  import { normalWorld } from '../accessors/Normal.js';
10
- import { mix, fract } from '../math/MathNode.js';
11
- import { add } from '../math/OperatorNode.js';
9
+ import { mix, fract, step, max, clamp, sqrt } from '../math/MathNode.js';
10
+ import { add, sub } from '../math/OperatorNode.js';
12
11
  import { Color } from '../../math/Color.js';
13
12
  import { DepthTexture } from '../../textures/DepthTexture.js';
14
- import { Fn } from '../tsl/TSLBase.js';
15
- import { LessCompare, WebGPUCoordinateSystem } from '../../constants.js';
16
13
  import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
14
+ import QuadMesh from '../../renderers/common/QuadMesh.js';
15
+ import { Loop } from '../utils/LoopNode.js';
16
+ import { screenCoordinate } from '../display/ScreenNode.js';
17
+ import { HalfFloatType, LessCompare, RGFormat, VSMShadowMap, WebGPUCoordinateSystem } from '../../constants.js';
18
+ import { renderGroup } from '../core/UniformGroupNode.js';
19
+ import { hash } from '../core/NodeUtils.js';
17
20
 
18
21
  const BasicShadowMap = Fn( ( { depthTexture, shadowCoord } ) => {
19
22
 
@@ -25,8 +28,8 @@ const PCFShadowMap = Fn( ( { depthTexture, shadowCoord, shadow } ) => {
25
28
 
26
29
  const depthCompare = ( uv, compare ) => texture( depthTexture, uv ).compare( compare );
27
30
 
28
- const mapSize = reference( 'mapSize', 'vec2', shadow );
29
- const radius = reference( 'radius', 'float', shadow );
31
+ const mapSize = reference( 'mapSize', 'vec2', shadow ).setGroup( renderGroup );
32
+ const radius = reference( 'radius', 'float', shadow ).setGroup( renderGroup );
30
33
 
31
34
  const texelSize = vec2( 1 ).div( mapSize );
32
35
  const dx0 = texelSize.x.negate().mul( radius );
@@ -64,7 +67,7 @@ const PCFSoftShadowMap = Fn( ( { depthTexture, shadowCoord, shadow } ) => {
64
67
 
65
68
  const depthCompare = ( uv, compare ) => texture( depthTexture, uv ).compare( compare );
66
69
 
67
- const mapSize = reference( 'mapSize', 'vec2', shadow );
70
+ const mapSize = reference( 'mapSize', 'vec2', shadow ).setGroup( renderGroup );
68
71
 
69
72
  const texelSize = vec2( 1 ).div( mapSize );
70
73
  const dx = texelSize.x;
@@ -116,14 +119,97 @@ const PCFSoftShadowMap = Fn( ( { depthTexture, shadowCoord, shadow } ) => {
116
119
 
117
120
  } );
118
121
 
119
- const shadowFilterLib = [ BasicShadowMap, PCFShadowMap, PCFSoftShadowMap ];
122
+ // VSM
123
+
124
+ const VSMShadowMapNode = Fn( ( { depthTexture, shadowCoord } ) => {
125
+
126
+ const occlusion = float( 1 ).toVar();
127
+
128
+ const distribution = texture( depthTexture ).uv( shadowCoord.xy ).rg;
129
+
130
+ const hardShadow = step( shadowCoord.z, distribution.x );
131
+
132
+ If( hardShadow.notEqual( float( 1.0 ) ), () => {
133
+
134
+ const distance = shadowCoord.z.sub( distribution.x );
135
+ const variance = max( 0, distribution.y.mul( distribution.y ) );
136
+ let softnessProbability = variance.div( variance.add( distance.mul( distance ) ) ); // Chebeyshevs inequality
137
+ softnessProbability = clamp( sub( softnessProbability, 0.3 ).div( 0.95 - 0.3 ) );
138
+ occlusion.assign( clamp( max( hardShadow, softnessProbability ) ) );
139
+
140
+ } );
141
+
142
+ return occlusion;
143
+
144
+ } );
145
+
146
+ const VSMPassVertical = Fn( ( { samples, radius, size, shadowPass } ) => {
147
+
148
+ const mean = float( 0 ).toVar();
149
+ const squaredMean = float( 0 ).toVar();
150
+
151
+ const uvStride = samples.lessThanEqual( float( 1 ) ).select( float( 0 ), float( 2 ).div( samples.sub( 1 ) ) );
152
+ const uvStart = samples.lessThanEqual( float( 1 ) ).select( float( 0 ), float( - 1 ) );
153
+
154
+ Loop( { start: int( 0 ), end: int( samples ), type: 'int', condition: '<' }, ( { i } ) => {
155
+
156
+ const uvOffset = uvStart.add( float( i ).mul( uvStride ) );
157
+
158
+ const depth = shadowPass.uv( add( screenCoordinate.xy, vec2( 0, uvOffset ).mul( radius ) ).div( size ) ).x;
159
+ mean.addAssign( depth );
160
+ squaredMean.addAssign( depth.mul( depth ) );
161
+
162
+ } );
163
+
164
+ mean.divAssign( samples );
165
+ squaredMean.divAssign( samples );
166
+
167
+ const std_dev = sqrt( squaredMean.sub( mean.mul( mean ) ) );
168
+ return vec2( mean, std_dev );
169
+
170
+ } );
171
+
172
+ const VSMPassHorizontal = Fn( ( { samples, radius, size, shadowPass } ) => {
173
+
174
+ const mean = float( 0 ).toVar();
175
+ const squaredMean = float( 0 ).toVar();
176
+
177
+ const uvStride = samples.lessThanEqual( float( 1 ) ).select( float( 0 ), float( 2 ).div( samples.sub( 1 ) ) );
178
+ const uvStart = samples.lessThanEqual( float( 1 ) ).select( float( 0 ), float( - 1 ) );
179
+
180
+ Loop( { start: int( 0 ), end: int( samples ), type: 'int', condition: '<' }, ( { i } ) => {
181
+
182
+ const uvOffset = uvStart.add( float( i ).mul( uvStride ) );
183
+
184
+ const distribution = shadowPass.uv( add( screenCoordinate.xy, vec2( uvOffset, 0 ).mul( radius ) ).div( size ) );
185
+ mean.addAssign( distribution.x );
186
+ squaredMean.addAssign( add( distribution.y.mul( distribution.y ), distribution.x.mul( distribution.x ) ) );
187
+
188
+ } );
189
+
190
+ mean.divAssign( samples );
191
+ squaredMean.divAssign( samples );
192
+
193
+ const std_dev = sqrt( squaredMean.sub( mean.mul( mean ) ) );
194
+ return vec2( mean, std_dev );
195
+
196
+ } );
197
+
198
+ const _shadowFilterLib = [ BasicShadowMap, PCFShadowMap, PCFSoftShadowMap, VSMShadowMapNode ];
120
199
 
121
200
  //
122
201
 
123
- let overrideMaterial = null;
202
+ let _overrideMaterial = null;
203
+ const _quadMesh = /*@__PURE__*/ new QuadMesh();
124
204
 
125
205
  class AnalyticLightNode extends LightingNode {
126
206
 
207
+ static get type() {
208
+
209
+ return 'AnalyticLightNode';
210
+
211
+ }
212
+
127
213
  constructor( light = null ) {
128
214
 
129
215
  super();
@@ -133,7 +219,7 @@ class AnalyticLightNode extends LightingNode {
133
219
  this.light = light;
134
220
 
135
221
  this.color = new Color();
136
- this.colorNode = uniform( this.color );
222
+ this.colorNode = uniform( this.color ).setGroup( renderGroup );
137
223
 
138
224
  this.baseColorNode = null;
139
225
 
@@ -141,13 +227,19 @@ class AnalyticLightNode extends LightingNode {
141
227
  this.shadowNode = null;
142
228
  this.shadowColorNode = null;
143
229
 
230
+ this.vsmShadowMapVertical = null;
231
+ this.vsmShadowMapHorizontal = null;
232
+
233
+ this.vsmMaterialVertical = null;
234
+ this.vsmMaterialHorizontal = null;
235
+
144
236
  this.isAnalyticLightNode = true;
145
237
 
146
238
  }
147
239
 
148
240
  getCacheKey() {
149
241
 
150
- return super.getCacheKey() + '-' + ( this.light.id + '-' + ( this.light.castShadow ? '1' : '0' ) );
242
+ return hash( super.getCacheKey(), this.light.id, this.light.castShadow ? 1 : 0 );
151
243
 
152
244
  }
153
245
 
@@ -161,37 +253,67 @@ class AnalyticLightNode extends LightingNode {
161
253
 
162
254
  const { object, renderer } = builder;
163
255
 
256
+ if ( renderer.shadowMap.enabled === false ) return;
257
+
164
258
  let shadowColorNode = this.shadowColorNode;
165
259
 
166
260
  if ( shadowColorNode === null ) {
167
261
 
168
- if ( overrideMaterial === null ) {
262
+ if ( _overrideMaterial === null ) {
169
263
 
170
- overrideMaterial = new NodeMaterial();
171
- overrideMaterial.fragmentNode = vec4( 0, 0, 0, 1 );
172
- overrideMaterial.isShadowNodeMaterial = true; // Use to avoid other overrideMaterial override material.fragmentNode unintentionally when using material.shadowNode
173
- overrideMaterial.name = 'ShadowMaterial';
264
+ _overrideMaterial = new NodeMaterial();
265
+ _overrideMaterial.fragmentNode = vec4( 0, 0, 0, 1 );
266
+ _overrideMaterial.isShadowNodeMaterial = true; // Use to avoid other overrideMaterial override material.fragmentNode unintentionally when using material.shadowNode
267
+ _overrideMaterial.name = 'ShadowMaterial';
174
268
 
175
269
  }
176
270
 
271
+ const shadowMapType = renderer.shadowMap.type;
272
+ const shadow = this.light.shadow;
273
+
177
274
  const depthTexture = new DepthTexture();
178
275
  depthTexture.compareFunction = LessCompare;
179
276
 
180
- const shadow = this.light.shadow;
181
277
  const shadowMap = builder.createRenderTarget( shadow.mapSize.width, shadow.mapSize.height );
182
278
  shadowMap.depthTexture = depthTexture;
183
279
 
184
280
  shadow.camera.updateProjectionMatrix();
185
281
 
282
+ // VSM
283
+
284
+ if ( shadowMapType === VSMShadowMap ) {
285
+
286
+ depthTexture.compareFunction = null; // VSM does not use textureSampleCompare()/texture2DCompare()
287
+
288
+ this.vsmShadowMapVertical = builder.createRenderTarget( shadow.mapSize.width, shadow.mapSize.height, { format: RGFormat, type: HalfFloatType } );
289
+ this.vsmShadowMapHorizontal = builder.createRenderTarget( shadow.mapSize.width, shadow.mapSize.height, { format: RGFormat, type: HalfFloatType } );
290
+
291
+ const shadowPassVertical = texture( depthTexture );
292
+ const shadowPassHorizontal = texture( this.vsmShadowMapVertical.texture );
293
+
294
+ const samples = reference( 'blurSamples', 'float', shadow ).setGroup( renderGroup );
295
+ const radius = reference( 'radius', 'float', shadow ).setGroup( renderGroup );
296
+ const size = reference( 'mapSize', 'vec2', shadow ).setGroup( renderGroup );
297
+
298
+ let material = this.vsmMaterialVertical || ( this.vsmMaterialVertical = new NodeMaterial() );
299
+ material.fragmentNode = VSMPassVertical( { samples, radius, size, shadowPass: shadowPassVertical } ).context( builder.getSharedContext() );
300
+ material.name = 'VSMVertical';
301
+
302
+ material = this.vsmMaterialHorizontal || ( this.vsmMaterialHorizontal = new NodeMaterial() );
303
+ material.fragmentNode = VSMPassHorizontal( { samples, radius, size, shadowPass: shadowPassHorizontal } ).context( builder.getSharedContext() );
304
+ material.name = 'VSMHorizontal';
305
+
306
+ }
307
+
186
308
  //
187
309
 
188
- const shadowIntensity = reference( 'intensity', 'float', shadow );
189
- const bias = reference( 'bias', 'float', shadow );
190
- const normalBias = reference( 'normalBias', 'float', shadow );
310
+ const shadowIntensity = reference( 'intensity', 'float', shadow ).setGroup( renderGroup );
311
+ const bias = reference( 'bias', 'float', shadow ).setGroup( renderGroup );
312
+ const normalBias = reference( 'normalBias', 'float', shadow ).setGroup( renderGroup );
191
313
 
192
314
  const position = object.material.shadowPositionNode || positionWorld;
193
315
 
194
- let shadowCoord = uniform( shadow.matrix ).mul( position.add( normalWorld.mul( normalBias ) ) );
316
+ let shadowCoord = uniform( shadow.matrix ).setGroup( renderGroup ).mul( position.add( normalWorld.mul( normalBias ) ) );
195
317
  shadowCoord = shadowCoord.xyz.div( shadowCoord.w );
196
318
 
197
319
  let coordZ = shadowCoord.z.add( bias );
@@ -216,7 +338,7 @@ class AnalyticLightNode extends LightingNode {
216
338
 
217
339
  //
218
340
 
219
- const filterFn = shadow.filterNode || shadowFilterLib[ renderer.shadowMap.type ] || null;
341
+ const filterFn = shadow.filterNode || _shadowFilterLib[ renderer.shadowMap.type ] || null;
220
342
 
221
343
  if ( filterFn === null ) {
222
344
 
@@ -225,9 +347,10 @@ class AnalyticLightNode extends LightingNode {
225
347
  }
226
348
 
227
349
  const shadowColor = texture( shadowMap.texture, shadowCoord );
228
- const shadowNode = frustumTest.select( filterFn( { depthTexture, shadowCoord, shadow } ), float( 1 ) );
350
+ const shadowNode = frustumTest.select( filterFn( { depthTexture: ( shadowMapType === VSMShadowMap ) ? this.vsmShadowMapHorizontal.texture : depthTexture, shadowCoord, shadow } ), float( 1 ) );
229
351
 
230
352
  this.shadowMap = shadowMap;
353
+ this.light.shadow.map = shadowMap;
231
354
 
232
355
  this.shadowNode = shadowNode;
233
356
  this.shadowColorNode = shadowColorNode = this.colorNode.mul( mix( 1, shadowNode.rgb.mix( shadowColor, 1 ), shadowIntensity.mul( shadowColor.a ) ) );
@@ -269,13 +392,14 @@ class AnalyticLightNode extends LightingNode {
269
392
  const { shadowMap, light } = this;
270
393
  const { renderer, scene, camera } = frame;
271
394
 
395
+ const shadowType = renderer.shadowMap.type;
272
396
 
273
397
  const depthVersion = shadowMap.depthTexture.version;
274
398
  this._depthVersionCached = depthVersion;
275
399
 
276
400
  const currentOverrideMaterial = scene.overrideMaterial;
277
401
 
278
- scene.overrideMaterial = overrideMaterial;
402
+ scene.overrideMaterial = _overrideMaterial;
279
403
 
280
404
  shadowMap.setSize( light.shadow.mapSize.width, light.shadow.mapSize.height );
281
405
 
@@ -287,7 +411,7 @@ class AnalyticLightNode extends LightingNode {
287
411
 
288
412
  renderer.setRenderObjectFunction( ( object, ...params ) => {
289
413
 
290
- if ( object.castShadow === true ) {
414
+ if ( object.castShadow === true || ( object.receiveShadow && shadowType === VSMShadowMap ) ) {
291
415
 
292
416
  renderer.renderObject( object, ...params );
293
417
 
@@ -298,18 +422,64 @@ class AnalyticLightNode extends LightingNode {
298
422
  renderer.setRenderTarget( shadowMap );
299
423
  renderer.render( scene, light.shadow.camera );
300
424
 
301
- renderer.setRenderTarget( currentRenderTarget );
302
425
  renderer.setRenderObjectFunction( currentRenderObjectFunction );
303
426
 
427
+ // vsm blur pass
428
+
429
+ if ( light.isPointLight !== true && shadowType === VSMShadowMap ) {
430
+
431
+ this.vsmPass( frame, light );
432
+
433
+ }
434
+
435
+ renderer.setRenderTarget( currentRenderTarget );
436
+
304
437
  scene.overrideMaterial = currentOverrideMaterial;
305
438
 
306
439
  }
307
440
 
441
+ vsmPass( frame, light ) {
442
+
443
+ const { renderer } = frame;
444
+
445
+ this.vsmShadowMapVertical.setSize( light.shadow.mapSize.width, light.shadow.mapSize.height );
446
+ this.vsmShadowMapHorizontal.setSize( light.shadow.mapSize.width, light.shadow.mapSize.height );
447
+
448
+ renderer.setRenderTarget( this.vsmShadowMapVertical );
449
+ _quadMesh.material = this.vsmMaterialVertical;
450
+ _quadMesh.render( renderer );
451
+
452
+ renderer.setRenderTarget( this.vsmShadowMapHorizontal );
453
+ _quadMesh.material = this.vsmMaterialHorizontal;
454
+ _quadMesh.render( renderer );
455
+
456
+ }
457
+
308
458
  disposeShadow() {
309
459
 
310
460
  this.shadowMap.dispose();
311
461
  this.shadowMap = null;
312
462
 
463
+ if ( this.vsmShadowMapVertical !== null ) {
464
+
465
+ this.vsmShadowMapVertical.dispose();
466
+ this.vsmShadowMapVertical = null;
467
+
468
+ this.vsmMaterialVertical.dispose();
469
+ this.vsmMaterialVertical = null;
470
+
471
+ }
472
+
473
+ if ( this.vsmShadowMapHorizontal !== null ) {
474
+
475
+ this.vsmShadowMapHorizontal.dispose();
476
+ this.vsmShadowMapHorizontal = null;
477
+
478
+ this.vsmMaterialHorizontal.dispose();
479
+ this.vsmMaterialHorizontal = null;
480
+
481
+ }
482
+
313
483
  this.shadowNode = null;
314
484
  this.shadowColorNode = null;
315
485
 
@@ -350,5 +520,3 @@ class AnalyticLightNode extends LightingNode {
350
520
  }
351
521
 
352
522
  export default AnalyticLightNode;
353
-
354
- AnalyticLightNode.type = /*@__PURE__*/ registerNode( 'AnalyticLight', AnalyticLightNode );
@@ -1,9 +1,14 @@
1
- import { registerNode } from '../core/Node.js';
2
1
  import LightingNode from './LightingNode.js';
3
2
  import { cubeMapNode } from '../utils/CubeMapNode.js';
4
3
 
5
4
  class BasicEnvironmentNode extends LightingNode {
6
5
 
6
+ static get type() {
7
+
8
+ return 'BasicEnvironmentNode';
9
+
10
+ }
11
+
7
12
  constructor( envNode = null ) {
8
13
 
9
14
  super();
@@ -23,5 +28,3 @@ class BasicEnvironmentNode extends LightingNode {
23
28
  }
24
29
 
25
30
  export default BasicEnvironmentNode;
26
-
27
- BasicEnvironmentNode.type = /*@__PURE__*/ registerNode( 'BasicEnvironment', BasicEnvironmentNode );
@@ -1,9 +1,14 @@
1
- import { registerNode } from '../core/Node.js';
2
1
  import LightingNode from './LightingNode.js';
3
2
  import { float } from '../tsl/TSLBase.js';
4
3
 
5
4
  class BasicLightMapNode extends LightingNode {
6
5
 
6
+ static get type() {
7
+
8
+ return 'BasicLightMapNode';
9
+
10
+ }
11
+
7
12
  constructor( lightMapNode = null ) {
8
13
 
9
14
  super();
@@ -25,5 +30,3 @@ class BasicLightMapNode extends LightingNode {
25
30
  }
26
31
 
27
32
  export default BasicLightMapNode;
28
-
29
- BasicLightMapNode.type = /*@__PURE__*/ registerNode( 'BasicLightMap', BasicLightMapNode );
@@ -1,9 +1,14 @@
1
- import { registerNode } from '../core/Node.js';
2
1
  import AnalyticLightNode from './AnalyticLightNode.js';
3
- import { lightTargetDirection } from './LightNode.js';
2
+ import { lightTargetDirection } from '../accessors/Lights.js';
4
3
 
5
4
  class DirectionalLightNode extends AnalyticLightNode {
6
5
 
6
+ static get type() {
7
+
8
+ return 'DirectionalLightNode';
9
+
10
+ }
11
+
7
12
  constructor( light = null ) {
8
13
 
9
14
  super( light );
@@ -31,5 +36,3 @@ class DirectionalLightNode extends AnalyticLightNode {
31
36
  }
32
37
 
33
38
  export default DirectionalLightNode;
34
-
35
- DirectionalLightNode.type = /*@__PURE__*/ registerNode( 'DirectionalLight', DirectionalLightNode );
@@ -1,4 +1,3 @@
1
- import { registerNode } from '../core/Node.js';
2
1
  import LightingNode from './LightingNode.js';
3
2
  import { cache } from '../core/CacheNode.js';
4
3
  import { roughness, clearcoatRoughness } from '../core/PropertyNode.js';
@@ -14,6 +13,12 @@ const _envNodeCache = new WeakMap();
14
13
 
15
14
  class EnvironmentNode extends LightingNode {
16
15
 
16
+ static get type() {
17
+
18
+ return 'EnvironmentNode';
19
+
20
+ }
21
+
17
22
  constructor( envNode = null ) {
18
23
 
19
24
  super();
@@ -85,8 +90,6 @@ class EnvironmentNode extends LightingNode {
85
90
 
86
91
  export default EnvironmentNode;
87
92
 
88
- EnvironmentNode.type = /*@__PURE__*/ registerNode( 'Environment', EnvironmentNode );
89
-
90
93
  const createRadianceContext = ( roughnessNode, normalViewNode ) => {
91
94
 
92
95
  let reflectVec = null;
@@ -1,22 +1,28 @@
1
- import { registerNode } from '../core/Node.js';
2
1
  import AnalyticLightNode from './AnalyticLightNode.js';
3
2
  import { uniform } from '../core/UniformNode.js';
4
3
  import { mix } from '../math/MathNode.js';
5
4
  import { normalView } from '../accessors/Normal.js';
6
- import { objectPosition } from '../accessors/Object3DNode.js';
5
+ import { lightPosition } from '../accessors/Lights.js';
6
+ import { renderGroup } from '../core/UniformGroupNode.js';
7
7
 
8
8
  import { Color } from '../../math/Color.js';
9
9
 
10
10
  class HemisphereLightNode extends AnalyticLightNode {
11
11
 
12
+ static get type() {
13
+
14
+ return 'HemisphereLightNode';
15
+
16
+ }
17
+
12
18
  constructor( light = null ) {
13
19
 
14
20
  super( light );
15
21
 
16
- this.lightPositionNode = objectPosition( light );
22
+ this.lightPositionNode = lightPosition( light );
17
23
  this.lightDirectionNode = this.lightPositionNode.normalize();
18
24
 
19
- this.groundColorNode = uniform( new Color() );
25
+ this.groundColorNode = uniform( new Color() ).setGroup( renderGroup );
20
26
 
21
27
  }
22
28
 
@@ -48,5 +54,3 @@ class HemisphereLightNode extends AnalyticLightNode {
48
54
  }
49
55
 
50
56
  export default HemisphereLightNode;
51
-
52
- HemisphereLightNode.type = /*@__PURE__*/ registerNode( 'HemisphereLight', HemisphereLightNode );
@@ -1,10 +1,15 @@
1
- import { registerNode } from '../core/Node.js';
2
1
  import SpotLightNode from './SpotLightNode.js';
3
2
  import { texture } from '../accessors/TextureNode.js';
4
3
  import { vec2 } from '../tsl/TSLBase.js';
5
4
 
6
5
  class IESSpotLightNode extends SpotLightNode {
7
6
 
7
+ static get type() {
8
+
9
+ return 'IESSpotLightNode';
10
+
11
+ }
12
+
8
13
  getSpotAttenuation( angleCosine ) {
9
14
 
10
15
  const iesMap = this.light.iesMap;
@@ -30,5 +35,3 @@ class IESSpotLightNode extends SpotLightNode {
30
35
  }
31
36
 
32
37
  export default IESSpotLightNode;
33
-
34
- IESSpotLightNode.type = /*@__PURE__*/ registerNode( 'IESSpotLight', IESSpotLightNode );
@@ -1,8 +1,13 @@
1
- import { registerNode } from '../core/Node.js';
2
1
  import LightingNode from './LightingNode.js';
3
2
 
4
3
  class IrradianceNode extends LightingNode {
5
4
 
5
+ static get type() {
6
+
7
+ return 'IrradianceNode';
8
+
9
+ }
10
+
6
11
  constructor( node ) {
7
12
 
8
13
  super();
@@ -20,5 +25,3 @@ class IrradianceNode extends LightingNode {
20
25
  }
21
26
 
22
27
  export default IrradianceNode;
23
-
24
- IrradianceNode.type = /*@__PURE__*/ registerNode( 'Irradiance', IrradianceNode );
@@ -1,13 +1,17 @@
1
- import { registerNode } from '../core/Node.js';
2
1
  import AnalyticLightNode from './AnalyticLightNode.js';
3
2
  import { normalWorld } from '../accessors/Normal.js';
4
3
  import { uniformArray } from '../accessors/UniformArrayNode.js';
5
- import { Fn } from '../tsl/TSLBase.js';
6
- import { mul } from '../math/OperatorNode.js';
7
4
  import { Vector3 } from '../../math/Vector3.js';
5
+ import getShIrradianceAt from '../functions/material/getShIrradianceAt.js';
8
6
 
9
7
  class LightProbeNode extends AnalyticLightNode {
10
8
 
9
+ static get type() {
10
+
11
+ return 'LightProbeNode';
12
+
13
+ }
14
+
11
15
  constructor( light = null ) {
12
16
 
13
17
  super( light );
@@ -38,7 +42,7 @@ class LightProbeNode extends AnalyticLightNode {
38
42
 
39
43
  setup( builder ) {
40
44
 
41
- const irradiance = shGetIrradianceAt( normalWorld, this.lightProbe );
45
+ const irradiance = getShIrradianceAt( normalWorld, this.lightProbe );
42
46
 
43
47
  builder.context.irradiance.addAssign( irradiance );
44
48
 
@@ -47,30 +51,3 @@ class LightProbeNode extends AnalyticLightNode {
47
51
  }
48
52
 
49
53
  export default LightProbeNode;
50
-
51
- LightProbeNode.type = /*@__PURE__*/ registerNode( 'LightProbe', LightProbeNode );
52
-
53
- const shGetIrradianceAt = /*@__PURE__*/ Fn( ( [ normal, shCoefficients ] ) => {
54
-
55
- // normal is assumed to have unit length
56
-
57
- const x = normal.x, y = normal.y, z = normal.z;
58
-
59
- // band 0
60
- const result = shCoefficients.element( 0 ).mul( 0.886227 );
61
-
62
- // band 1
63
- result.addAssign( shCoefficients.element( 1 ).mul( 2.0 * 0.511664 ).mul( y ) );
64
- result.addAssign( shCoefficients.element( 2 ).mul( 2.0 * 0.511664 ).mul( z ) );
65
- result.addAssign( shCoefficients.element( 3 ).mul( 2.0 * 0.511664 ).mul( x ) );
66
-
67
- // band 2
68
- result.addAssign( shCoefficients.element( 4 ).mul( 2.0 * 0.429043 ).mul( x ).mul( y ) );
69
- result.addAssign( shCoefficients.element( 5 ).mul( 2.0 * 0.429043 ).mul( y ).mul( z ) );
70
- result.addAssign( shCoefficients.element( 6 ).mul( z.mul( z ).mul( 0.743125 ).sub( 0.247708 ) ) );
71
- result.addAssign( shCoefficients.element( 7 ).mul( 2.0 * 0.429043 ).mul( x ).mul( z ) );
72
- result.addAssign( shCoefficients.element( 8 ).mul( 0.429043 ).mul( mul( x, x ).sub( mul( y, y ) ) ) );
73
-
74
- return result;
75
-
76
- } );
@@ -1,9 +1,14 @@
1
- import { registerNode } from '../core/Node.js';
2
1
  import ContextNode from '../core/ContextNode.js';
3
2
  import { nodeProxy, float, vec3 } from '../tsl/TSLBase.js';
4
3
 
5
4
  class LightingContextNode extends ContextNode {
6
5
 
6
+ static get type() {
7
+
8
+ return 'LightingContextNode';
9
+
10
+ }
11
+
7
12
  constructor( node, lightingModel = null, backdropNode = null, backdropAlphaNode = null ) {
8
13
 
9
14
  super( node );
@@ -59,6 +64,4 @@ class LightingContextNode extends ContextNode {
59
64
 
60
65
  export default LightingContextNode;
61
66
 
62
- LightingContextNode.type = /*@__PURE__*/ registerNode( 'LightingContext', LightingContextNode );
63
-
64
67
  export const lightingContext = /*@__PURE__*/ nodeProxy( LightingContextNode );
@@ -1,7 +1,13 @@
1
- import Node, { registerNode } from '../core/Node.js';
1
+ import Node from '../core/Node.js';
2
2
 
3
3
  class LightingNode extends Node {
4
4
 
5
+ static get type() {
6
+
7
+ return 'LightingNode';
8
+
9
+ }
10
+
5
11
  constructor() {
6
12
 
7
13
  super( 'vec3' );
@@ -19,5 +25,3 @@ class LightingNode extends Node {
19
25
  }
20
26
 
21
27
  export default LightingNode;
22
-
23
- LightingNode.type = /*@__PURE__*/ registerNode( 'Lighting', LightingNode );