super-three 0.167.0 → 0.168.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/build/three.cjs +165 -44
- package/build/three.module.js +165 -45
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +23600 -21931
- package/build/three.webgpu.min.js +1 -1
- package/examples/jsm/Addons.js +3 -1
- package/examples/jsm/animation/AnimationClipCreator.js +1 -1
- package/examples/jsm/capabilities/WebGL.js +27 -21
- package/examples/jsm/controls/ArcballControls.js +174 -158
- package/examples/jsm/controls/DragControls.js +260 -132
- package/examples/jsm/controls/FirstPersonControls.js +175 -163
- package/examples/jsm/controls/FlyControls.js +194 -188
- package/examples/jsm/controls/OrbitControls.js +777 -786
- package/examples/jsm/controls/PointerLockControls.js +24 -15
- package/examples/jsm/controls/TrackballControls.js +453 -452
- package/examples/jsm/effects/AnaglyphEffect.js +6 -13
- package/examples/jsm/effects/ParallaxBarrierEffect.js +17 -11
- package/examples/jsm/effects/StereoEffect.js +6 -1
- package/examples/jsm/environments/RoomEnvironment.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +6 -1
- package/examples/jsm/exporters/USDZExporter.js +29 -8
- package/examples/jsm/helpers/LightProbeHelper.js +42 -43
- package/examples/jsm/loaders/KTX2Loader.js +19 -7
- package/examples/jsm/loaders/MaterialXLoader.js +11 -4
- package/examples/jsm/loaders/PCDLoader.js +9 -9
- package/examples/jsm/objects/SkyMesh.js +188 -0
- package/examples/jsm/objects/Water2Mesh.js +159 -0
- package/examples/jsm/objects/WaterMesh.js +102 -0
- package/examples/jsm/physics/RapierPhysics.js +20 -0
- package/examples/jsm/postprocessing/OutlinePass.js +31 -46
- package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
- package/examples/jsm/shaders/BleachBypassShader.js +1 -2
- package/examples/jsm/shaders/OutputShader.js +1 -1
- package/examples/jsm/transpiler/TSLEncoder.js +8 -8
- package/examples/jsm/utils/TextureUtils.js +1 -1
- package/package.json +2 -1
- package/src/Three.WebGPU.js +6 -0
- package/src/Three.js +1 -0
- package/src/constants.js +1 -1
- package/src/extras/Controls.js +32 -0
- package/src/loaders/ObjectLoader.js +3 -3
- package/src/{nodes/loaders → loaders/nodes}/NodeLoader.js +4 -4
- package/src/{nodes/loaders → loaders/nodes}/NodeMaterialLoader.js +1 -2
- package/src/materials/Material.js +4 -7
- package/src/{nodes/materials → materials/nodes}/InstancedPointsNodeMaterial.js +33 -24
- package/src/{nodes/materials → materials/nodes}/Line2NodeMaterial.js +34 -37
- package/src/{nodes/materials → materials/nodes}/LineBasicNodeMaterial.js +3 -4
- package/src/{nodes/materials → materials/nodes}/LineDashedNodeMaterial.js +7 -9
- package/src/{nodes/materials → materials/nodes}/MeshBasicNodeMaterial.js +11 -11
- package/src/{nodes/materials → materials/nodes}/MeshLambertNodeMaterial.js +5 -5
- package/src/{nodes/materials → materials/nodes}/MeshMatcapNodeMaterial.js +8 -8
- package/src/materials/nodes/MeshNormalNodeMaterial.js +40 -0
- package/src/{nodes/materials → materials/nodes}/MeshPhongNodeMaterial.js +9 -8
- package/src/{nodes/materials → materials/nodes}/MeshPhysicalNodeMaterial.js +18 -17
- package/src/{nodes/materials → materials/nodes}/MeshSSSNodeMaterial.js +6 -6
- package/src/{nodes/materials → materials/nodes}/MeshStandardNodeMaterial.js +17 -11
- package/src/{nodes/materials → materials/nodes}/MeshToonNodeMaterial.js +4 -4
- package/src/{nodes/materials → materials/nodes}/NodeMaterial.js +67 -86
- package/src/{nodes/materials/Materials.js → materials/nodes/NodeMaterials.js} +1 -1
- package/src/{nodes/materials → materials/nodes}/PointsNodeMaterial.js +3 -4
- package/src/{nodes/materials → materials/nodes}/ShadowNodeMaterial.js +4 -4
- package/src/{nodes/materials → materials/nodes}/SpriteNodeMaterial.js +11 -11
- package/src/{nodes/materials → materials/nodes}/VolumeNodeMaterial.js +14 -16
- package/src/nodes/Nodes.js +103 -159
- package/src/nodes/TSL.js +176 -0
- package/src/nodes/accessors/AccessorsUtils.js +8 -8
- package/src/nodes/accessors/BatchNode.js +48 -20
- package/src/nodes/accessors/{BitangentNode.js → Bitangent.js} +9 -9
- package/src/nodes/accessors/BufferAttributeNode.js +5 -5
- package/src/nodes/accessors/BufferNode.js +4 -4
- package/src/nodes/accessors/{CameraNode.js → Camera.js} +10 -10
- package/src/nodes/accessors/ClippingNode.js +16 -14
- package/src/nodes/accessors/CubeTextureNode.js +5 -7
- package/src/nodes/accessors/InstanceNode.js +17 -13
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +4 -4
- package/src/nodes/accessors/MaterialNode.js +52 -55
- package/src/nodes/accessors/MaterialProperties.js +3 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +6 -4
- package/src/nodes/accessors/ModelNode.js +11 -11
- package/src/nodes/accessors/ModelViewProjectionNode.js +6 -7
- package/src/nodes/accessors/MorphNode.js +12 -12
- package/src/nodes/accessors/Normal.js +62 -0
- package/src/nodes/accessors/Object3DNode.js +10 -10
- package/src/nodes/accessors/PointUVNode.js +4 -4
- package/src/nodes/accessors/Position.js +10 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +143 -0
- package/src/nodes/accessors/ReferenceNode.js +13 -7
- package/src/nodes/accessors/ReflectVector.js +10 -0
- package/src/nodes/accessors/RendererReferenceNode.js +6 -6
- package/src/nodes/accessors/SceneNode.js +5 -6
- package/src/nodes/accessors/SkinningNode.js +84 -21
- package/src/nodes/accessors/StorageBufferNode.js +4 -5
- package/src/nodes/accessors/StorageTextureNode.js +5 -5
- package/src/nodes/accessors/Tangent.js +22 -0
- package/src/nodes/accessors/Texture3DNode.js +11 -11
- package/src/nodes/accessors/{TextureBicubicNode.js → TextureBicubic.js} +3 -32
- package/src/nodes/accessors/TextureNode.js +16 -21
- package/src/nodes/accessors/TextureSizeNode.js +4 -6
- package/src/nodes/accessors/{UniformsNode.js → UniformArrayNode.js} +17 -8
- package/src/nodes/accessors/UserDataNode.js +4 -4
- package/src/nodes/accessors/VelocityNode.js +83 -0
- package/src/nodes/accessors/VertexColorNode.js +4 -4
- package/src/nodes/code/CodeNode.js +5 -5
- package/src/nodes/code/ExpressionNode.js +4 -4
- package/src/nodes/code/FunctionCallNode.js +5 -5
- package/src/nodes/code/FunctionNode.js +5 -23
- package/src/nodes/code/ScriptableNode.js +4 -6
- package/src/nodes/code/ScriptableValueNode.js +4 -6
- package/src/nodes/core/AssignNode.js +5 -5
- package/src/nodes/core/AttributeNode.js +7 -20
- package/src/nodes/core/BypassNode.js +5 -5
- package/src/nodes/core/CacheNode.js +5 -5
- package/src/nodes/core/ConstNode.js +2 -2
- package/src/nodes/core/ContextNode.js +17 -11
- package/src/nodes/core/IndexNode.js +12 -7
- package/src/nodes/core/InputNode.js +2 -2
- package/src/nodes/core/MRTNode.js +12 -6
- package/src/nodes/core/Node.js +39 -19
- package/src/nodes/core/NodeBuilder.js +46 -33
- package/src/nodes/core/NodeUtils.js +1 -0
- package/src/nodes/core/OutputStructNode.js +4 -4
- package/src/nodes/core/ParameterNode.js +4 -4
- package/src/nodes/core/PropertyNode.js +32 -32
- package/src/nodes/core/StackNode.js +26 -10
- package/src/nodes/core/StructTypeNode.js +2 -2
- package/src/nodes/core/TempNode.js +2 -2
- package/src/nodes/core/UniformGroupNode.js +8 -9
- package/src/nodes/core/UniformNode.js +4 -4
- package/src/nodes/core/VarNode.js +6 -6
- package/src/nodes/core/VaryingNode.js +5 -5
- package/src/nodes/display/AfterImageNode.js +9 -9
- package/src/nodes/display/AnaglyphPassNode.js +61 -0
- package/src/nodes/display/AnamorphicNode.js +11 -11
- package/src/nodes/display/BleachBypass.js +26 -0
- package/src/nodes/display/BlendMode.js +54 -0
- package/src/nodes/display/BloomNode.js +21 -19
- package/src/nodes/display/BumpMapNode.js +7 -12
- package/src/nodes/display/ColorAdjustment.js +46 -0
- package/src/nodes/display/ColorSpaceFunctions.js +38 -0
- package/src/nodes/display/ColorSpaceNode.js +40 -63
- package/src/nodes/display/DenoiseNode.js +20 -17
- package/src/nodes/display/DepthOfFieldNode.js +8 -6
- package/src/nodes/display/DotScreenNode.js +10 -22
- package/src/nodes/display/FXAANode.js +17 -15
- package/src/nodes/display/FilmNode.js +7 -6
- package/src/nodes/display/FrontFacingNode.js +5 -5
- package/src/nodes/display/GTAONode.js +19 -15
- package/src/nodes/display/GaussianBlurNode.js +11 -8
- package/src/nodes/display/Lut3DNode.js +6 -5
- package/src/nodes/display/MotionBlur.js +25 -0
- package/src/nodes/display/NormalMapNode.js +8 -10
- package/src/nodes/display/ParallaxBarrierPassNode.js +55 -0
- package/src/nodes/display/PassNode.js +84 -8
- package/src/nodes/display/PixelationPassNode.js +12 -7
- package/src/nodes/display/PosterizeNode.js +4 -6
- package/src/nodes/display/RGBShiftNode.js +8 -7
- package/src/nodes/display/RenderOutputNode.js +9 -9
- package/src/nodes/display/SSAAPassNode.js +284 -0
- package/src/nodes/display/Sepia.js +17 -0
- package/src/nodes/display/SobelOperatorNode.js +9 -7
- package/src/nodes/display/StereoCompositePassNode.js +107 -0
- package/src/nodes/display/StereoPassNode.js +80 -0
- package/src/nodes/display/ToneMappingFunctions.js +190 -0
- package/src/nodes/display/ToneMappingNode.js +12 -173
- package/src/nodes/display/TransitionNode.js +9 -8
- package/src/nodes/display/ViewportDepthNode.js +30 -29
- package/src/nodes/display/ViewportDepthTextureNode.js +6 -8
- package/src/nodes/display/ViewportNode.js +26 -25
- package/src/nodes/display/ViewportSharedTextureNode.js +6 -8
- package/src/nodes/display/ViewportTextureNode.js +7 -10
- package/src/nodes/fog/FogExp2Node.js +4 -6
- package/src/nodes/fog/FogNode.js +5 -7
- package/src/nodes/fog/FogRangeNode.js +4 -6
- package/src/nodes/functions/BSDF/BRDF_GGX.js +4 -4
- package/src/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
- package/src/nodes/functions/BSDF/DFGApprox.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +3 -3
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/src/nodes/functions/BSDF/F_Schlick.js +2 -2
- package/src/nodes/functions/BSDF/LTC.js +6 -6
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
- package/src/nodes/functions/BasicLightingModel.js +1 -1
- package/src/nodes/functions/PhongLightingModel.js +5 -5
- package/src/nodes/functions/PhysicalLightingModel.js +32 -31
- package/src/nodes/functions/ShadowMaskModel.js +1 -1
- package/src/nodes/functions/ToonLightingModel.js +3 -3
- package/src/nodes/functions/material/getGeometryRoughness.js +4 -4
- package/src/nodes/functions/material/getRoughness.js +2 -2
- package/src/nodes/geometry/RangeNode.js +4 -4
- package/src/nodes/gpgpu/ComputeNode.js +5 -5
- package/src/nodes/lighting/AONode.js +2 -2
- package/src/nodes/lighting/AmbientLightNode.js +2 -7
- package/src/nodes/lighting/AnalyticLightNode.js +34 -13
- package/src/nodes/lighting/BasicEnvironmentNode.js +4 -3
- package/src/nodes/lighting/BasicLightMapNode.js +3 -3
- package/src/nodes/lighting/DirectionalLightNode.js +2 -7
- package/src/nodes/lighting/EnvironmentNode.js +20 -19
- package/src/nodes/lighting/HemisphereLightNode.js +3 -7
- package/src/nodes/lighting/IESSpotLightNode.js +3 -8
- package/src/nodes/lighting/IrradianceNode.js +2 -2
- package/src/nodes/lighting/LightNode.js +5 -5
- package/src/nodes/lighting/LightProbeNode.js +76 -0
- package/src/nodes/lighting/LightUtils.js +3 -3
- package/src/nodes/lighting/LightingContextNode.js +15 -17
- package/src/nodes/lighting/LightingNode.js +2 -2
- package/src/nodes/lighting/LightsNode.js +94 -76
- package/src/nodes/lighting/PointLightNode.js +3 -8
- package/src/nodes/lighting/RectAreaLightNode.js +2 -6
- package/src/nodes/lighting/SpotLightNode.js +3 -8
- package/src/nodes/materialx/MaterialXNodes.js +2 -2
- package/src/nodes/materialx/lib/mx_hsv.js +36 -31
- package/src/nodes/materialx/lib/mx_noise.js +96 -96
- package/src/nodes/materialx/lib/mx_transform_color.js +2 -2
- package/src/nodes/math/{CondNode.js → ConditionalNode.js} +18 -7
- package/src/nodes/math/Hash.js +13 -0
- package/src/nodes/math/MathNode.js +124 -124
- package/src/nodes/math/MathUtils.js +0 -7
- package/src/nodes/math/OperatorNode.js +94 -52
- package/src/nodes/math/TriNoise3D.js +19 -29
- package/src/nodes/pmrem/PMREMNode.js +58 -15
- package/src/nodes/pmrem/PMREMUtils.js +46 -46
- package/src/nodes/procedural/Checker.js +14 -0
- package/src/nodes/tsl/TSLBase.js +30 -0
- package/src/nodes/{shadernode/ShaderNode.js → tsl/TSLCore.js} +105 -97
- package/src/nodes/utils/ArrayElementNode.js +2 -2
- package/src/nodes/utils/ConvertNode.js +2 -2
- package/src/nodes/utils/CubeMapNode.js +157 -0
- package/src/nodes/utils/Discard.js +8 -0
- package/src/nodes/utils/EquirectUVNode.js +5 -5
- package/src/nodes/utils/FlipNode.js +65 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +5 -5
- package/src/nodes/utils/JoinNode.js +2 -2
- package/src/nodes/utils/LoopNode.js +12 -6
- package/src/nodes/utils/MatcapUVNode.js +6 -6
- package/src/nodes/utils/MaxMipLevelNode.js +4 -4
- package/src/nodes/utils/OscNode.js +7 -7
- package/src/nodes/utils/Packing.js +4 -0
- package/src/nodes/utils/RTTNode.js +8 -8
- package/src/nodes/utils/ReflectorNode.js +8 -3
- package/src/nodes/utils/RemapNode.js +7 -7
- package/src/nodes/utils/RotateNode.js +4 -12
- package/src/nodes/utils/SetNode.js +2 -2
- package/src/nodes/utils/SplitNode.js +2 -2
- package/src/nodes/utils/SpriteSheetUVNode.js +5 -5
- package/src/nodes/utils/SpriteUtils.js +47 -0
- package/src/nodes/utils/StorageArrayElementNode.js +4 -6
- package/src/nodes/utils/TimerNode.js +5 -5
- package/src/nodes/utils/TriplanarTexturesNode.js +7 -9
- package/src/nodes/utils/UVUtils.js +19 -0
- package/src/nodes/utils/ViewportUtils.js +14 -0
- package/src/objects/BatchedMesh.js +2 -3
- package/src/renderers/WebGLRenderer.js +24 -0
- package/src/renderers/common/Backend.js +2 -2
- package/src/renderers/common/Background.js +3 -1
- package/src/renderers/common/BindGroup.js +3 -1
- package/src/renderers/common/Bindings.js +13 -15
- package/src/renderers/common/ClippingContext.js +14 -5
- package/src/renderers/common/CubeRenderTarget.js +9 -3
- package/src/renderers/common/PostProcessing.js +4 -1
- package/src/renderers/common/QuadMesh.js +2 -0
- package/src/renderers/common/RenderContext.js +24 -0
- package/src/renderers/common/RenderList.js +1 -1
- package/src/renderers/common/RenderObject.js +2 -2
- package/src/renderers/common/Renderer.js +75 -49
- package/src/renderers/common/SampledTexture.js +12 -3
- package/src/renderers/common/StandardRenderer.js +18 -0
- package/src/renderers/common/Textures.js +8 -12
- package/src/renderers/common/extras/PMREMGenerator.js +12 -13
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/NodeLibrary.js +118 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +2 -2
- package/src/renderers/common/nodes/Nodes.js +36 -9
- package/src/renderers/common/nodes/StandardNodeLibrary.js +105 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +2 -2
- package/src/renderers/webgl/WebGLProgram.js +1 -1
- package/src/renderers/webgl/WebGLProperties.js +7 -0
- package/src/renderers/webgl/WebGLTextures.js +61 -4
- package/src/renderers/webgl-fallback/WebGLBackend.js +88 -68
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +57 -9
- package/src/renderers/webgl-fallback/utils/WebGLState.js +21 -0
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +28 -21
- package/src/renderers/webgpu/WebGPUBackend.js +86 -68
- package/src/renderers/webgpu/WebGPURenderer.js +8 -8
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +99 -63
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +45 -21
- package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +6 -15
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +36 -21
- package/src/renderers/webgpu/utils/WebGPUUtils.js +18 -1
- package/src/renderers/webxr/WebXRManager.js +32 -25
- package/examples/jsm/loaders/LogLuvLoader.js +0 -606
- package/src/nodes/accessors/NormalNode.js +0 -14
- package/src/nodes/accessors/PositionNode.js +0 -10
- package/src/nodes/accessors/ReflectVectorNode.js +0 -10
- package/src/nodes/accessors/TangentNode.js +0 -23
- package/src/nodes/core/NodeKeywords.js +0 -80
- package/src/nodes/display/BlendModeNode.js +0 -128
- package/src/nodes/display/ColorAdjustmentNode.js +0 -104
- package/src/nodes/materials/MeshNormalNodeMaterial.js +0 -40
- package/src/nodes/math/HashNode.js +0 -34
- package/src/nodes/procedural/CheckerNode.js +0 -42
- package/src/nodes/utils/DiscardNode.js +0 -28
- package/src/nodes/utils/PackingNode.js +0 -55
- package/src/nodes/utils/RotateUVNode.js +0 -35
- /package/src/{nodes/loaders → loaders/nodes}/NodeObjectLoader.js +0 -0
- /package/src/nodes/accessors/{UVNode.js → UV.js} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import ViewportTextureNode from './ViewportTextureNode.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { viewportTopLeft } from './ViewportNode.js';
|
|
2
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
3
|
+
import { viewportUV } from './ViewportNode.js';
|
|
5
4
|
|
|
6
5
|
import { FramebufferTexture } from '../../textures/FramebufferTexture.js';
|
|
6
|
+
import { registerNode } from '../core/Node.js';
|
|
7
7
|
|
|
8
8
|
let _sharedFramebuffer = null;
|
|
9
9
|
|
|
10
10
|
class ViewportSharedTextureNode extends ViewportTextureNode {
|
|
11
11
|
|
|
12
|
-
constructor( uvNode =
|
|
12
|
+
constructor( uvNode = viewportUV, levelNode = null ) {
|
|
13
13
|
|
|
14
14
|
if ( _sharedFramebuffer === null ) {
|
|
15
15
|
|
|
@@ -31,8 +31,6 @@ class ViewportSharedTextureNode extends ViewportTextureNode {
|
|
|
31
31
|
|
|
32
32
|
export default ViewportSharedTextureNode;
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
ViewportSharedTextureNode.type = /*@__PURE__*/ registerNode( 'ViewportSharedTexture', ViewportSharedTextureNode );
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
addNodeClass( 'ViewportSharedTextureNode', ViewportSharedTextureNode );
|
|
36
|
+
export const viewportSharedTexture = /*@__PURE__*/ nodeProxy( ViewportSharedTextureNode );
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import TextureNode from '../accessors/TextureNode.js';
|
|
2
3
|
import { NodeUpdateType } from '../core/constants.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { viewportTopLeft } from './ViewportNode.js';
|
|
4
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
5
|
+
import { viewportUV } from './ViewportNode.js';
|
|
6
6
|
|
|
7
7
|
import { Vector2 } from '../../math/Vector2.js';
|
|
8
8
|
import { FramebufferTexture } from '../../textures/FramebufferTexture.js';
|
|
@@ -12,7 +12,7 @@ const _size = /*@__PURE__*/ new Vector2();
|
|
|
12
12
|
|
|
13
13
|
class ViewportTextureNode extends TextureNode {
|
|
14
14
|
|
|
15
|
-
constructor( uvNode =
|
|
15
|
+
constructor( uvNode = viewportUV, levelNode = null, framebufferTexture = null ) {
|
|
16
16
|
|
|
17
17
|
if ( framebufferTexture === null ) {
|
|
18
18
|
|
|
@@ -72,10 +72,7 @@ class ViewportTextureNode extends TextureNode {
|
|
|
72
72
|
|
|
73
73
|
export default ViewportTextureNode;
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
export const viewportMipTexture = nodeProxy( ViewportTextureNode, null, null, { generateMipmaps: true } );
|
|
75
|
+
ViewportTextureNode.type = /*@__PURE__*/ registerNode( 'ViewportTexture', ViewportTextureNode );
|
|
77
76
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
addNodeClass( 'ViewportTextureNode', ViewportTextureNode );
|
|
77
|
+
export const viewportTexture = /*@__PURE__*/ nodeProxy( ViewportTextureNode );
|
|
78
|
+
export const viewportMipTexture = /*@__PURE__*/ nodeProxy( ViewportTextureNode, null, null, { generateMipmaps: true } );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import FogNode from './FogNode.js';
|
|
2
|
-
import {
|
|
3
|
-
import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
|
|
3
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
4
4
|
|
|
5
5
|
class FogExp2Node extends FogNode {
|
|
6
6
|
|
|
@@ -27,8 +27,6 @@ class FogExp2Node extends FogNode {
|
|
|
27
27
|
|
|
28
28
|
export default FogExp2Node;
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
FogExp2Node.type = /*@__PURE__*/ registerNode( 'FogExp2', FogExp2Node );
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
addNodeClass( 'FogExp2Node', FogExp2Node );
|
|
32
|
+
export const densityFog = /*@__PURE__*/ nodeProxy( FogExp2Node );
|
package/src/nodes/fog/FogNode.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Node, {
|
|
2
|
-
import { positionView } from '../accessors/
|
|
3
|
-
import {
|
|
1
|
+
import Node, { registerNode } from '../core/Node.js';
|
|
2
|
+
import { positionView } from '../accessors/Position.js';
|
|
3
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
4
4
|
|
|
5
5
|
class FogNode extends Node {
|
|
6
6
|
|
|
@@ -41,8 +41,6 @@ class FogNode extends Node {
|
|
|
41
41
|
|
|
42
42
|
export default FogNode;
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
FogNode.type = /*@__PURE__*/ registerNode( 'Fog', FogNode );
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
addNodeClass( 'FogNode', FogNode );
|
|
46
|
+
export const fog = /*@__PURE__*/ nodeProxy( FogNode );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { registerNode } from '../core/Node.js';
|
|
1
2
|
import FogNode from './FogNode.js';
|
|
2
3
|
import { smoothstep } from '../math/MathNode.js';
|
|
3
|
-
import {
|
|
4
|
-
import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
|
|
4
|
+
import { nodeProxy } from '../tsl/TSLBase.js';
|
|
5
5
|
|
|
6
6
|
class FogRangeNode extends FogNode {
|
|
7
7
|
|
|
@@ -28,8 +28,6 @@ class FogRangeNode extends FogNode {
|
|
|
28
28
|
|
|
29
29
|
export default FogRangeNode;
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
FogRangeNode.type = /*@__PURE__*/ registerNode( 'FogRange', FogRangeNode );
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
addNodeClass( 'FogRangeNode', FogRangeNode );
|
|
33
|
+
export const rangeFog = /*@__PURE__*/ nodeProxy( FogRangeNode );
|
|
@@ -3,13 +3,13 @@ import V_GGX_SmithCorrelated from './V_GGX_SmithCorrelated.js';
|
|
|
3
3
|
import V_GGX_SmithCorrelated_Anisotropic from './V_GGX_SmithCorrelated_Anisotropic.js';
|
|
4
4
|
import D_GGX from './D_GGX.js';
|
|
5
5
|
import D_GGX_Anisotropic from './D_GGX_Anisotropic.js';
|
|
6
|
-
import { transformedNormalView } from '../../accessors/
|
|
7
|
-
import { positionViewDirection } from '../../accessors/
|
|
6
|
+
import { transformedNormalView } from '../../accessors/Normal.js';
|
|
7
|
+
import { positionViewDirection } from '../../accessors/Position.js';
|
|
8
8
|
import { iridescence, alphaT, anisotropyT, anisotropyB } from '../../core/PropertyNode.js';
|
|
9
|
-
import {
|
|
9
|
+
import { Fn, defined } from '../../tsl/TSLBase.js';
|
|
10
10
|
|
|
11
11
|
// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility
|
|
12
|
-
const BRDF_GGX =
|
|
12
|
+
const BRDF_GGX = /*@__PURE__*/ Fn( ( inputs ) => {
|
|
13
13
|
|
|
14
14
|
const { lightDirection, f0, f90, roughness, f, USE_IRIDESCENCE, USE_ANISOTROPY } = inputs;
|
|
15
15
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fn } from '../../tsl/TSLBase.js';
|
|
2
2
|
|
|
3
|
-
const BRDF_Lambert =
|
|
3
|
+
const BRDF_Lambert = /*@__PURE__*/ Fn( ( inputs ) => {
|
|
4
4
|
|
|
5
5
|
return inputs.diffuseColor.mul( 1 / Math.PI ); // punctual light
|
|
6
6
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { transformedNormalView } from '../../accessors/
|
|
2
|
-
import { positionViewDirection } from '../../accessors/
|
|
1
|
+
import { transformedNormalView } from '../../accessors/Normal.js';
|
|
2
|
+
import { positionViewDirection } from '../../accessors/Position.js';
|
|
3
3
|
import { sheen, sheenRoughness } from '../../core/PropertyNode.js';
|
|
4
|
-
import {
|
|
4
|
+
import { Fn, float } from '../../tsl/TSLBase.js';
|
|
5
5
|
|
|
6
6
|
// https://github.com/google/filament/blob/master/shaders/src/brdf.fs
|
|
7
|
-
const D_Charlie =
|
|
7
|
+
const D_Charlie = /*@__PURE__*/ Fn( ( { roughness, dotNH } ) => {
|
|
8
8
|
|
|
9
9
|
const alpha = roughness.pow2();
|
|
10
10
|
|
|
@@ -25,7 +25,7 @@ const D_Charlie = tslFn( ( { roughness, dotNH } ) => {
|
|
|
25
25
|
} );
|
|
26
26
|
|
|
27
27
|
// https://github.com/google/filament/blob/master/shaders/src/brdf.fs
|
|
28
|
-
const V_Neubelt =
|
|
28
|
+
const V_Neubelt = /*@__PURE__*/ Fn( ( { dotNV, dotNL } ) => {
|
|
29
29
|
|
|
30
30
|
// Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886"
|
|
31
31
|
return float( 1.0 ).div( float( 4.0 ).mul( dotNL.add( dotNV ).sub( dotNL.mul( dotNV ) ) ) );
|
|
@@ -39,7 +39,7 @@ const V_Neubelt = tslFn( ( { dotNV, dotNL } ) => {
|
|
|
39
39
|
]
|
|
40
40
|
} );
|
|
41
41
|
|
|
42
|
-
const BRDF_Sheen =
|
|
42
|
+
const BRDF_Sheen = /*@__PURE__*/ Fn( ( { lightDirection } ) => {
|
|
43
43
|
|
|
44
44
|
const halfDir = lightDirection.add( positionViewDirection ).normalize();
|
|
45
45
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fn, vec2, vec4 } from '../../tsl/TSLBase.js';
|
|
2
2
|
|
|
3
3
|
// Analytical approximation of the DFG LUT, one half of the
|
|
4
4
|
// split-sum approximation used in indirect specular lighting.
|
|
5
5
|
// via 'environmentBRDF' from "Physically Based Shading on Mobile"
|
|
6
6
|
// https://www.unrealengine.com/blog/physically-based-shading-on-mobile
|
|
7
|
-
const DFGApprox =
|
|
7
|
+
const DFGApprox = /*@__PURE__*/ Fn( ( { roughness, dotNV } ) => {
|
|
8
8
|
|
|
9
9
|
const c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
|
|
10
10
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fn } from '../../tsl/TSLBase.js';
|
|
2
2
|
|
|
3
3
|
// Microfacet Models for Refraction through Rough Surfaces - equation (33)
|
|
4
4
|
// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html
|
|
5
5
|
// alpha is "roughness squared" in Disney’s reparameterization
|
|
6
|
-
const D_GGX =
|
|
6
|
+
const D_GGX = /*@__PURE__*/ Fn( ( { alpha, dotNH } ) => {
|
|
7
7
|
|
|
8
8
|
const a2 = alpha.pow2();
|
|
9
9
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fn, float, vec3 } from '../../tsl/TSLBase.js';
|
|
2
2
|
|
|
3
|
-
const RECIPROCAL_PI = float( 1 / Math.PI );
|
|
3
|
+
const RECIPROCAL_PI = /*@__PURE__*/ float( 1 / Math.PI );
|
|
4
4
|
|
|
5
5
|
// https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf
|
|
6
6
|
|
|
7
|
-
const D_GGX_Anisotropic =
|
|
7
|
+
const D_GGX_Anisotropic = /*@__PURE__*/ Fn( ( { alphaT, alphaB, dotNH, dotTH, dotBH } ) => {
|
|
8
8
|
|
|
9
9
|
const a2 = alphaT.mul( alphaB );
|
|
10
10
|
const v = vec3( alphaB.mul( dotTH ), alphaT.mul( dotBH ), a2.mul( dotNH ) );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import DFGApprox from './DFGApprox.js';
|
|
2
|
-
import {
|
|
2
|
+
import { Fn } from '../../tsl/TSLBase.js';
|
|
3
3
|
|
|
4
|
-
const EnvironmentBRDF =
|
|
4
|
+
const EnvironmentBRDF = /*@__PURE__*/ Fn( ( inputs ) => {
|
|
5
5
|
|
|
6
6
|
const { dotNV, specularColor, specularF90, roughness } = inputs;
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fn } from '../../tsl/TSLBase.js';
|
|
2
2
|
|
|
3
|
-
const F_Schlick =
|
|
3
|
+
const F_Schlick = /*@__PURE__*/ Fn( ( { f0, f90, dotVH } ) => {
|
|
4
4
|
|
|
5
5
|
// Original approximation by Christophe Schlick '94
|
|
6
6
|
// float fresnel = pow( 1.0 - dotVH, 5.0 );
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fn, If, mat3, vec2, vec3 } from '../../tsl/TSLBase.js';
|
|
2
2
|
import { max } from '../../math/MathNode.js';
|
|
3
3
|
|
|
4
4
|
// Rect Area Light
|
|
@@ -7,7 +7,7 @@ import { max } from '../../math/MathNode.js';
|
|
|
7
7
|
// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt
|
|
8
8
|
// code: https://github.com/selfshadow/ltc_code/
|
|
9
9
|
|
|
10
|
-
const LTC_Uv =
|
|
10
|
+
const LTC_Uv = /*@__PURE__*/ Fn( ( { N, V, roughness } ) => {
|
|
11
11
|
|
|
12
12
|
const LUT_SIZE = 64.0;
|
|
13
13
|
const LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
|
|
@@ -32,7 +32,7 @@ const LTC_Uv = tslFn( ( { N, V, roughness } ) => {
|
|
|
32
32
|
]
|
|
33
33
|
} );
|
|
34
34
|
|
|
35
|
-
const LTC_ClippedSphereFormFactor =
|
|
35
|
+
const LTC_ClippedSphereFormFactor = /*@__PURE__*/ Fn( ( { f } ) => {
|
|
36
36
|
|
|
37
37
|
// Real-Time Area Lighting: a Journey from Research to Production (p.102)
|
|
38
38
|
// An approximation of the form factor of a horizon-clipped rectangle.
|
|
@@ -49,7 +49,7 @@ const LTC_ClippedSphereFormFactor = tslFn( ( { f } ) => {
|
|
|
49
49
|
]
|
|
50
50
|
} );
|
|
51
51
|
|
|
52
|
-
const LTC_EdgeVectorFormFactor =
|
|
52
|
+
const LTC_EdgeVectorFormFactor = /*@__PURE__*/ Fn( ( { v1, v2 } ) => {
|
|
53
53
|
|
|
54
54
|
const x = v1.dot( v2 );
|
|
55
55
|
const y = x.abs().toVar();
|
|
@@ -59,7 +59,7 @@ const LTC_EdgeVectorFormFactor = tslFn( ( { v1, v2 } ) => {
|
|
|
59
59
|
const b = y.add( 4.1616724 ).mul( y ).add( 3.4175940 ).toVar();
|
|
60
60
|
const v = a.div( b );
|
|
61
61
|
|
|
62
|
-
const theta_sintheta = x.greaterThan( 0.0 ).
|
|
62
|
+
const theta_sintheta = x.greaterThan( 0.0 ).select( v, max( x.mul( x ).oneMinus(), 1e-7 ).inverseSqrt().mul( 0.5 ).sub( v ) );
|
|
63
63
|
|
|
64
64
|
return v1.cross( v2 ).mul( theta_sintheta );
|
|
65
65
|
|
|
@@ -72,7 +72,7 @@ const LTC_EdgeVectorFormFactor = tslFn( ( { v1, v2 } ) => {
|
|
|
72
72
|
]
|
|
73
73
|
} );
|
|
74
74
|
|
|
75
|
-
const LTC_Evaluate =
|
|
75
|
+
const LTC_Evaluate = /*@__PURE__*/ Fn( ( { N, V, P, mInv, p0, p1, p2, p3 } ) => {
|
|
76
76
|
|
|
77
77
|
// bail if point is on back side of plane of light
|
|
78
78
|
// assumes ccw winding order of light vertices
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fn, vec3 } from '../../tsl/TSLBase.js';
|
|
2
2
|
|
|
3
|
-
const Schlick_to_F0 =
|
|
3
|
+
const Schlick_to_F0 = /*@__PURE__*/ Fn( ( { f, f90, dotVH } ) => {
|
|
4
4
|
|
|
5
5
|
const x = dotVH.oneMinus().saturate();
|
|
6
6
|
const x2 = x.mul( x );
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { div } from '../../math/OperatorNode.js';
|
|
2
2
|
import { EPSILON } from '../../math/MathNode.js';
|
|
3
|
-
import {
|
|
3
|
+
import { Fn } from '../../tsl/TSLBase.js';
|
|
4
4
|
|
|
5
5
|
// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2
|
|
6
6
|
// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
|
|
7
|
-
const V_GGX_SmithCorrelated =
|
|
7
|
+
const V_GGX_SmithCorrelated = /*@__PURE__*/ Fn( ( { alpha, dotNL, dotNV } ) => {
|
|
8
8
|
|
|
9
9
|
const a2 = alpha.pow2();
|
|
10
10
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { div } from '../../math/OperatorNode.js';
|
|
2
|
-
import {
|
|
2
|
+
import { Fn, vec3 } from '../../tsl/TSLBase.js';
|
|
3
3
|
|
|
4
4
|
// https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf
|
|
5
5
|
|
|
6
|
-
const V_GGX_SmithCorrelated_Anisotropic =
|
|
6
|
+
const V_GGX_SmithCorrelated_Anisotropic = /*@__PURE__*/ Fn( ( { alphaT, alphaB, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL } ) => {
|
|
7
7
|
|
|
8
8
|
const gv = dotNL.mul( vec3( alphaT.mul( dotTV ), alphaB.mul( dotBV ), dotNV ).length() );
|
|
9
9
|
const gl = dotNV.mul( vec3( alphaT.mul( dotTL ), alphaB.mul( dotBL ), dotNL ).length() );
|
|
@@ -3,7 +3,7 @@ import { diffuseColor } from '../core/PropertyNode.js';
|
|
|
3
3
|
import { MultiplyOperation, MixOperation, AddOperation } from '../../constants.js';
|
|
4
4
|
import { materialSpecularStrength, materialReflectivity } from '../accessors/MaterialNode.js';
|
|
5
5
|
import { mix } from '../math/MathNode.js';
|
|
6
|
-
import { vec4 } from '../
|
|
6
|
+
import { vec4 } from '../tsl/TSLBase.js';
|
|
7
7
|
|
|
8
8
|
class BasicLightingModel extends LightingModel {
|
|
9
9
|
|
|
@@ -2,21 +2,21 @@ import BasicLightingModel from './BasicLightingModel.js';
|
|
|
2
2
|
import F_Schlick from './BSDF/F_Schlick.js';
|
|
3
3
|
import BRDF_Lambert from './BSDF/BRDF_Lambert.js';
|
|
4
4
|
import { diffuseColor } from '../core/PropertyNode.js';
|
|
5
|
-
import { transformedNormalView } from '../accessors/
|
|
5
|
+
import { transformedNormalView } from '../accessors/Normal.js';
|
|
6
6
|
import { materialSpecularStrength } from '../accessors/MaterialNode.js';
|
|
7
7
|
import { shininess, specularColor } from '../core/PropertyNode.js';
|
|
8
|
-
import { positionViewDirection } from '../accessors/
|
|
9
|
-
import {
|
|
8
|
+
import { positionViewDirection } from '../accessors/Position.js';
|
|
9
|
+
import { Fn, float } from '../tsl/TSLBase.js';
|
|
10
10
|
|
|
11
11
|
const G_BlinnPhong_Implicit = () => float( 0.25 );
|
|
12
12
|
|
|
13
|
-
const D_BlinnPhong =
|
|
13
|
+
const D_BlinnPhong = /*@__PURE__*/ Fn( ( { dotNH } ) => {
|
|
14
14
|
|
|
15
15
|
return shininess.mul( float( 0.5 ) ).add( 1.0 ).mul( float( 1 / Math.PI ) ).mul( dotNH.pow( shininess ) );
|
|
16
16
|
|
|
17
17
|
} );
|
|
18
18
|
|
|
19
|
-
const BRDF_BlinnPhong =
|
|
19
|
+
const BRDF_BlinnPhong = /*@__PURE__*/ Fn( ( { lightDirection } ) => {
|
|
20
20
|
|
|
21
21
|
const halfDir = lightDirection.add( positionViewDirection ).normalize();
|
|
22
22
|
|
|
@@ -8,23 +8,24 @@ import BRDF_Sheen from './BSDF/BRDF_Sheen.js';
|
|
|
8
8
|
import { LTC_Evaluate, LTC_Uv } from './BSDF/LTC.js';
|
|
9
9
|
import LightingModel from '../core/LightingModel.js';
|
|
10
10
|
import { diffuseColor, specularColor, specularF90, roughness, clearcoat, clearcoatRoughness, sheen, sheenRoughness, iridescence, iridescenceIOR, iridescenceThickness, ior, thickness, transmission, attenuationDistance, attenuationColor, dispersion } from '../core/PropertyNode.js';
|
|
11
|
-
import { transformedNormalView, transformedClearcoatNormalView, transformedNormalWorld } from '../accessors/
|
|
12
|
-
import { positionViewDirection, positionView, positionWorld } from '../accessors/
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
11
|
+
import { transformedNormalView, transformedClearcoatNormalView, transformedNormalWorld } from '../accessors/Normal.js';
|
|
12
|
+
import { positionViewDirection, positionView, positionWorld } from '../accessors/Position.js';
|
|
13
|
+
import { Fn, float, vec2, vec3, vec4, mat3, If } from '../tsl/TSLBase.js';
|
|
14
|
+
import { select } from '../math/ConditionalNode.js';
|
|
15
15
|
import { mix, normalize, refract, length, clamp, log2, log, exp, smoothstep } from '../math/MathNode.js';
|
|
16
16
|
import { div } from '../math/OperatorNode.js';
|
|
17
|
-
import { cameraPosition, cameraProjectionMatrix, cameraViewMatrix } from '../accessors/
|
|
17
|
+
import { cameraPosition, cameraProjectionMatrix, cameraViewMatrix } from '../accessors/Camera.js';
|
|
18
18
|
import { modelWorldMatrix } from '../accessors/ModelNode.js';
|
|
19
19
|
import { viewportResolution } from '../display/ViewportNode.js';
|
|
20
20
|
import { viewportMipTexture } from '../display/ViewportTextureNode.js';
|
|
21
|
-
import {
|
|
21
|
+
import { textureBicubic } from '../accessors/TextureBicubic.js';
|
|
22
|
+
import { Loop } from '../utils/LoopNode.js';
|
|
22
23
|
|
|
23
24
|
//
|
|
24
25
|
// Transmission
|
|
25
26
|
//
|
|
26
27
|
|
|
27
|
-
const getVolumeTransmissionRay =
|
|
28
|
+
const getVolumeTransmissionRay = /*@__PURE__*/ Fn( ( [ n, v, thickness, ior, modelMatrix ] ) => {
|
|
28
29
|
|
|
29
30
|
// Direction of refracted light.
|
|
30
31
|
const refractionVector = vec3( refract( v.negate(), normalize( n ), div( 1.0, ior ) ) );
|
|
@@ -51,7 +52,7 @@ const getVolumeTransmissionRay = tslFn( ( [ n, v, thickness, ior, modelMatrix ]
|
|
|
51
52
|
]
|
|
52
53
|
} );
|
|
53
54
|
|
|
54
|
-
const applyIorToRoughness =
|
|
55
|
+
const applyIorToRoughness = /*@__PURE__*/ Fn( ( [ roughness, ior ] ) => {
|
|
55
56
|
|
|
56
57
|
// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and
|
|
57
58
|
// an IOR of 1.5 results in the default amount of microfacet refraction.
|
|
@@ -66,20 +67,20 @@ const applyIorToRoughness = tslFn( ( [ roughness, ior ] ) => {
|
|
|
66
67
|
]
|
|
67
68
|
} );
|
|
68
69
|
|
|
69
|
-
const singleViewportMipTexture = viewportMipTexture();
|
|
70
|
+
const singleViewportMipTexture = /*@__PURE__*/ viewportMipTexture();
|
|
70
71
|
|
|
71
|
-
const getTransmissionSample =
|
|
72
|
+
const getTransmissionSample = /*@__PURE__*/ Fn( ( [ fragCoord, roughness, ior ] ) => {
|
|
72
73
|
|
|
73
74
|
const transmissionSample = singleViewportMipTexture.uv( fragCoord );
|
|
74
75
|
//const transmissionSample = viewportMipTexture( fragCoord );
|
|
75
76
|
|
|
76
77
|
const lod = log2( float( viewportResolution.x ) ).mul( applyIorToRoughness( roughness, ior ) );
|
|
77
78
|
|
|
78
|
-
return
|
|
79
|
+
return textureBicubic( transmissionSample, lod );
|
|
79
80
|
|
|
80
81
|
} );
|
|
81
82
|
|
|
82
|
-
const volumeAttenuation =
|
|
83
|
+
const volumeAttenuation = /*@__PURE__*/ Fn( ( [ transmissionDistance, attenuationColor, attenuationDistance ] ) => {
|
|
83
84
|
|
|
84
85
|
If( attenuationDistance.notEqual( 0 ), () => {
|
|
85
86
|
|
|
@@ -104,7 +105,7 @@ const volumeAttenuation = tslFn( ( [ transmissionDistance, attenuationColor, att
|
|
|
104
105
|
]
|
|
105
106
|
} );
|
|
106
107
|
|
|
107
|
-
const getIBLVolumeRefraction =
|
|
108
|
+
const getIBLVolumeRefraction = /*@__PURE__*/ Fn( ( [ n, v, roughness, diffuseColor, specularColor, specularF90, position, modelMatrix, viewMatrix, projMatrix, ior, thickness, attenuationColor, attenuationDistance, dispersion ] ) => {
|
|
108
109
|
|
|
109
110
|
let transmittedLight, transmittance;
|
|
110
111
|
|
|
@@ -116,7 +117,7 @@ const getIBLVolumeRefraction = tslFn( ( [ n, v, roughness, diffuseColor, specula
|
|
|
116
117
|
const halfSpread = ior.sub( 1.0 ).mul( dispersion.mul( 0.025 ) );
|
|
117
118
|
const iors = vec3( ior.sub( halfSpread ), ior, ior.add( halfSpread ) );
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
Loop( { start: 0, end: 3 }, ( { i } ) => {
|
|
120
121
|
|
|
121
122
|
const ior = iors.element( i );
|
|
122
123
|
|
|
@@ -184,7 +185,7 @@ const getIBLVolumeRefraction = tslFn( ( [ n, v, roughness, diffuseColor, specula
|
|
|
184
185
|
//
|
|
185
186
|
|
|
186
187
|
// XYZ to linear-sRGB color space
|
|
187
|
-
const XYZ_TO_REC709 = mat3(
|
|
188
|
+
const XYZ_TO_REC709 = /*@__PURE__*/ mat3(
|
|
188
189
|
3.2404542, - 0.9692660, 0.0556434,
|
|
189
190
|
- 1.5371385, 1.8760108, - 0.2040259,
|
|
190
191
|
- 0.4985314, 0.0415560, 1.0572252
|
|
@@ -227,7 +228,7 @@ const evalSensitivity = ( OPD, shift ) => {
|
|
|
227
228
|
|
|
228
229
|
};
|
|
229
230
|
|
|
230
|
-
const evalIridescence =
|
|
231
|
+
const evalIridescence = /*@__PURE__*/ Fn( ( { outsideIOR, eta2, cosTheta1, thinFilmThickness, baseF0 } ) => {
|
|
231
232
|
|
|
232
233
|
// Force iridescenceIOR -> outsideIOR when thinFilmThickness -> 0.0
|
|
233
234
|
const iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
|
|
@@ -249,7 +250,7 @@ const evalIridescence = tslFn( ( { outsideIOR, eta2, cosTheta1, thinFilmThicknes
|
|
|
249
250
|
const R12 = F_Schlick( { f0: R0, f90: 1.0, dotVH: cosTheta1 } );
|
|
250
251
|
//const R21 = R12;
|
|
251
252
|
const T121 = R12.oneMinus();
|
|
252
|
-
const phi12 = iridescenceIOR.lessThan( outsideIOR ).
|
|
253
|
+
const phi12 = iridescenceIOR.lessThan( outsideIOR ).select( Math.PI, 0.0 );
|
|
253
254
|
const phi21 = float( Math.PI ).sub( phi12 );
|
|
254
255
|
|
|
255
256
|
// Second interface
|
|
@@ -257,9 +258,9 @@ const evalIridescence = tslFn( ( { outsideIOR, eta2, cosTheta1, thinFilmThicknes
|
|
|
257
258
|
const R1 = IorToFresnel0( baseIOR, iridescenceIOR.toVec3() );
|
|
258
259
|
const R23 = F_Schlick( { f0: R1, f90: 1.0, dotVH: cosTheta2 } );
|
|
259
260
|
const phi23 = vec3(
|
|
260
|
-
baseIOR.x.lessThan( iridescenceIOR ).
|
|
261
|
-
baseIOR.y.lessThan( iridescenceIOR ).
|
|
262
|
-
baseIOR.z.lessThan( iridescenceIOR ).
|
|
261
|
+
baseIOR.x.lessThan( iridescenceIOR ).select( Math.PI, 0.0 ),
|
|
262
|
+
baseIOR.y.lessThan( iridescenceIOR ).select( Math.PI, 0.0 ),
|
|
263
|
+
baseIOR.z.lessThan( iridescenceIOR ).select( Math.PI, 0.0 )
|
|
263
264
|
);
|
|
264
265
|
|
|
265
266
|
// Phase shift
|
|
@@ -307,25 +308,25 @@ const evalIridescence = tslFn( ( { outsideIOR, eta2, cosTheta1, thinFilmThicknes
|
|
|
307
308
|
// This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from
|
|
308
309
|
// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found
|
|
309
310
|
// in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing
|
|
310
|
-
const IBLSheenBRDF =
|
|
311
|
+
const IBLSheenBRDF = /*@__PURE__*/ Fn( ( { normal, viewDir, roughness } ) => {
|
|
311
312
|
|
|
312
313
|
const dotNV = normal.dot( viewDir ).saturate();
|
|
313
314
|
|
|
314
315
|
const r2 = roughness.pow2();
|
|
315
316
|
|
|
316
|
-
const a =
|
|
317
|
+
const a = select(
|
|
317
318
|
roughness.lessThan( 0.25 ),
|
|
318
319
|
float( - 339.2 ).mul( r2 ).add( float( 161.4 ).mul( roughness ) ).sub( 25.9 ),
|
|
319
320
|
float( - 8.48 ).mul( r2 ).add( float( 14.3 ).mul( roughness ) ).sub( 9.95 )
|
|
320
321
|
);
|
|
321
322
|
|
|
322
|
-
const b =
|
|
323
|
+
const b = select(
|
|
323
324
|
roughness.lessThan( 0.25 ),
|
|
324
325
|
float( 44.0 ).mul( r2 ).sub( float( 23.7 ).mul( roughness ) ).add( 3.26 ),
|
|
325
326
|
float( 1.97 ).mul( r2 ).sub( float( 3.27 ).mul( roughness ) ).add( 0.72 )
|
|
326
327
|
);
|
|
327
328
|
|
|
328
|
-
const DG =
|
|
329
|
+
const DG = select( roughness.lessThan( 0.25 ), 0.0, float( 0.1 ).mul( roughness ).sub( 0.025 ) ).add( a.mul( dotNV ).add( b ).exp() );
|
|
329
330
|
|
|
330
331
|
return DG.mul( 1.0 / Math.PI ).saturate();
|
|
331
332
|
|
|
@@ -363,16 +364,16 @@ class PhysicalLightingModel extends LightingModel {
|
|
|
363
364
|
|
|
364
365
|
if ( this.clearcoat === true ) {
|
|
365
366
|
|
|
366
|
-
this.clearcoatRadiance = vec3().
|
|
367
|
-
this.clearcoatSpecularDirect = vec3().
|
|
368
|
-
this.clearcoatSpecularIndirect = vec3().
|
|
367
|
+
this.clearcoatRadiance = vec3().toVar( 'clearcoatRadiance' );
|
|
368
|
+
this.clearcoatSpecularDirect = vec3().toVar( 'clearcoatSpecularDirect' );
|
|
369
|
+
this.clearcoatSpecularIndirect = vec3().toVar( 'clearcoatSpecularIndirect' );
|
|
369
370
|
|
|
370
371
|
}
|
|
371
372
|
|
|
372
373
|
if ( this.sheen === true ) {
|
|
373
374
|
|
|
374
|
-
this.sheenSpecularDirect = vec3().
|
|
375
|
-
this.sheenSpecularIndirect = vec3().
|
|
375
|
+
this.sheenSpecularDirect = vec3().toVar( 'sheenSpecularDirect' );
|
|
376
|
+
this.sheenSpecularIndirect = vec3().toVar( 'sheenSpecularIndirect' );
|
|
376
377
|
|
|
377
378
|
}
|
|
378
379
|
|
|
@@ -553,8 +554,8 @@ class PhysicalLightingModel extends LightingModel {
|
|
|
553
554
|
|
|
554
555
|
// Both indirect specular and indirect diffuse light accumulate here
|
|
555
556
|
|
|
556
|
-
const singleScattering = vec3().
|
|
557
|
-
const multiScattering = vec3().
|
|
557
|
+
const singleScattering = vec3().toVar( 'singleScattering' );
|
|
558
|
+
const multiScattering = vec3().toVar( 'multiScattering' );
|
|
558
559
|
const cosineWeightedIrradiance = iblIrradiance.mul( 1 / Math.PI );
|
|
559
560
|
|
|
560
561
|
this.computeMultiscattering( singleScattering, multiScattering, specularF90 );
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import LightingModel from '../core/LightingModel.js';
|
|
2
2
|
import BRDF_Lambert from './BSDF/BRDF_Lambert.js';
|
|
3
3
|
import { diffuseColor } from '../core/PropertyNode.js';
|
|
4
|
-
import { normalGeometry } from '../accessors/
|
|
5
|
-
import {
|
|
4
|
+
import { normalGeometry } from '../accessors/Normal.js';
|
|
5
|
+
import { Fn, float, vec2, vec3 } from '../tsl/TSLBase.js';
|
|
6
6
|
import { mix, smoothstep } from '../math/MathNode.js';
|
|
7
7
|
import { materialReference } from '../accessors/MaterialReferenceNode.js';
|
|
8
8
|
|
|
9
|
-
const getGradientIrradiance =
|
|
9
|
+
const getGradientIrradiance = /*@__PURE__*/ Fn( ( { normal, lightDirection, builder } ) => {
|
|
10
10
|
|
|
11
11
|
// dotNL will be from -1.0 to 1.0
|
|
12
12
|
const dotNL = normal.dot( lightDirection );
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { normalView } from '../../accessors/Normal.js';
|
|
2
|
+
import { Fn } from '../../tsl/TSLBase.js';
|
|
3
3
|
|
|
4
|
-
const getGeometryRoughness =
|
|
4
|
+
const getGeometryRoughness = /*@__PURE__*/ Fn( () => {
|
|
5
5
|
|
|
6
|
-
const dxy =
|
|
6
|
+
const dxy = normalView.dFdx().abs().max( normalView.dFdy().abs() );
|
|
7
7
|
const geometryRoughness = dxy.x.max( dxy.y ).max( dxy.z );
|
|
8
8
|
|
|
9
9
|
return geometryRoughness;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import getGeometryRoughness from './getGeometryRoughness.js';
|
|
2
|
-
import {
|
|
2
|
+
import { Fn } from '../../tsl/TSLBase.js';
|
|
3
3
|
|
|
4
|
-
const getRoughness =
|
|
4
|
+
const getRoughness = /*@__PURE__*/ Fn( ( inputs ) => {
|
|
5
5
|
|
|
6
6
|
const { roughness } = inputs;
|
|
7
7
|
|