super-three 0.179.0 → 0.184.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.
- package/LICENSE +1 -1
- package/README.md +3 -4
- package/build/three.cjs +14522 -12207
- package/build/three.core.js +12005 -10954
- package/build/three.core.min.js +2 -2
- package/build/three.module.js +2270 -1005
- package/build/three.module.min.js +2 -2
- package/build/three.tsl.js +63 -18
- package/build/three.tsl.min.js +2 -2
- package/build/three.webgpu.js +16573 -7890
- package/build/three.webgpu.min.js +2 -2
- package/build/three.webgpu.nodes.js +16533 -7888
- package/build/three.webgpu.nodes.min.js +2 -2
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +91 -0
- package/examples/jsm/Addons.js +12 -4
- package/examples/jsm/animation/CCDIKSolver.js +8 -4
- package/examples/jsm/controls/ArcballControls.js +15 -12
- package/examples/jsm/controls/DragControls.js +9 -59
- package/examples/jsm/controls/FirstPersonControls.js +61 -57
- package/examples/jsm/controls/FlyControls.js +5 -1
- package/examples/jsm/controls/MapControls.js +55 -1
- package/examples/jsm/controls/OrbitControls.js +113 -10
- package/examples/jsm/controls/PointerLockControls.js +2 -10
- package/examples/jsm/controls/TrackballControls.js +9 -9
- package/examples/jsm/controls/TransformControls.js +35 -3
- package/examples/jsm/csm/CSM.js +2 -1
- package/examples/jsm/csm/CSMShadowNode.js +6 -2
- package/examples/jsm/effects/AnaglyphEffect.js +102 -7
- package/examples/jsm/effects/AsciiEffect.js +8 -8
- package/examples/jsm/environments/ColorEnvironment.js +59 -0
- package/examples/jsm/environments/RoomEnvironment.js +3 -0
- package/examples/jsm/exporters/DRACOExporter.js +2 -2
- package/examples/jsm/exporters/EXRExporter.js +2 -2
- package/examples/jsm/exporters/GLTFExporter.js +185 -34
- package/examples/jsm/exporters/KTX2Exporter.js +4 -2
- package/examples/jsm/exporters/PLYExporter.js +1 -1
- package/examples/jsm/exporters/USDZExporter.js +31 -5
- package/examples/jsm/geometries/DecalGeometry.js +3 -3
- package/examples/jsm/geometries/ParametricGeometry.js +1 -1
- package/examples/jsm/geometries/TeapotGeometry.js +2 -2
- package/examples/jsm/geometries/TextGeometry.js +21 -2
- package/examples/jsm/gpgpu/BitonicSort.js +715 -0
- package/examples/jsm/helpers/AnimationPathHelper.js +302 -0
- package/examples/jsm/helpers/LightProbeGridHelper.js +221 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +1 -1
- package/examples/jsm/helpers/TextureHelperGPU.js +1 -1
- package/examples/jsm/helpers/ViewHelper.js +110 -13
- package/examples/jsm/inspector/Extension.js +13 -0
- package/examples/jsm/inspector/Inspector.js +542 -0
- package/examples/jsm/inspector/RendererInspector.js +425 -0
- package/examples/jsm/inspector/extensions/extensions.json +6 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +916 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +281 -0
- package/examples/jsm/inspector/tabs/Console.js +238 -0
- package/examples/jsm/inspector/tabs/Memory.js +128 -0
- package/examples/jsm/inspector/tabs/Parameters.js +380 -0
- package/examples/jsm/inspector/tabs/Performance.js +268 -0
- package/examples/jsm/inspector/tabs/Settings.js +264 -0
- package/examples/jsm/inspector/tabs/Timeline.js +1611 -0
- package/examples/jsm/inspector/tabs/Viewer.js +268 -0
- package/examples/jsm/inspector/ui/Graph.js +95 -0
- package/examples/jsm/inspector/ui/Item.js +170 -0
- package/examples/jsm/inspector/ui/List.js +75 -0
- package/examples/jsm/inspector/ui/Profiler.js +2072 -0
- package/examples/jsm/inspector/ui/Style.js +1667 -0
- package/examples/jsm/inspector/ui/Tab.js +265 -0
- package/examples/jsm/inspector/ui/Values.js +476 -0
- package/examples/jsm/inspector/ui/utils.js +69 -0
- package/examples/jsm/interaction/InteractionManager.js +226 -0
- package/examples/jsm/interactive/HTMLMesh.js +6 -10
- package/examples/jsm/interactive/InteractiveGroup.js +1 -1
- package/examples/jsm/interactive/SelectionBox.js +30 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -1
- package/examples/jsm/libs/meshopt_decoder.module.js +9 -8
- package/examples/jsm/lighting/DynamicLighting.js +82 -0
- package/examples/jsm/lighting/LightProbeGrid.js +651 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +1 -1
- package/examples/jsm/lines/Line2.js +3 -3
- package/examples/jsm/lines/LineGeometry.js +1 -1
- package/examples/jsm/lines/LineMaterial.js +7 -1
- package/examples/jsm/lines/LineSegments2.js +2 -2
- package/examples/jsm/lines/Wireframe.js +2 -2
- package/examples/jsm/lines/WireframeGeometry2.js +1 -1
- package/examples/jsm/lines/webgpu/LineSegments2.js +1 -1
- package/examples/jsm/lines/webgpu/Wireframe.js +1 -1
- package/examples/jsm/loaders/3DMLoader.js +5 -4
- package/examples/jsm/loaders/3MFLoader.js +3 -3
- package/examples/jsm/loaders/AMFLoader.js +2 -2
- package/examples/jsm/loaders/ColladaLoader.js +27 -4029
- package/examples/jsm/loaders/DDSLoader.js +1 -1
- package/examples/jsm/loaders/DRACOLoader.js +73 -22
- package/examples/jsm/loaders/EXRLoader.js +692 -53
- package/examples/jsm/loaders/FBXLoader.js +237 -39
- package/examples/jsm/loaders/FontLoader.js +23 -5
- package/examples/jsm/loaders/GCodeLoader.js +34 -8
- package/examples/jsm/loaders/GLTFLoader.js +159 -185
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +5 -5
- package/examples/jsm/loaders/HDRLoader.js +485 -0
- package/examples/jsm/loaders/KMZLoader.js +5 -5
- package/examples/jsm/loaders/KTX2Loader.js +162 -53
- package/examples/jsm/loaders/KTXLoader.js +2 -2
- package/examples/jsm/loaders/LDrawLoader.js +41 -50
- package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
- package/examples/jsm/loaders/LUTCubeLoader.js +1 -1
- package/examples/jsm/loaders/LWOLoader.js +9 -41
- package/examples/jsm/loaders/MaterialXLoader.js +22 -5
- package/examples/jsm/loaders/NRRDLoader.js +2 -2
- package/examples/jsm/loaders/OBJLoader.js +1 -1
- package/examples/jsm/loaders/PCDLoader.js +4 -2
- package/examples/jsm/loaders/PDBLoader.js +1 -1
- package/examples/jsm/loaders/RGBELoader.js +7 -473
- package/examples/jsm/loaders/SVGLoader.js +4 -4
- package/examples/jsm/loaders/TDSLoader.js +0 -2
- package/examples/jsm/loaders/TGALoader.js +0 -2
- package/examples/jsm/loaders/TTFLoader.js +4 -4
- package/examples/jsm/loaders/USDLoader.js +100 -40
- package/examples/jsm/loaders/UltraHDRLoader.js +287 -162
- package/examples/jsm/loaders/VOXLoader.js +660 -117
- package/examples/jsm/loaders/VRMLLoader.js +79 -2
- package/examples/jsm/loaders/VTKLoader.js +42 -25
- package/examples/jsm/loaders/collada/ColladaComposer.js +3044 -0
- package/examples/jsm/loaders/collada/ColladaParser.js +1977 -0
- package/examples/jsm/loaders/lwo/IFFParser.js +1 -1
- package/examples/jsm/loaders/usd/USDAParser.js +450 -363
- package/examples/jsm/loaders/usd/USDCParser.js +1867 -6
- package/examples/jsm/loaders/usd/USDComposer.js +4594 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +2 -2
- package/examples/jsm/materials/WoodNodeMaterial.js +533 -0
- package/examples/jsm/math/ColorSpaces.js +19 -1
- package/examples/jsm/math/ConvexHull.js +3 -3
- package/examples/jsm/math/ImprovedNoise.js +1 -1
- package/examples/jsm/math/Lut.js +2 -2
- package/examples/jsm/math/Octree.js +131 -1
- package/examples/jsm/math/SimplexNoise.js +1 -1
- package/examples/jsm/misc/GPUComputationRenderer.js +2 -0
- package/examples/jsm/misc/MD2CharacterComplex.js +1 -1
- package/examples/jsm/misc/ProgressiveLightMap.js +9 -3
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +7 -1
- package/examples/jsm/misc/RollerCoaster.js +42 -4
- package/examples/jsm/misc/TubePainter.js +383 -40
- package/examples/jsm/misc/Volume.js +1 -2
- package/examples/jsm/misc/VolumeSlice.js +0 -1
- package/examples/jsm/modifiers/SimplifyModifier.js +1 -1
- package/examples/jsm/modifiers/TessellateModifier.js +1 -1
- package/examples/jsm/objects/LensflareMesh.js +1 -1
- package/examples/jsm/objects/Reflector.js +73 -25
- package/examples/jsm/objects/ReflectorForSSRPass.js +1 -0
- package/examples/jsm/objects/Sky.js +91 -7
- package/examples/jsm/objects/SkyMesh.js +151 -17
- package/examples/jsm/objects/Water.js +7 -6
- package/examples/jsm/objects/Water2.js +5 -3
- package/examples/jsm/objects/WaterMesh.js +11 -13
- package/examples/jsm/physics/AmmoPhysics.js +12 -7
- package/examples/jsm/physics/JoltPhysics.js +10 -6
- package/examples/jsm/physics/RapierPhysics.js +9 -5
- package/examples/jsm/postprocessing/EffectComposer.js +7 -5
- package/examples/jsm/postprocessing/GlitchPass.js +2 -2
- package/examples/jsm/postprocessing/OutlinePass.js +1 -1
- package/examples/jsm/postprocessing/OutputPass.js +9 -0
- package/examples/jsm/postprocessing/RenderPass.js +10 -0
- package/examples/jsm/postprocessing/RenderTransitionPass.js +1 -1
- package/examples/jsm/postprocessing/SSRPass.js +37 -8
- package/examples/jsm/postprocessing/UnrealBloomPass.js +56 -24
- package/examples/jsm/renderers/CSS2DRenderer.js +16 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +8 -7
- package/examples/jsm/renderers/Projector.js +246 -28
- package/examples/jsm/renderers/SVGRenderer.js +175 -61
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +1 -1
- package/examples/jsm/shaders/AfterimageShader.js +1 -1
- package/examples/jsm/shaders/BleachBypassShader.js +1 -1
- package/examples/jsm/shaders/BokehShader.js +1 -1
- package/examples/jsm/shaders/BokehShader2.js +1 -1
- package/examples/jsm/shaders/DotScreenShader.js +1 -1
- package/examples/jsm/shaders/FocusShader.js +1 -1
- package/examples/jsm/shaders/GTAOShader.js +21 -8
- package/examples/jsm/shaders/HalftoneShader.js +12 -1
- package/examples/jsm/shaders/KaleidoShader.js +1 -1
- package/examples/jsm/shaders/PoissonDenoiseShader.js +8 -4
- package/examples/jsm/shaders/SAOShader.js +17 -4
- package/examples/jsm/shaders/SSAOShader.js +11 -1
- package/examples/jsm/shaders/SSRShader.js +7 -6
- package/examples/jsm/shaders/SepiaShader.js +1 -1
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +1 -1
- package/examples/jsm/shaders/TriangleBlurShader.js +1 -1
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +3 -5
- package/examples/jsm/shaders/VignetteShader.js +1 -1
- package/examples/jsm/transpiler/AST.js +44 -0
- package/examples/jsm/transpiler/GLSLDecoder.js +85 -25
- package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -0
- package/examples/jsm/transpiler/TSLEncoder.js +52 -10
- package/examples/jsm/transpiler/TranspilerUtils.js +3 -3
- package/examples/jsm/transpiler/WGSLEncoder.js +51 -0
- package/examples/jsm/tsl/WebGLNodesHandler.js +605 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +36 -24
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +458 -16
- package/examples/jsm/tsl/display/AnamorphicNode.js +40 -5
- package/examples/jsm/tsl/display/BilateralBlurNode.js +374 -0
- package/examples/jsm/tsl/display/BloomNode.js +23 -9
- package/examples/jsm/tsl/display/CRT.js +150 -0
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +5 -37
- package/examples/jsm/tsl/display/DenoiseNode.js +3 -1
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +446 -90
- package/examples/jsm/tsl/display/DotScreenNode.js +1 -1
- package/examples/jsm/tsl/display/FSR1Node.js +477 -0
- package/examples/jsm/tsl/display/FXAANode.js +2 -2
- package/examples/jsm/tsl/display/GTAONode.js +59 -9
- package/examples/jsm/tsl/display/GaussianBlurNode.js +68 -35
- package/examples/jsm/tsl/display/GodraysNode.js +615 -0
- package/examples/jsm/tsl/display/LensflareNode.js +1 -1
- package/examples/jsm/tsl/display/Lut3DNode.js +1 -1
- package/examples/jsm/tsl/display/OutlineNode.js +81 -20
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +2 -2
- package/examples/jsm/tsl/display/PixelationPassNode.js +7 -6
- package/examples/jsm/tsl/display/RGBShiftNode.js +2 -2
- package/examples/jsm/tsl/display/RetroPassNode.js +263 -0
- package/examples/jsm/tsl/display/SMAANode.js +2 -2
- package/examples/jsm/tsl/display/SSAAPassNode.js +2 -2
- package/examples/jsm/tsl/display/SSGINode.js +638 -0
- package/examples/jsm/tsl/display/SSRNode.js +186 -69
- package/examples/jsm/tsl/display/SSSNode.js +490 -0
- package/examples/jsm/tsl/display/Shape.js +29 -0
- package/examples/jsm/tsl/display/SharpenNode.js +283 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +2 -2
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +8 -1
- package/examples/jsm/tsl/display/StereoPassNode.js +1 -2
- package/examples/jsm/tsl/display/TAAUNode.js +835 -0
- package/examples/jsm/tsl/display/TRAANode.js +381 -75
- package/examples/jsm/tsl/display/TransitionNode.js +1 -1
- package/examples/jsm/tsl/display/boxBlur.js +65 -0
- package/examples/jsm/tsl/display/depthAwareBlend.js +80 -0
- package/examples/jsm/tsl/display/hashBlur.js +16 -18
- package/examples/jsm/tsl/display/radialBlur.js +68 -0
- package/examples/jsm/tsl/lighting/DynamicLightsNode.js +300 -0
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +21 -1
- package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.js +61 -0
- package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.js +111 -0
- package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.js +99 -0
- package/examples/jsm/tsl/lighting/data/PointLightDataNode.js +134 -0
- package/examples/jsm/tsl/lighting/data/SpotLightDataNode.js +161 -0
- package/examples/jsm/tsl/math/Bayer.js +53 -3
- package/examples/jsm/utils/BufferGeometryUtils.js +3 -4
- package/examples/jsm/utils/ColorUtils.js +76 -0
- package/examples/jsm/utils/LDrawUtils.js +1 -1
- package/examples/jsm/utils/ShadowMapViewer.js +24 -10
- package/examples/jsm/utils/ShadowMapViewerGPU.js +13 -6
- package/examples/jsm/utils/SkeletonUtils.js +14 -8
- package/examples/jsm/utils/WebGPUTextureUtils.js +1 -1
- package/examples/jsm/webxr/OculusHandModel.js +1 -1
- package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
- package/examples/jsm/webxr/XRHandMeshModel.js +36 -10
- package/examples/jsm/webxr/XRHandModelFactory.js +4 -7
- package/package.json +27 -38
- package/src/Three.Core.js +7 -3
- package/src/Three.TSL.js +61 -16
- package/src/Three.WebGPU.Nodes.js +7 -0
- package/src/Three.WebGPU.js +11 -0
- package/src/Three.js +1 -0
- package/src/animation/AnimationAction.js +12 -2
- package/src/animation/AnimationClip.js +21 -5
- package/src/animation/AnimationMixer.js +9 -3
- package/src/animation/AnimationObjectGroup.js +2 -1
- package/src/animation/AnimationUtils.js +1 -12
- package/src/animation/KeyframeTrack.js +54 -14
- package/src/animation/PropertyBinding.js +12 -11
- package/src/animation/PropertyMixer.js +4 -4
- package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
- package/src/animation/tracks/ColorKeyframeTrack.js +1 -1
- package/src/animation/tracks/NumberKeyframeTrack.js +1 -1
- package/src/animation/tracks/QuaternionKeyframeTrack.js +1 -1
- package/src/animation/tracks/StringKeyframeTrack.js +1 -1
- package/src/animation/tracks/VectorKeyframeTrack.js +1 -1
- package/src/audio/Audio.js +11 -10
- package/src/audio/AudioContext.js +2 -2
- package/src/audio/AudioListener.js +5 -3
- package/src/audio/PositionalAudio.js +1 -1
- package/src/cameras/Camera.js +32 -2
- package/src/cameras/CubeCamera.js +20 -0
- package/src/cameras/OrthographicCamera.js +1 -1
- package/src/cameras/PerspectiveCamera.js +1 -1
- package/src/cameras/StereoCamera.js +2 -2
- package/src/constants.js +100 -7
- package/src/core/BufferAttribute.js +13 -1
- package/src/core/BufferGeometry.js +24 -12
- package/src/core/Clock.js +7 -0
- package/src/core/EventDispatcher.js +1 -1
- package/src/core/InterleavedBuffer.js +1 -1
- package/src/core/InterleavedBufferAttribute.js +3 -2
- package/src/core/Object3D.js +55 -6
- package/src/core/Raycaster.js +4 -3
- package/src/core/RenderTarget.js +14 -5
- package/src/extras/Controls.js +5 -4
- package/src/extras/DataUtils.js +2 -1
- package/src/extras/Earcut.js +6 -0
- package/src/extras/ImageUtils.js +2 -2
- package/src/extras/PMREMGenerator.js +259 -57
- package/src/extras/TextureUtils.js +6 -1
- package/src/extras/core/Curve.js +2 -1
- package/src/extras/core/Interpolations.js +7 -1
- package/src/extras/core/ShapePath.js +4 -4
- package/src/extras/curves/CatmullRomCurve3.js +3 -2
- package/src/extras/lib/earcut.js +8 -8
- package/src/geometries/BoxGeometry.js +1 -0
- package/src/geometries/CapsuleGeometry.js +1 -0
- package/src/geometries/CircleGeometry.js +1 -0
- package/src/geometries/ConeGeometry.js +1 -0
- package/src/geometries/CylinderGeometry.js +1 -0
- package/src/geometries/DodecahedronGeometry.js +1 -0
- package/src/geometries/ExtrudeGeometry.js +10 -8
- package/src/geometries/IcosahedronGeometry.js +1 -0
- package/src/geometries/LatheGeometry.js +1 -0
- package/src/geometries/OctahedronGeometry.js +1 -0
- package/src/geometries/PlaneGeometry.js +1 -0
- package/src/geometries/PolyhedronGeometry.js +1 -1
- package/src/geometries/RingGeometry.js +1 -0
- package/src/geometries/ShapeGeometry.js +1 -0
- package/src/geometries/SphereGeometry.js +1 -0
- package/src/geometries/TetrahedronGeometry.js +1 -0
- package/src/geometries/TorusGeometry.js +9 -3
- package/src/geometries/TorusKnotGeometry.js +1 -0
- package/src/geometries/TubeGeometry.js +1 -0
- package/src/helpers/CameraHelper.js +4 -1
- package/src/helpers/DirectionalLightHelper.js +4 -1
- package/src/helpers/HemisphereLightHelper.js +3 -0
- package/src/helpers/PointLightHelper.js +1 -25
- package/src/helpers/SpotLightHelper.js +3 -0
- package/src/lights/DirectionalLight.js +13 -0
- package/src/lights/HemisphereLight.js +10 -0
- package/src/lights/Light.js +1 -11
- package/src/lights/LightProbe.js +0 -15
- package/src/lights/LightShadow.js +15 -6
- package/src/lights/PointLight.js +15 -0
- package/src/lights/PointLightShadow.js +0 -86
- package/src/lights/SpotLight.js +22 -1
- package/src/lights/webgpu/IESSpotLight.js +2 -1
- package/src/lights/webgpu/ProjectorLight.js +1 -1
- package/src/loaders/AnimationLoader.js +2 -1
- package/src/loaders/AudioLoader.js +13 -2
- package/src/loaders/BufferGeometryLoader.js +2 -2
- package/src/loaders/Cache.js +30 -2
- package/src/loaders/DataTextureLoader.js +6 -4
- package/src/loaders/FileLoader.js +4 -4
- package/src/loaders/ImageBitmapLoader.js +17 -13
- package/src/loaders/ImageLoader.js +1 -1
- package/src/loaders/Loader.js +9 -3
- package/src/loaders/LoadingManager.js +25 -3
- package/src/loaders/MaterialLoader.js +6 -4
- package/src/loaders/ObjectLoader.js +57 -17
- package/src/loaders/TextureLoader.js +1 -1
- package/src/loaders/nodes/NodeLoader.js +5 -4
- package/src/loaders/nodes/NodeObjectLoader.js +18 -0
- package/src/materials/Material.js +18 -3
- package/src/materials/MeshBasicMaterial.js +1 -0
- package/src/materials/MeshDepthMaterial.js +1 -0
- package/src/materials/MeshDistanceMaterial.js +1 -1
- package/src/materials/MeshLambertMaterial.js +11 -1
- package/src/materials/MeshMatcapMaterial.js +22 -0
- package/src/materials/MeshNormalMaterial.js +1 -0
- package/src/materials/MeshPhongMaterial.js +11 -1
- package/src/materials/MeshPhysicalMaterial.js +2 -1
- package/src/materials/MeshStandardMaterial.js +8 -7
- package/src/materials/MeshToonMaterial.js +2 -1
- package/src/materials/PointsMaterial.js +1 -1
- package/src/materials/ShaderMaterial.js +22 -3
- package/src/materials/nodes/Line2NodeMaterial.js +36 -9
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +5 -2
- package/src/materials/nodes/MeshSSSNodeMaterial.js +1 -1
- package/src/materials/nodes/MeshStandardNodeMaterial.js +5 -4
- package/src/materials/nodes/NodeMaterial.js +95 -35
- package/src/materials/nodes/PointsNodeMaterial.js +81 -28
- package/src/materials/nodes/SpriteNodeMaterial.js +3 -15
- package/src/materials/nodes/manager/NodeMaterialObserver.js +194 -88
- package/src/math/Color.js +6 -5
- package/src/math/ColorManagement.js +9 -3
- package/src/math/Cylindrical.js +1 -1
- package/src/math/Euler.js +2 -1
- package/src/math/Line3.js +6 -5
- package/src/math/MathUtils.js +23 -21
- package/src/math/Matrix2.js +14 -10
- package/src/math/Matrix3.js +15 -11
- package/src/math/Matrix4.js +94 -81
- package/src/math/Plane.js +5 -4
- package/src/math/Quaternion.js +60 -84
- package/src/math/Sphere.js +1 -1
- package/src/math/Spherical.js +1 -1
- package/src/math/Triangle.js +1 -1
- package/src/math/Vector2.js +11 -7
- package/src/math/Vector3.js +15 -13
- package/src/math/Vector4.js +13 -9
- package/src/math/interpolants/BezierInterpolant.js +108 -0
- package/src/nodes/Nodes.js +86 -65
- package/src/nodes/TSL.js +11 -8
- package/src/nodes/accessors/Arrays.js +1 -1
- package/src/nodes/accessors/BatchNode.js +10 -10
- package/src/nodes/accessors/Bitangent.js +5 -5
- package/src/nodes/accessors/BufferAttributeNode.js +107 -15
- package/src/nodes/accessors/BufferNode.js +30 -3
- package/src/nodes/accessors/Camera.js +260 -13
- package/src/nodes/accessors/ClippingNode.js +10 -9
- package/src/nodes/accessors/CubeTextureNode.js +32 -6
- package/src/nodes/accessors/InstanceNode.js +164 -39
- package/src/nodes/accessors/Lights.js +10 -0
- package/src/nodes/accessors/MaterialNode.js +9 -1
- package/src/nodes/accessors/MaterialProperties.js +2 -5
- package/src/nodes/accessors/MaterialReferenceNode.js +1 -2
- package/src/nodes/accessors/ModelNode.js +1 -1
- package/src/nodes/accessors/Normal.js +16 -15
- package/src/nodes/accessors/Object3DNode.js +2 -2
- package/src/nodes/accessors/Position.js +51 -3
- package/src/nodes/accessors/ReferenceBaseNode.js +7 -7
- package/src/nodes/accessors/ReferenceNode.js +11 -10
- package/src/nodes/accessors/RendererReferenceNode.js +1 -2
- package/src/nodes/accessors/SceneProperties.js +47 -0
- package/src/nodes/accessors/SkinningNode.js +27 -26
- package/src/nodes/accessors/StorageBufferNode.js +14 -24
- package/src/nodes/accessors/StorageTextureNode.js +62 -9
- package/src/nodes/accessors/Tangent.js +4 -14
- package/src/nodes/accessors/Texture3DNode.js +41 -31
- package/src/nodes/accessors/TextureNode.js +193 -63
- package/src/nodes/accessors/UniformArrayNode.js +6 -4
- package/src/nodes/accessors/UserDataNode.js +1 -2
- package/src/nodes/accessors/VertexColorNode.js +1 -2
- package/src/nodes/code/FunctionCallNode.js +25 -5
- package/src/nodes/code/FunctionNode.js +25 -3
- package/src/nodes/core/ArrayNode.js +22 -2
- package/src/nodes/core/AssignNode.js +6 -5
- package/src/nodes/core/AttributeNode.js +5 -4
- package/src/nodes/core/BypassNode.js +1 -1
- package/src/nodes/core/ContextNode.js +133 -15
- package/src/nodes/core/IndexNode.js +4 -3
- package/src/nodes/core/InputNode.js +3 -2
- package/src/nodes/core/InspectorNode.js +128 -0
- package/src/nodes/core/{CacheNode.js → IsolateNode.js} +41 -8
- package/src/nodes/core/MRTNode.js +48 -2
- package/src/nodes/core/Node.js +264 -46
- package/src/nodes/core/NodeBuilder.js +453 -87
- package/src/nodes/core/NodeError.js +28 -0
- package/src/nodes/core/NodeFrame.js +31 -23
- package/src/nodes/core/NodeFunction.js +2 -1
- package/src/nodes/core/NodeParser.js +2 -1
- package/src/nodes/core/NodeUniform.js +1 -1
- package/src/nodes/core/NodeUtils.js +25 -97
- package/src/nodes/core/OutputStructNode.js +12 -10
- package/src/nodes/core/ParameterNode.js +34 -3
- package/src/nodes/core/PropertyNode.js +26 -3
- package/src/nodes/core/StackNode.js +99 -23
- package/src/nodes/core/StackTrace.js +139 -0
- package/src/nodes/core/StructNode.js +22 -8
- package/src/nodes/core/StructTypeNode.js +13 -18
- package/src/nodes/core/SubBuildNode.js +4 -4
- package/src/nodes/core/UniformGroupNode.js +36 -6
- package/src/nodes/core/UniformNode.js +37 -13
- package/src/nodes/core/VarNode.js +96 -34
- package/src/nodes/core/VaryingNode.js +2 -18
- package/src/nodes/display/BlendModes.js +0 -63
- package/src/nodes/display/BumpMapNode.js +1 -1
- package/src/nodes/display/ColorAdjustment.js +18 -1
- package/src/nodes/display/ColorSpaceNode.js +3 -3
- package/src/nodes/display/FrontFacingNode.js +4 -8
- package/src/nodes/display/NormalMapNode.js +41 -5
- package/src/nodes/display/PassNode.js +175 -25
- package/src/nodes/display/RenderOutputNode.js +35 -9
- package/src/nodes/display/ScreenNode.js +47 -15
- package/src/nodes/display/ToneMappingNode.js +32 -5
- package/src/nodes/display/ToonOutlinePassNode.js +10 -2
- package/src/nodes/display/ViewportDepthNode.js +52 -4
- package/src/nodes/display/ViewportDepthTextureNode.js +14 -6
- package/src/nodes/display/ViewportSharedTextureNode.js +12 -0
- package/src/nodes/display/ViewportTextureNode.js +72 -14
- package/src/nodes/fog/Fog.js +18 -34
- package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +52 -0
- package/src/nodes/functions/BSDF/DFGLUT.js +56 -0
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
- package/src/nodes/functions/BasicLightingModel.js +2 -1
- package/src/nodes/functions/PhysicalLightingModel.js +128 -46
- package/src/nodes/functions/VolumetricLightingModel.js +5 -5
- package/src/nodes/geometry/RangeNode.js +44 -6
- package/src/nodes/gpgpu/AtomicFunctionNode.js +1 -1
- package/src/nodes/gpgpu/BarrierNode.js +9 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +4 -4
- package/src/nodes/gpgpu/ComputeNode.js +76 -38
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +455 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +5 -4
- package/src/nodes/lighting/AnalyticLightNode.js +53 -0
- package/src/nodes/lighting/EnvironmentNode.js +34 -9
- package/src/nodes/lighting/LightsNode.js +10 -32
- package/src/nodes/lighting/PointShadowNode.js +167 -148
- package/src/nodes/lighting/ShadowFilterNode.js +55 -65
- package/src/nodes/lighting/ShadowNode.js +189 -44
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/BitcountNode.js +433 -0
- package/src/nodes/math/ConditionalNode.js +25 -8
- package/src/nodes/math/MathNode.js +98 -57
- package/src/nodes/math/OperatorNode.js +8 -5
- package/src/nodes/math/PackFloatNode.js +98 -0
- package/src/nodes/math/UnpackFloatNode.js +96 -0
- package/src/nodes/pmrem/PMREMNode.js +1 -1
- package/src/nodes/pmrem/PMREMUtils.js +111 -2
- package/src/nodes/shapes/Shapes.js +1 -1
- package/src/nodes/tsl/TSLBase.js +6 -3
- package/src/nodes/tsl/TSLCore.js +488 -166
- package/src/nodes/utils/ArrayElementNode.js +14 -1
- package/src/nodes/utils/ConvertNode.js +1 -1
- package/src/nodes/utils/DebugNode.js +14 -13
- package/src/nodes/utils/EventNode.js +67 -2
- package/src/nodes/utils/FlipNode.js +1 -1
- package/src/nodes/utils/FunctionOverloadingNode.js +37 -19
- package/src/nodes/utils/JoinNode.js +7 -4
- package/src/nodes/utils/LoopNode.js +20 -24
- package/src/nodes/utils/MemberNode.js +60 -8
- package/src/nodes/utils/Packing.js +13 -1
- package/src/nodes/utils/PostProcessingUtils.js +60 -1
- package/src/nodes/utils/RTTNode.js +14 -4
- package/src/nodes/utils/ReflectorNode.js +61 -11
- package/src/nodes/utils/Remap.js +48 -0
- package/src/nodes/utils/RotateNode.js +1 -1
- package/src/nodes/utils/SampleNode.js +12 -2
- package/src/nodes/utils/SetNode.js +1 -1
- package/src/nodes/utils/SplitNode.js +12 -1
- package/src/nodes/utils/SpriteSheetUV.js +35 -0
- package/src/nodes/utils/Timer.js +0 -47
- package/src/nodes/utils/UVUtils.js +28 -0
- package/src/objects/BatchedMesh.js +46 -18
- package/src/objects/InstancedMesh.js +30 -3
- package/src/objects/LOD.js +1 -1
- package/src/objects/Line.js +3 -2
- package/src/objects/LineSegments.js +2 -1
- package/src/objects/Mesh.js +1 -1
- package/src/objects/Points.js +1 -1
- package/src/objects/Skeleton.js +12 -2
- package/src/objects/SkinnedMesh.js +29 -10
- package/src/objects/Sprite.js +4 -3
- package/src/renderers/WebGLRenderer.js +372 -179
- package/src/renderers/common/Animation.js +16 -4
- package/src/renderers/common/Attributes.js +16 -2
- package/src/renderers/common/Backend.js +137 -35
- package/src/renderers/common/Background.js +28 -14
- package/src/renderers/common/BindGroup.js +1 -16
- package/src/renderers/common/Binding.js +11 -0
- package/src/renderers/common/Bindings.js +83 -12
- package/src/renderers/common/BlendMode.js +143 -0
- package/src/renderers/common/Buffer.js +40 -0
- package/src/renderers/common/BundleGroup.js +1 -1
- package/src/renderers/common/CanvasTarget.js +341 -0
- package/src/renderers/common/ChainMap.js +30 -6
- package/src/renderers/common/ComputePipeline.js +1 -1
- package/src/renderers/common/CubeRenderTarget.js +51 -7
- package/src/renderers/common/DataMap.js +1 -1
- package/src/renderers/common/Geometries.js +55 -3
- package/src/renderers/common/Info.js +337 -6
- package/src/renderers/common/InspectorBase.js +151 -0
- package/src/renderers/common/Lighting.js +5 -21
- package/src/renderers/common/Pipelines.js +41 -8
- package/src/renderers/common/PostProcessing.js +9 -226
- package/src/renderers/common/QuadMesh.js +7 -1
- package/src/renderers/common/ReadbackBuffer.js +78 -0
- package/src/renderers/common/RenderBundle.js +3 -1
- package/src/renderers/common/RenderBundles.js +7 -3
- package/src/renderers/common/RenderContext.js +18 -2
- package/src/renderers/common/RenderContexts.js +33 -49
- package/src/renderers/common/RenderList.js +7 -3
- package/src/renderers/common/RenderLists.js +2 -1
- package/src/renderers/common/RenderObject.js +32 -6
- package/src/renderers/common/RenderObjectPipeline.js +40 -0
- package/src/renderers/common/RenderObjects.js +22 -6
- package/src/renderers/common/RenderPipeline.js +232 -17
- package/src/renderers/common/Renderer.js +927 -335
- package/src/renderers/common/RendererUtils.js +9 -0
- package/src/renderers/common/SampledTexture.js +9 -1
- package/src/renderers/common/Sampler.js +52 -14
- package/src/renderers/common/StorageBuffer.js +13 -1
- package/src/renderers/common/StorageTexture.js +9 -1
- package/src/renderers/common/Textures.js +208 -47
- package/src/renderers/common/TimestampQueryPool.js +70 -6
- package/src/renderers/common/Uniform.js +8 -0
- package/src/renderers/common/UniformsGroup.js +64 -2
- package/src/renderers/common/XRManager.js +79 -51
- package/src/renderers/common/extras/PMREMGenerator.js +176 -79
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/NodeLibrary.js +9 -7
- package/src/renderers/common/nodes/{Nodes.js → NodeManager.js} +260 -95
- package/src/renderers/common/nodes/NodeSampler.js +13 -1
- package/src/renderers/common/nodes/NodeStorageBuffer.js +13 -2
- package/src/renderers/common/nodes/NodeUniformBuffer.js +52 -0
- package/src/renderers/shaders/DFGLUTData.js +49 -0
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +8 -10
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -12
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +1 -2
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +8 -12
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.js +80 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +13 -2
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +6 -2
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +2 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +8 -4
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +152 -59
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +20 -4
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +0 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +221 -190
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +12 -2
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk.js +5 -3
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +1 -2
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +4 -1
- package/src/renderers/shaders/ShaderLib/{distanceRGBA.glsl.js → distance.glsl.js} +1 -2
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +2 -1
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +1 -2
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +2 -1
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -9
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +0 -1
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/vsm.glsl.js +4 -6
- package/src/renderers/shaders/ShaderLib.js +7 -6
- package/src/renderers/shaders/UniformsLib.js +8 -5
- package/src/renderers/shaders/UniformsUtils.js +52 -9
- package/src/renderers/webgl/WebGLAnimation.js +2 -1
- package/src/renderers/webgl/WebGLBackground.js +15 -15
- package/src/renderers/webgl/WebGLBindingStates.js +99 -27
- package/src/renderers/webgl/WebGLBufferRenderer.js +0 -32
- package/src/renderers/webgl/WebGLCapabilities.js +11 -5
- package/src/renderers/webgl/WebGLEnvironments.js +228 -0
- package/src/renderers/webgl/WebGLExtensions.js +2 -25
- package/src/renderers/webgl/WebGLGeometries.js +10 -7
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +0 -32
- package/src/renderers/webgl/WebGLInfo.js +3 -1
- package/src/renderers/webgl/WebGLLights.js +18 -1
- package/src/renderers/webgl/WebGLMaterials.js +24 -13
- package/src/renderers/webgl/WebGLObjects.js +3 -1
- package/src/renderers/webgl/WebGLOutput.js +270 -0
- package/src/renderers/webgl/WebGLProgram.js +63 -122
- package/src/renderers/webgl/WebGLPrograms.js +65 -52
- package/src/renderers/webgl/WebGLRenderLists.js +15 -0
- package/src/renderers/webgl/WebGLRenderStates.js +13 -2
- package/src/renderers/webgl/WebGLShadowMap.js +191 -26
- package/src/renderers/webgl/WebGLState.js +79 -40
- package/src/renderers/webgl/WebGLTextures.js +234 -68
- package/src/renderers/webgl/WebGLUniforms.js +40 -3
- package/src/renderers/webgl/WebGLUniformsGroups.js +24 -3
- package/src/renderers/webgl/WebGLUtils.js +8 -3
- package/src/renderers/webgl-fallback/WebGLBackend.js +438 -235
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +0 -41
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +339 -84
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +53 -19
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +25 -0
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +2 -3
- package/src/renderers/webgl-fallback/utils/WebGLState.js +229 -11
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +237 -72
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +56 -27
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +8 -3
- package/src/renderers/webgpu/WebGPUBackend.js +403 -253
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +2 -1
- package/src/renderers/webgpu/WebGPURenderer.js +5 -3
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +491 -123
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +108 -34
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +360 -201
- package/src/renderers/webgpu/utils/WebGPUCapabilities.js +48 -0
- package/src/renderers/webgpu/utils/WebGPUConstants.js +17 -2
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +111 -54
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +155 -205
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +407 -149
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +36 -13
- package/src/renderers/webgpu/utils/WebGPUUtils.js +55 -13
- package/src/renderers/webxr/WebXRController.js +12 -0
- package/src/renderers/webxr/WebXRManager.js +45 -29
- package/src/textures/CubeDepthTexture.js +76 -0
- package/src/textures/ExternalTexture.js +15 -4
- package/src/textures/HTMLTexture.js +74 -0
- package/src/textures/Source.js +5 -4
- package/src/textures/Texture.js +19 -7
- package/src/textures/VideoTexture.js +2 -3
- package/src/utils.js +344 -3
- package/examples/jsm/loaders/RGBMLoader.js +0 -1148
- package/examples/jsm/materials/MeshGouraudMaterial.js +0 -434
- package/examples/jsm/materials/MeshPostProcessingMaterial.js +0 -167
- package/examples/jsm/shaders/GodRaysShader.js +0 -333
- package/src/nodes/accessors/SceneNode.js +0 -144
- package/src/nodes/code/ScriptableNode.js +0 -726
- package/src/nodes/code/ScriptableValueNode.js +0 -253
- package/src/nodes/display/PosterizeNode.js +0 -65
- package/src/nodes/functions/BSDF/DFGApprox.js +0 -30
- package/src/nodes/utils/RemapNode.js +0 -125
- package/src/nodes/utils/SpriteSheetUVNode.js +0 -90
- package/src/renderers/webgl/WebGLCubeMaps.js +0 -99
- package/src/renderers/webgl/WebGLCubeUVMaps.js +0 -134
|
@@ -14,7 +14,7 @@ import PassNode from './PassNode.js';
|
|
|
14
14
|
* will receive the outline.
|
|
15
15
|
*
|
|
16
16
|
* ```js
|
|
17
|
-
* const postProcessing = new
|
|
17
|
+
* const postProcessing = new RenderPipeline( renderer );
|
|
18
18
|
*
|
|
19
19
|
* const scenePass = toonOutlinePass( scene, camera );
|
|
20
20
|
*
|
|
@@ -72,6 +72,14 @@ class ToonOutlinePassNode extends PassNode {
|
|
|
72
72
|
*/
|
|
73
73
|
this._materialCache = new WeakMap();
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* The name of this pass.
|
|
77
|
+
*
|
|
78
|
+
* @type {string}
|
|
79
|
+
* @default 'Outline Pass'
|
|
80
|
+
*/
|
|
81
|
+
this.name = 'Outline Pass';
|
|
82
|
+
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
updateBefore( frame ) {
|
|
@@ -180,4 +188,4 @@ export default ToonOutlinePassNode;
|
|
|
180
188
|
* @param {number} [alpha=1] - Defines the outline's alpha.
|
|
181
189
|
* @returns {ToonOutlinePassNode}
|
|
182
190
|
*/
|
|
183
|
-
export const toonOutlinePass = ( scene, camera, color = new Color( 0, 0, 0 ), thickness = 0.003, alpha = 1 ) =>
|
|
191
|
+
export const toonOutlinePass = ( scene, camera, color = new Color( 0, 0, 0 ), thickness = 0.003, alpha = 1 ) => new ToonOutlinePassNode( scene, camera, nodeObject( color ), nodeObject( thickness ), nodeObject( alpha ) );
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Node from '../core/Node.js';
|
|
2
|
-
import { float, log, log2, nodeImmutable, nodeProxy } from '../tsl/TSLBase.js';
|
|
2
|
+
import { float, Fn, log, log2, nodeImmutable, nodeProxy } from '../tsl/TSLBase.js';
|
|
3
3
|
import { cameraNear, cameraFar } from '../accessors/Camera.js';
|
|
4
4
|
import { positionView } from '../accessors/Position.js';
|
|
5
5
|
import { viewportDepthTexture } from './ViewportDepthTextureNode.js';
|
|
@@ -86,7 +86,7 @@ class ViewportDepthNode extends Node {
|
|
|
86
86
|
|
|
87
87
|
if ( value !== null ) {
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
node = depthBase().assign( value );
|
|
90
90
|
|
|
91
91
|
}
|
|
92
92
|
|
|
@@ -152,6 +152,18 @@ export default ViewportDepthNode;
|
|
|
152
152
|
*/
|
|
153
153
|
export const viewZToOrthographicDepth = ( viewZ, near, far ) => viewZ.add( near ).div( near.sub( far ) );
|
|
154
154
|
|
|
155
|
+
/**
|
|
156
|
+
* TSL function for converting a viewZ value to a reversed orthographic depth value.
|
|
157
|
+
*
|
|
158
|
+
* @tsl
|
|
159
|
+
* @function
|
|
160
|
+
* @param {Node<float>} viewZ - The viewZ node.
|
|
161
|
+
* @param {Node<float>} near - The camera's near value.
|
|
162
|
+
* @param {Node<float>} far - The camera's far value.
|
|
163
|
+
* @returns {Node<float>}
|
|
164
|
+
*/
|
|
165
|
+
export const viewZToReversedOrthographicDepth = ( viewZ, near, far ) => viewZ.add( far ).div( far.sub( near ) );
|
|
166
|
+
|
|
155
167
|
/**
|
|
156
168
|
* TSL function for converting an orthographic depth value to a viewZ value.
|
|
157
169
|
*
|
|
@@ -162,7 +174,19 @@ export const viewZToOrthographicDepth = ( viewZ, near, far ) => viewZ.add( near
|
|
|
162
174
|
* @param {Node<float>} far - The camera's far value.
|
|
163
175
|
* @returns {Node<float>}
|
|
164
176
|
*/
|
|
165
|
-
export const orthographicDepthToViewZ = ( depth, near, far
|
|
177
|
+
export const orthographicDepthToViewZ = /*@__PURE__*/ Fn( ( [ depth, near, far ], builder ) => {
|
|
178
|
+
|
|
179
|
+
if ( builder.renderer.reversedDepthBuffer === true ) {
|
|
180
|
+
|
|
181
|
+
return far.sub( near ).mul( depth ).sub( far );
|
|
182
|
+
|
|
183
|
+
} else {
|
|
184
|
+
|
|
185
|
+
return near.sub( far ).mul( depth ).sub( near );
|
|
186
|
+
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
} );
|
|
166
190
|
|
|
167
191
|
/**
|
|
168
192
|
* TSL function for converting a viewZ value to a perspective depth value.
|
|
@@ -178,6 +202,18 @@ export const orthographicDepthToViewZ = ( depth, near, far ) => near.sub( far ).
|
|
|
178
202
|
*/
|
|
179
203
|
export const viewZToPerspectiveDepth = ( viewZ, near, far ) => near.add( viewZ ).mul( far ).div( far.sub( near ).mul( viewZ ) );
|
|
180
204
|
|
|
205
|
+
/**
|
|
206
|
+
* TSL function for converting a viewZ value to a reversed perspective depth value.
|
|
207
|
+
*
|
|
208
|
+
* @tsl
|
|
209
|
+
* @function
|
|
210
|
+
* @param {Node<float>} viewZ - The viewZ node.
|
|
211
|
+
* @param {Node<float>} near - The camera's near value.
|
|
212
|
+
* @param {Node<float>} far - The camera's far value.
|
|
213
|
+
* @returns {Node<float>}
|
|
214
|
+
*/
|
|
215
|
+
export const viewZToReversedPerspectiveDepth = ( viewZ, near, far ) => near.mul( viewZ.add( far ) ).div( viewZ.mul( near.sub( far ) ) );
|
|
216
|
+
|
|
181
217
|
/**
|
|
182
218
|
* TSL function for converting a perspective depth value to a viewZ value.
|
|
183
219
|
*
|
|
@@ -188,7 +224,19 @@ export const viewZToPerspectiveDepth = ( viewZ, near, far ) => near.add( viewZ )
|
|
|
188
224
|
* @param {Node<float>} far - The camera's far value.
|
|
189
225
|
* @returns {Node<float>}
|
|
190
226
|
*/
|
|
191
|
-
export const perspectiveDepthToViewZ = ( depth, near, far
|
|
227
|
+
export const perspectiveDepthToViewZ = /*@__PURE__*/ Fn( ( [ depth, near, far ], builder ) => {
|
|
228
|
+
|
|
229
|
+
if ( builder.renderer.reversedDepthBuffer === true ) {
|
|
230
|
+
|
|
231
|
+
return near.mul( far ).div( near.sub( far ).mul( depth ).sub( near ) );
|
|
232
|
+
|
|
233
|
+
} else {
|
|
234
|
+
|
|
235
|
+
return near.mul( far ).div( far.sub( near ).mul( depth ).sub( far ) );
|
|
236
|
+
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
} );
|
|
192
240
|
|
|
193
241
|
/**
|
|
194
242
|
* TSL function for converting a viewZ value to a logarithmic depth value.
|
|
@@ -4,7 +4,7 @@ import { screenUV } from './ScreenNode.js';
|
|
|
4
4
|
|
|
5
5
|
import { DepthTexture } from '../../textures/DepthTexture.js';
|
|
6
6
|
|
|
7
|
-
let
|
|
7
|
+
let _sharedDepthbuffer = null;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Represents the depth of the current viewport as a texture. This module
|
|
@@ -26,16 +26,23 @@ class ViewportDepthTextureNode extends ViewportTextureNode {
|
|
|
26
26
|
*
|
|
27
27
|
* @param {Node} [uvNode=screenUV] - The uv node.
|
|
28
28
|
* @param {?Node} [levelNode=null] - The level node.
|
|
29
|
+
* @param {?DepthTexture} [depthTexture=null] - A depth texture. If not provided, uses a shared depth texture.
|
|
29
30
|
*/
|
|
30
|
-
constructor( uvNode = screenUV, levelNode = null ) {
|
|
31
|
+
constructor( uvNode = screenUV, levelNode = null, depthTexture = null ) {
|
|
31
32
|
|
|
32
|
-
if (
|
|
33
|
+
if ( depthTexture === null ) {
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
if ( _sharedDepthbuffer === null ) {
|
|
36
|
+
|
|
37
|
+
_sharedDepthbuffer = new DepthTexture();
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
depthTexture = _sharedDepthbuffer;
|
|
35
42
|
|
|
36
43
|
}
|
|
37
44
|
|
|
38
|
-
super( uvNode, levelNode,
|
|
45
|
+
super( uvNode, levelNode, depthTexture );
|
|
39
46
|
|
|
40
47
|
}
|
|
41
48
|
|
|
@@ -50,6 +57,7 @@ export default ViewportDepthTextureNode;
|
|
|
50
57
|
* @function
|
|
51
58
|
* @param {?Node} [uvNode=screenUV] - The uv node.
|
|
52
59
|
* @param {?Node} [levelNode=null] - The level node.
|
|
60
|
+
* @param {?DepthTexture} [depthTexture=null] - A depth texture. If not provided, a depth texture is created automatically.
|
|
53
61
|
* @returns {ViewportDepthTextureNode}
|
|
54
62
|
*/
|
|
55
|
-
export const viewportDepthTexture = /*@__PURE__*/ nodeProxy( ViewportDepthTextureNode ).setParameterLength( 0,
|
|
63
|
+
export const viewportDepthTexture = /*@__PURE__*/ nodeProxy( ViewportDepthTextureNode ).setParameterLength( 0, 3 );
|
|
@@ -39,6 +39,18 @@ class ViewportSharedTextureNode extends ViewportTextureNode {
|
|
|
39
39
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Overwritten so the method always returns the unique shared
|
|
44
|
+
* framebuffer texture.
|
|
45
|
+
*
|
|
46
|
+
* @return {FramebufferTexture} The shared framebuffer texture.
|
|
47
|
+
*/
|
|
48
|
+
getTextureForReference() {
|
|
49
|
+
|
|
50
|
+
return _sharedFramebuffer;
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
42
54
|
updateReference() {
|
|
43
55
|
|
|
44
56
|
return this;
|
|
@@ -80,11 +80,11 @@ class ViewportTextureNode extends TextureNode {
|
|
|
80
80
|
this.isOutputTextureNode = true;
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
|
-
* The `updateBeforeType` is set to `NodeUpdateType.RENDER` since the node
|
|
84
|
-
*
|
|
83
|
+
* The `updateBeforeType` is set to `NodeUpdateType.RENDER` since the node should extract
|
|
84
|
+
* the current contents of the bound framebuffer for each render call.
|
|
85
85
|
*
|
|
86
86
|
* @type {string}
|
|
87
|
-
* @default '
|
|
87
|
+
* @default 'render'
|
|
88
88
|
*/
|
|
89
89
|
this.updateBeforeType = NodeUpdateType.RENDER;
|
|
90
90
|
|
|
@@ -94,13 +94,35 @@ class ViewportTextureNode extends TextureNode {
|
|
|
94
94
|
* @type {WeakMap<RenderTarget, FramebufferTexture>}
|
|
95
95
|
* @private
|
|
96
96
|
*/
|
|
97
|
-
this.
|
|
97
|
+
this._cacheTextures = new WeakMap();
|
|
98
98
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
/**
|
|
102
|
+
* This methods returns a texture for the given render target or canvas target reference.
|
|
103
|
+
*
|
|
104
|
+
* To avoid rendering errors, `ViewportTextureNode` must use unique framebuffer textures
|
|
105
|
+
* for different render contexts.
|
|
106
|
+
*
|
|
107
|
+
* @param {?(RenderTarget|CanvasTarget)} [reference=null] - The render target or canvas target reference.
|
|
108
|
+
* @return {Texture} The framebuffer texture.
|
|
109
|
+
*/
|
|
110
|
+
getTextureForReference( reference = null ) {
|
|
111
|
+
|
|
112
|
+
let defaultFramebuffer;
|
|
113
|
+
let cacheTextures;
|
|
114
|
+
|
|
115
|
+
if ( this.referenceNode ) {
|
|
116
|
+
|
|
117
|
+
defaultFramebuffer = this.referenceNode.defaultFramebuffer;
|
|
118
|
+
cacheTextures = this.referenceNode._cacheTextures;
|
|
119
|
+
|
|
120
|
+
} else {
|
|
102
121
|
|
|
103
|
-
|
|
122
|
+
defaultFramebuffer = this.defaultFramebuffer;
|
|
123
|
+
cacheTextures = this._cacheTextures;
|
|
124
|
+
|
|
125
|
+
}
|
|
104
126
|
|
|
105
127
|
if ( reference === null ) {
|
|
106
128
|
|
|
@@ -108,15 +130,29 @@ class ViewportTextureNode extends TextureNode {
|
|
|
108
130
|
|
|
109
131
|
}
|
|
110
132
|
|
|
111
|
-
if (
|
|
133
|
+
if ( cacheTextures.has( reference ) === false ) {
|
|
112
134
|
|
|
113
135
|
const framebufferTexture = defaultFramebuffer.clone();
|
|
114
136
|
|
|
115
|
-
|
|
137
|
+
cacheTextures.set( reference, framebufferTexture );
|
|
116
138
|
|
|
117
139
|
}
|
|
118
140
|
|
|
119
|
-
return
|
|
141
|
+
return cacheTextures.get( reference );
|
|
142
|
+
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
updateReference( frame ) {
|
|
146
|
+
|
|
147
|
+
const renderer = frame.renderer;
|
|
148
|
+
const renderTarget = renderer.getRenderTarget();
|
|
149
|
+
const canvasTarget = renderer.getCanvasTarget();
|
|
150
|
+
|
|
151
|
+
const reference = renderTarget ? renderTarget : canvasTarget;
|
|
152
|
+
|
|
153
|
+
this.value = this.getTextureForReference( reference );
|
|
154
|
+
|
|
155
|
+
return this.value;
|
|
120
156
|
|
|
121
157
|
}
|
|
122
158
|
|
|
@@ -124,20 +160,27 @@ class ViewportTextureNode extends TextureNode {
|
|
|
124
160
|
|
|
125
161
|
const renderer = frame.renderer;
|
|
126
162
|
const renderTarget = renderer.getRenderTarget();
|
|
163
|
+
const canvasTarget = renderer.getCanvasTarget();
|
|
127
164
|
|
|
128
|
-
|
|
165
|
+
const reference = renderTarget ? renderTarget : canvasTarget;
|
|
166
|
+
|
|
167
|
+
if ( reference === null ) {
|
|
129
168
|
|
|
130
169
|
renderer.getDrawingBufferSize( _size );
|
|
131
170
|
|
|
171
|
+
} else if ( reference.getDrawingBufferSize ) {
|
|
172
|
+
|
|
173
|
+
reference.getDrawingBufferSize( _size );
|
|
174
|
+
|
|
132
175
|
} else {
|
|
133
176
|
|
|
134
|
-
_size.set(
|
|
177
|
+
_size.set( reference.width, reference.height );
|
|
135
178
|
|
|
136
179
|
}
|
|
137
180
|
|
|
138
181
|
//
|
|
139
182
|
|
|
140
|
-
const framebufferTexture = this.
|
|
183
|
+
const framebufferTexture = this.getTextureForReference( reference );
|
|
141
184
|
|
|
142
185
|
if ( framebufferTexture.image.width !== _size.width || framebufferTexture.image.height !== _size.height ) {
|
|
143
186
|
|
|
@@ -156,8 +199,6 @@ class ViewportTextureNode extends TextureNode {
|
|
|
156
199
|
|
|
157
200
|
framebufferTexture.generateMipmaps = currentGenerateMipmaps;
|
|
158
201
|
|
|
159
|
-
this.value = framebufferTexture;
|
|
160
|
-
|
|
161
202
|
}
|
|
162
203
|
|
|
163
204
|
clone() {
|
|
@@ -196,3 +237,20 @@ export const viewportTexture = /*@__PURE__*/ nodeProxy( ViewportTextureNode ).se
|
|
|
196
237
|
* @returns {ViewportTextureNode}
|
|
197
238
|
*/
|
|
198
239
|
export const viewportMipTexture = /*@__PURE__*/ nodeProxy( ViewportTextureNode, null, null, { generateMipmaps: true } ).setParameterLength( 0, 3 );
|
|
240
|
+
|
|
241
|
+
// Singleton instances for common usage
|
|
242
|
+
const _singletonOpaqueViewportTextureNode = /*@__PURE__*/ viewportMipTexture();
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* TSL function for creating a viewport texture node with enabled mipmap generation.
|
|
246
|
+
* The texture should only contain the opaque rendering objects.
|
|
247
|
+
*
|
|
248
|
+
* This should be used just in transparent or transmissive materials.
|
|
249
|
+
*
|
|
250
|
+
* @tsl
|
|
251
|
+
* @function
|
|
252
|
+
* @param {?Node} [uv=screenUV] - The uv node.
|
|
253
|
+
* @param {?Node} [level=null] - The level node.
|
|
254
|
+
* @returns {ViewportTextureNode}
|
|
255
|
+
*/
|
|
256
|
+
export const viewportOpaqueMipTexture = ( uv = screenUV, level = null ) => _singletonOpaqueViewportTextureNode.sample( uv, level ); // TODO: Use once() when sample() supports it
|
package/src/nodes/fog/Fog.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { positionView } from '../accessors/Position.js';
|
|
1
|
+
import { positionView, positionWorld } from '../accessors/Position.js';
|
|
2
2
|
import { smoothstep } from '../math/MathNode.js';
|
|
3
3
|
import { Fn, output, vec4 } from '../tsl/TSLBase.js';
|
|
4
4
|
|
|
@@ -63,51 +63,35 @@ export const densityFogFactor = Fn( ( [ density ], builder ) => {
|
|
|
63
63
|
} );
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
67
|
-
* Nodes of this type are assigned to `Scene.fogNode`.
|
|
66
|
+
* Constructs a new height fog factor node. This fog factor requires a Y-up coordinate system.
|
|
68
67
|
*
|
|
69
68
|
* @tsl
|
|
70
69
|
* @function
|
|
71
|
-
* @param {Node}
|
|
72
|
-
* @param {Node}
|
|
70
|
+
* @param {Node} density - Defines the fog density.
|
|
71
|
+
* @param {Node} height - The height threshold in world space. Everything below this y-coordinate is affected by fog.
|
|
73
72
|
*/
|
|
74
|
-
export const
|
|
75
|
-
|
|
76
|
-
return vec4( factor.toFloat().mix( output.rgb, color.toVec3() ), output.a );
|
|
77
|
-
|
|
78
|
-
} );
|
|
73
|
+
export const exponentialHeightFogFactor = Fn( ( [ density, height ], builder ) => {
|
|
79
74
|
|
|
80
|
-
|
|
75
|
+
const viewZ = getViewZNode( builder );
|
|
81
76
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
* @function
|
|
85
|
-
* @deprecated since r171. Use `fog( color, rangeFogFactor( near, far ) )` instead.
|
|
86
|
-
*
|
|
87
|
-
* @param {Node} color
|
|
88
|
-
* @param {Node} near
|
|
89
|
-
* @param {Node} far
|
|
90
|
-
* @returns {Function}
|
|
91
|
-
*/
|
|
92
|
-
export function rangeFog( color, near, far ) { // @deprecated, r171
|
|
77
|
+
const distance = height.sub( positionWorld.y ).max( 0 ).toConst();
|
|
78
|
+
const m = distance.mul( viewZ ).toConst();
|
|
93
79
|
|
|
94
|
-
|
|
95
|
-
return fog( color, rangeFogFactor( near, far ) );
|
|
80
|
+
return density.mul( density, m, m ).negate().exp().oneMinus();
|
|
96
81
|
|
|
97
|
-
}
|
|
82
|
+
} );
|
|
98
83
|
|
|
99
84
|
/**
|
|
85
|
+
* This class can be used to configure a fog for the scene.
|
|
86
|
+
* Nodes of this type are assigned to `Scene.fogNode`.
|
|
87
|
+
*
|
|
100
88
|
* @tsl
|
|
101
89
|
* @function
|
|
102
|
-
* @
|
|
103
|
-
*
|
|
104
|
-
* @param {Node} color
|
|
105
|
-
* @param {Node} density
|
|
106
|
-
* @returns {Function}
|
|
90
|
+
* @param {Node} color - Defines the color of the fog.
|
|
91
|
+
* @param {Node} factor - Defines how the fog is factored in the scene.
|
|
107
92
|
*/
|
|
108
|
-
export
|
|
93
|
+
export const fog = Fn( ( [ color, factor ] ) => {
|
|
109
94
|
|
|
110
|
-
|
|
111
|
-
return fog( color, densityFogFactor( density ) );
|
|
95
|
+
return vec4( factor.toFloat().mix( output.rgb, color.toVec3() ), output.a );
|
|
112
96
|
|
|
113
|
-
}
|
|
97
|
+
} );
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import BRDF_GGX from './BRDF_GGX.js';
|
|
2
|
+
import DFGLUT from './DFGLUT.js';
|
|
3
|
+
import { normalView } from '../../accessors/Normal.js';
|
|
4
|
+
import { positionViewDirection } from '../../accessors/Position.js';
|
|
5
|
+
import { EPSILON } from '../../math/MathNode.js';
|
|
6
|
+
import { Fn, float } from '../../tsl/TSLBase.js';
|
|
7
|
+
|
|
8
|
+
// GGX BRDF with multi-scattering energy compensation for direct lighting
|
|
9
|
+
// This provides more accurate energy conservation, especially for rough materials
|
|
10
|
+
// Based on "Practical Multiple Scattering Compensation for Microfacet Models"
|
|
11
|
+
// https://blog.selfshadow.com/publications/turquin/ms_comp_final.pdf
|
|
12
|
+
const BRDF_GGX_Multiscatter = /*@__PURE__*/ Fn( ( { lightDirection, f0, f90, roughness: _roughness, f, USE_IRIDESCENCE, USE_ANISOTROPY } ) => {
|
|
13
|
+
|
|
14
|
+
// Single-scattering BRDF (standard GGX)
|
|
15
|
+
const singleScatter = BRDF_GGX( { lightDirection, f0, f90, roughness: _roughness, f, USE_IRIDESCENCE, USE_ANISOTROPY } );
|
|
16
|
+
|
|
17
|
+
// Multi-scattering compensation
|
|
18
|
+
const dotNL = normalView.dot( lightDirection ).clamp();
|
|
19
|
+
const dotNV = normalView.dot( positionViewDirection ).clamp();
|
|
20
|
+
|
|
21
|
+
// Precomputed DFG values for view and light directions
|
|
22
|
+
const dfgV = DFGLUT( { roughness: _roughness, dotNV } );
|
|
23
|
+
const dfgL = DFGLUT( { roughness: _roughness, dotNV: dotNL } );
|
|
24
|
+
|
|
25
|
+
// Single-scattering energy for view and light
|
|
26
|
+
const FssEss_V = f0.mul( dfgV.x ).add( f90.mul( dfgV.y ) );
|
|
27
|
+
const FssEss_L = f0.mul( dfgL.x ).add( f90.mul( dfgL.y ) );
|
|
28
|
+
|
|
29
|
+
const Ess_V = dfgV.x.add( dfgV.y );
|
|
30
|
+
const Ess_L = dfgL.x.add( dfgL.y );
|
|
31
|
+
|
|
32
|
+
// Energy lost to multiple scattering
|
|
33
|
+
const Ems_V = float( 1.0 ).sub( Ess_V );
|
|
34
|
+
const Ems_L = float( 1.0 ).sub( Ess_L );
|
|
35
|
+
|
|
36
|
+
// Average Fresnel reflectance
|
|
37
|
+
const Favg = f0.add( f0.oneMinus().mul( 0.047619 ) ); // 1/21
|
|
38
|
+
|
|
39
|
+
// Multiple scattering contribution
|
|
40
|
+
// Uses geometric mean of view and light contributions for better energy distribution
|
|
41
|
+
const Fms = FssEss_V.mul( FssEss_L ).mul( Favg ).div( float( 1.0 ).sub( Ems_V.mul( Ems_L ).mul( Favg ).mul( Favg ) ).add( EPSILON ) );
|
|
42
|
+
|
|
43
|
+
// Energy compensation factor
|
|
44
|
+
const compensationFactor = Ems_V.mul( Ems_L );
|
|
45
|
+
|
|
46
|
+
const multiScatter = Fms.mul( compensationFactor );
|
|
47
|
+
|
|
48
|
+
return singleScatter.add( multiScatter );
|
|
49
|
+
|
|
50
|
+
} );
|
|
51
|
+
|
|
52
|
+
export default BRDF_GGX_Multiscatter;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Fn, vec2 } from '../../tsl/TSLBase.js';
|
|
2
|
+
import { texture } from '../../accessors/TextureNode.js';
|
|
3
|
+
|
|
4
|
+
import { DataTexture } from '../../../textures/DataTexture.js';
|
|
5
|
+
import { RGFormat, HalfFloatType, LinearFilter, ClampToEdgeWrapping } from '../../../constants.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Precomputed DFG LUT for Image-Based Lighting
|
|
9
|
+
* Resolution: 16x16
|
|
10
|
+
* Samples: 4096 per texel
|
|
11
|
+
* Format: RG16F (2 half floats per texel: scale, bias)
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const DATA = new Uint16Array( [
|
|
15
|
+
0x30b5, 0x3ad1, 0x314c, 0x3a4d, 0x33d2, 0x391c, 0x35ef, 0x3828, 0x37f3, 0x36a6, 0x38d1, 0x3539, 0x3979, 0x3410, 0x39f8, 0x3252, 0x3a53, 0x30f0, 0x3a94, 0x2fc9, 0x3abf, 0x2e35, 0x3ada, 0x2d05, 0x3ae8, 0x2c1f, 0x3aed, 0x2ae0, 0x3aea, 0x29d1, 0x3ae1, 0x28ff,
|
|
16
|
+
0x3638, 0x38e4, 0x364a, 0x38ce, 0x3699, 0x385e, 0x374e, 0x372c, 0x3839, 0x35a4, 0x38dc, 0x3462, 0x396e, 0x32c4, 0x39de, 0x3134, 0x3a2b, 0x3003, 0x3a59, 0x2e3a, 0x3a6d, 0x2ce1, 0x3a6e, 0x2bba, 0x3a5f, 0x2a33, 0x3a49, 0x290a, 0x3a2d, 0x2826, 0x3a0a, 0x26e8,
|
|
17
|
+
0x3894, 0x36d7, 0x3897, 0x36c9, 0x38a3, 0x3675, 0x38bc, 0x35ac, 0x38ee, 0x349c, 0x393e, 0x3332, 0x3997, 0x3186, 0x39e2, 0x3038, 0x3a13, 0x2e75, 0x3a29, 0x2cf5, 0x3a2d, 0x2bac, 0x3a21, 0x29ff, 0x3a04, 0x28bc, 0x39dc, 0x2790, 0x39ad, 0x261a, 0x3978, 0x24fa,
|
|
18
|
+
0x39ac, 0x34a8, 0x39ac, 0x34a3, 0x39ae, 0x3480, 0x39ae, 0x3423, 0x39b1, 0x330e, 0x39c2, 0x31a9, 0x39e0, 0x3063, 0x39fc, 0x2eb5, 0x3a0c, 0x2d1d, 0x3a14, 0x2bcf, 0x3a07, 0x29ff, 0x39e9, 0x28a3, 0x39be, 0x273c, 0x3989, 0x25b3, 0x394a, 0x2488, 0x3907, 0x2345,
|
|
19
|
+
0x3a77, 0x3223, 0x3a76, 0x321f, 0x3a73, 0x3204, 0x3a6a, 0x31b3, 0x3a58, 0x3114, 0x3a45, 0x303b, 0x3a34, 0x2eb6, 0x3a26, 0x2d31, 0x3a1e, 0x2bef, 0x3a0b, 0x2a0d, 0x39ec, 0x28a1, 0x39c0, 0x271b, 0x3987, 0x2580, 0x3944, 0x2449, 0x38fa, 0x22bd, 0x38ac, 0x2155,
|
|
20
|
+
0x3b07, 0x2fca, 0x3b06, 0x2fca, 0x3b00, 0x2fb8, 0x3af4, 0x2f7c, 0x3adb, 0x2eea, 0x3ab4, 0x2e00, 0x3a85, 0x2cec, 0x3a5e, 0x2bc5, 0x3a36, 0x2a00, 0x3a0d, 0x2899, 0x39dc, 0x2707, 0x39a0, 0x2562, 0x395a, 0x2424, 0x390b, 0x2268, 0x38b7, 0x20fd, 0x385f, 0x1fd1,
|
|
21
|
+
0x3b69, 0x2cb9, 0x3b68, 0x2cbb, 0x3b62, 0x2cbb, 0x3b56, 0x2cae, 0x3b3b, 0x2c78, 0x3b0d, 0x2c0a, 0x3acf, 0x2ae3, 0x3a92, 0x2998, 0x3a54, 0x2867, 0x3a17, 0x26d0, 0x39d3, 0x253c, 0x3989, 0x2402, 0x3935, 0x2226, 0x38dc, 0x20bd, 0x387d, 0x1f54, 0x381d, 0x1db3,
|
|
22
|
+
0x3ba9, 0x296b, 0x3ba8, 0x296f, 0x3ba3, 0x297b, 0x3b98, 0x2987, 0x3b7f, 0x2976, 0x3b4e, 0x2927, 0x3b0e, 0x2895, 0x3ac2, 0x27b7, 0x3a73, 0x263b, 0x3a23, 0x24e7, 0x39d0, 0x239b, 0x3976, 0x21d9, 0x3917, 0x207e, 0x38b2, 0x1ee7, 0x384b, 0x1d53, 0x37c7, 0x1c1e,
|
|
23
|
+
0x3bd2, 0x25cb, 0x3bd1, 0x25d3, 0x3bcd, 0x25f0, 0x3bc2, 0x261f, 0x3bad, 0x2645, 0x3b7d, 0x262d, 0x3b3e, 0x25c4, 0x3aec, 0x250f, 0x3a93, 0x243a, 0x3a32, 0x22ce, 0x39d0, 0x215b, 0x3969, 0x202a, 0x38fe, 0x1e6e, 0x388f, 0x1cf1, 0x381f, 0x1b9b, 0x3762, 0x19dd,
|
|
24
|
+
0x3be9, 0x21ab, 0x3be9, 0x21b7, 0x3be5, 0x21e5, 0x3bdd, 0x2241, 0x3bc9, 0x22a7, 0x3ba0, 0x22ec, 0x3b62, 0x22cd, 0x3b0f, 0x2247, 0x3aae, 0x2175, 0x3a44, 0x2088, 0x39d4, 0x1f49, 0x3960, 0x1dbe, 0x38e9, 0x1c77, 0x3870, 0x1ae8, 0x37f1, 0x1953, 0x3708, 0x181b,
|
|
25
|
+
0x3bf6, 0x1cea, 0x3bf6, 0x1cfb, 0x3bf3, 0x1d38, 0x3bec, 0x1dbd, 0x3bda, 0x1e7c, 0x3bb7, 0x1f25, 0x3b7d, 0x1f79, 0x3b2c, 0x1f4c, 0x3ac6, 0x1ea6, 0x3a55, 0x1dbb, 0x39da, 0x1cbd, 0x395a, 0x1b9d, 0x38d8, 0x1a00, 0x3855, 0x18ac, 0x37ab, 0x173c, 0x36b7, 0x1598,
|
|
26
|
+
0x3bfc, 0x1736, 0x3bfc, 0x1759, 0x3bf9, 0x17e7, 0x3bf4, 0x1896, 0x3be4, 0x1997, 0x3bc6, 0x1aa8, 0x3b91, 0x1b84, 0x3b43, 0x1bd2, 0x3ade, 0x1b8a, 0x3a65, 0x1acd, 0x39e2, 0x19d3, 0x3957, 0x18cd, 0x38ca, 0x17b3, 0x383e, 0x1613, 0x376d, 0x14bf, 0x366f, 0x135e,
|
|
27
|
+
0x3bff, 0x101b, 0x3bff, 0x1039, 0x3bfc, 0x10c8, 0x3bf9, 0x1226, 0x3bea, 0x1428, 0x3bcf, 0x1584, 0x3b9f, 0x16c5, 0x3b54, 0x179a, 0x3af0, 0x17ce, 0x3a76, 0x1771, 0x39ea, 0x16a4, 0x3956, 0x15a7, 0x38bf, 0x14a7, 0x3829, 0x1379, 0x3735, 0x11ea, 0x362d, 0x10a1,
|
|
28
|
+
0x3c00, 0x061b, 0x3c00, 0x066a, 0x3bfe, 0x081c, 0x3bfa, 0x0a4c, 0x3bed, 0x0d16, 0x3bd5, 0x0fb3, 0x3ba9, 0x114d, 0x3b63, 0x127c, 0x3b01, 0x132f, 0x3a85, 0x1344, 0x39f4, 0x12d2, 0x3957, 0x120d, 0x38b5, 0x1122, 0x3817, 0x103c, 0x3703, 0x0ed3, 0x35f0, 0x0d6d,
|
|
29
|
+
0x3c00, 0x007a, 0x3c00, 0x0089, 0x3bfe, 0x011d, 0x3bfb, 0x027c, 0x3bf0, 0x04fa, 0x3bda, 0x0881, 0x3bb1, 0x0acd, 0x3b6f, 0x0c97, 0x3b10, 0x0d7b, 0x3a93, 0x0df1, 0x39fe, 0x0def, 0x3959, 0x0d8a, 0x38af, 0x0ce9, 0x3808, 0x0c31, 0x36d5, 0x0af0, 0x35b9, 0x09a3,
|
|
30
|
+
0x3c00, 0x0000, 0x3c00, 0x0001, 0x3bff, 0x0015, 0x3bfb, 0x0059, 0x3bf2, 0x00fd, 0x3bdd, 0x01df, 0x3bb7, 0x031c, 0x3b79, 0x047c, 0x3b1d, 0x05d4, 0x3aa0, 0x06d5, 0x3a08, 0x075a, 0x395d, 0x075e, 0x38aa, 0x06f7, 0x37f4, 0x0648, 0x36ac, 0x0576, 0x3586, 0x049f
|
|
31
|
+
] );
|
|
32
|
+
|
|
33
|
+
let lut = null;
|
|
34
|
+
|
|
35
|
+
const DFGLUT = /*@__PURE__*/ Fn( ( { roughness, dotNV } ) => {
|
|
36
|
+
|
|
37
|
+
if ( lut === null ) {
|
|
38
|
+
|
|
39
|
+
lut = new DataTexture( DATA, 16, 16, RGFormat, HalfFloatType );
|
|
40
|
+
lut.name = 'DFG_LUT';
|
|
41
|
+
lut.minFilter = LinearFilter;
|
|
42
|
+
lut.magFilter = LinearFilter;
|
|
43
|
+
lut.wrapS = ClampToEdgeWrapping;
|
|
44
|
+
lut.wrapT = ClampToEdgeWrapping;
|
|
45
|
+
lut.generateMipmaps = false;
|
|
46
|
+
lut.needsUpdate = true;
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const uv = vec2( roughness, dotNV );
|
|
51
|
+
|
|
52
|
+
return texture( lut, uv ).rg;
|
|
53
|
+
|
|
54
|
+
} );
|
|
55
|
+
|
|
56
|
+
export default DFGLUT;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import DFGLUT from './DFGLUT.js';
|
|
2
2
|
import { Fn } from '../../tsl/TSLBase.js';
|
|
3
3
|
|
|
4
4
|
const EnvironmentBRDF = /*@__PURE__*/ Fn( ( inputs ) => {
|
|
5
5
|
|
|
6
6
|
const { dotNV, specularColor, specularF90, roughness } = inputs;
|
|
7
7
|
|
|
8
|
-
const fab =
|
|
8
|
+
const fab = DFGLUT( { dotNV, roughness } );
|
|
9
9
|
return specularColor.mul( fab.x ).add( specularF90.mul( fab.y ) );
|
|
10
10
|
|
|
11
11
|
} );
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { div } from '../../math/OperatorNode.js';
|
|
2
|
+
import { EPSILON } from '../../math/MathNode.js';
|
|
2
3
|
import { Fn, vec3 } from '../../tsl/TSLBase.js';
|
|
3
4
|
|
|
4
5
|
// https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf
|
|
@@ -7,9 +8,8 @@ const V_GGX_SmithCorrelated_Anisotropic = /*@__PURE__*/ Fn( ( { alphaT, alphaB,
|
|
|
7
8
|
|
|
8
9
|
const gv = dotNL.mul( vec3( alphaT.mul( dotTV ), alphaB.mul( dotBV ), dotNV ).length() );
|
|
9
10
|
const gl = dotNV.mul( vec3( alphaT.mul( dotTL ), alphaB.mul( dotBL ), dotNL ).length() );
|
|
10
|
-
const v = div( 0.5, gv.add( gl ) );
|
|
11
11
|
|
|
12
|
-
return
|
|
12
|
+
return div( 0.5, gv.add( gl ).max( EPSILON ) );
|
|
13
13
|
|
|
14
14
|
} ).setLayout( {
|
|
15
15
|
name: 'V_GGX_SmithCorrelated_Anisotropic',
|
|
@@ -4,6 +4,7 @@ import { MultiplyOperation, MixOperation, AddOperation } from '../../constants.j
|
|
|
4
4
|
import { materialSpecularStrength, materialReflectivity } from '../accessors/MaterialNode.js';
|
|
5
5
|
import { mix } from '../math/MathNode.js';
|
|
6
6
|
import { vec4 } from '../tsl/TSLBase.js';
|
|
7
|
+
import { warn } from '../../utils.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Represents the lighting model for unlit materials. The only light contribution
|
|
@@ -85,7 +86,7 @@ class BasicLightingModel extends LightingModel {
|
|
|
85
86
|
break;
|
|
86
87
|
|
|
87
88
|
default:
|
|
88
|
-
|
|
89
|
+
warn( 'BasicLightingModel: Unsupported .combine value:', material.combine );
|
|
89
90
|
break;
|
|
90
91
|
|
|
91
92
|
}
|