super-three 0.163.0 → 0.165.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/README.md +3 -3
- package/build/three.cjs +1127 -452
- package/build/three.module.js +1127 -452
- package/build/three.module.min.js +2 -2
- package/examples/jsm/animation/CCDIKSolver.js +4 -2
- package/examples/jsm/controls/TransformControls.js +1 -1
- package/examples/jsm/environments/RoomEnvironment.js +1 -5
- package/examples/jsm/exporters/GLTFExporter.js +45 -1
- package/examples/jsm/exporters/USDZExporter.js +13 -5
- package/examples/jsm/helpers/ViewHelper.js +32 -67
- package/examples/jsm/libs/draco/README.md +2 -2
- package/examples/jsm/libs/tween.module.js +75 -64
- package/examples/jsm/lines/LineMaterial.js +1 -15
- package/examples/jsm/lines/LineSegments2.js +15 -0
- package/examples/jsm/lines/Wireframe.js +16 -1
- package/examples/jsm/loaders/DRACOLoader.js +1 -1
- package/examples/jsm/loaders/EXRLoader.js +283 -99
- package/examples/jsm/loaders/FBXLoader.js +24 -13
- package/examples/jsm/loaders/GLTFLoader.js +55 -0
- package/examples/jsm/loaders/KTX2Loader.js +3 -6
- package/examples/jsm/loaders/LDrawLoader.js +3 -2
- package/examples/jsm/loaders/MMDLoader.js +31 -12
- package/examples/jsm/loaders/VRMLLoader.js +1 -1
- package/examples/jsm/loaders/lwo/IFFParser.js +8 -5
- package/examples/jsm/materials/MeshGouraudMaterial.js +7 -1
- package/examples/jsm/math/Octree.js +26 -20
- package/examples/jsm/modifiers/CurveModifier.js +11 -9
- package/examples/jsm/nodes/Nodes.js +15 -13
- package/examples/jsm/nodes/accessors/AccessorsUtils.js +16 -1
- package/examples/jsm/nodes/accessors/BitangentNode.js +7 -83
- package/examples/jsm/nodes/accessors/BufferNode.js +6 -0
- package/examples/jsm/nodes/accessors/CameraNode.js +12 -119
- package/examples/jsm/nodes/accessors/ClippingNode.js +3 -2
- package/examples/jsm/nodes/accessors/MaterialNode.js +109 -3
- package/examples/jsm/nodes/accessors/ModelNode.js +3 -0
- package/examples/jsm/nodes/accessors/NormalNode.js +9 -101
- package/examples/jsm/nodes/accessors/PositionNode.js +6 -100
- package/examples/jsm/nodes/accessors/ReferenceNode.js +6 -0
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +2 -31
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +9 -0
- package/examples/jsm/nodes/accessors/{TextureStoreNode.js → StorageTextureNode.js} +19 -6
- package/examples/jsm/nodes/accessors/TangentNode.js +11 -97
- package/examples/jsm/nodes/accessors/Texture3DNode.js +100 -0
- package/examples/jsm/nodes/accessors/TextureNode.js +21 -3
- package/examples/jsm/nodes/accessors/TextureSizeNode.js +1 -1
- package/examples/jsm/nodes/accessors/UVNode.js +2 -46
- package/examples/jsm/nodes/code/FunctionNode.js +0 -8
- package/examples/jsm/nodes/core/AttributeNode.js +15 -3
- package/examples/jsm/nodes/core/ContextNode.js +6 -0
- package/examples/jsm/nodes/core/Node.js +23 -2
- package/examples/jsm/nodes/core/NodeBuilder.js +25 -18
- package/examples/jsm/nodes/core/NodeKeywords.js +1 -1
- package/examples/jsm/nodes/core/OutputStructNode.js +3 -6
- package/examples/jsm/nodes/core/PropertyNode.js +11 -0
- package/examples/jsm/nodes/core/VaryingNode.js +40 -9
- package/examples/jsm/nodes/display/AfterImageNode.js +14 -2
- package/examples/jsm/nodes/display/BumpMapNode.js +7 -26
- package/examples/jsm/nodes/display/FrontFacingNode.js +13 -0
- package/examples/jsm/nodes/display/PassNode.js +3 -1
- package/examples/jsm/nodes/display/ViewportDepthNode.js +1 -1
- package/examples/jsm/nodes/display/ViewportNode.js +5 -3
- package/examples/jsm/nodes/display/ViewportTextureNode.js +4 -1
- package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +26 -7
- package/examples/jsm/nodes/functions/BSDF/D_GGX_Anisotropic.js +28 -0
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +1 -3
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +29 -0
- package/examples/jsm/nodes/functions/PhongLightingModel.js +1 -1
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +210 -12
- package/examples/jsm/nodes/functions/ShadowMaskModel.js +31 -0
- package/examples/jsm/nodes/functions/ToonLightingModel.js +49 -0
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +20 -5
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +2 -1
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +11 -2
- package/examples/jsm/nodes/lighting/IrradianceNode.js +24 -0
- package/examples/jsm/nodes/lighting/LightsNode.js +28 -1
- package/examples/jsm/nodes/lighting/PointLightNode.js +2 -1
- package/examples/jsm/nodes/lighting/SpotLightNode.js +2 -1
- package/examples/jsm/nodes/materials/Line2NodeMaterial.js +11 -7
- package/examples/jsm/nodes/materials/Materials.js +4 -0
- package/examples/jsm/nodes/materials/MeshMatcapNodeMaterial.js +52 -0
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +0 -2
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +94 -6
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +11 -4
- package/examples/jsm/nodes/materials/MeshToonNodeMaterial.js +34 -0
- package/examples/jsm/nodes/materials/NodeMaterial.js +43 -45
- package/examples/jsm/nodes/materials/ShadowNodeMaterial.js +34 -0
- package/examples/jsm/nodes/materials/VolumeNodeMaterial.js +106 -0
- package/examples/jsm/nodes/math/HashNode.js +2 -2
- package/examples/jsm/nodes/pmrem/PMREMUtils.js +1 -1
- package/examples/jsm/nodes/shadernode/ShaderNode.js +57 -41
- package/examples/jsm/nodes/utils/ArrayElementNode.js +1 -1
- package/examples/jsm/nodes/utils/MatcapUVNode.js +1 -1
- package/examples/jsm/nodes/utils/TimerNode.js +1 -1
- package/examples/jsm/objects/Lensflare.js +2 -2
- package/examples/jsm/physics/JoltPhysics.js +281 -0
- package/examples/jsm/postprocessing/RenderPass.js +1 -1
- package/examples/jsm/postprocessing/RenderTransitionPass.js +193 -0
- package/examples/jsm/renderers/CSS2DRenderer.js +25 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +24 -3
- package/examples/jsm/renderers/common/Attributes.js +2 -0
- package/examples/jsm/renderers/common/Background.js +3 -3
- package/examples/jsm/renderers/common/Bindings.js +17 -0
- package/examples/jsm/renderers/common/ChainMap.js +18 -48
- package/examples/jsm/renderers/common/ClippingContext.js +5 -5
- package/examples/jsm/renderers/common/Pipelines.js +2 -2
- package/examples/jsm/renderers/common/RenderBundle.js +18 -0
- package/examples/jsm/renderers/common/RenderBundles.js +38 -0
- package/examples/jsm/renderers/common/RenderList.js +10 -1
- package/examples/jsm/renderers/common/RenderObject.js +49 -1
- package/examples/jsm/renderers/common/Renderer.js +268 -25
- package/examples/jsm/renderers/common/Textures.js +1 -1
- package/examples/jsm/renderers/common/Uniform.js +1 -1
- package/examples/jsm/renderers/common/extras/PMREMGenerator.js +13 -17
- package/examples/jsm/renderers/common/nodes/NodeSampledTexture.js +18 -4
- package/examples/jsm/renderers/common/nodes/NodeSampler.js +6 -0
- package/examples/jsm/renderers/common/nodes/Nodes.js +31 -47
- package/examples/jsm/renderers/webgl/WebGLBackend.js +7 -21
- package/examples/jsm/renderers/webgl/WebGLBufferRenderer.js +5 -1
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +23 -5
- package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +114 -13
- package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +3 -21
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +80 -46
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +85 -12
- package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +4 -1
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +10 -1
- package/examples/jsm/renderers/webgpu/utils/WebGPUConstants.js +6 -0
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +62 -19
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +62 -3
- package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
- package/examples/jsm/transpiler/ShaderToyDecoder.js +1 -1
- package/examples/jsm/utils/BufferGeometryUtils.js +18 -16
- package/examples/jsm/utils/GPUStatsPanel.js +2 -0
- package/examples/jsm/utils/SceneUtils.js +60 -1
- package/examples/jsm/utils/SortUtils.js +8 -5
- package/examples/jsm/webxr/OculusHandModel.js +3 -2
- package/examples/jsm/webxr/XRHandModelFactory.js +4 -2
- package/package.json +3 -2
- package/src/animation/tracks/BooleanKeyframeTrack.js +10 -1
- package/src/animation/tracks/QuaternionKeyframeTrack.js +1 -2
- package/src/animation/tracks/StringKeyframeTrack.js +10 -1
- package/src/constants.js +1 -1
- package/src/core/Object3D.js +2 -0
- package/src/core/Raycaster.js +6 -2
- package/src/core/RenderTarget.js +8 -0
- package/src/extras/PMREMGenerator.js +12 -11
- package/src/loaders/FileLoader.js +5 -1
- package/src/loaders/LoaderUtils.js +3 -1
- package/src/loaders/MaterialLoader.js +1 -0
- package/src/loaders/ObjectLoader.js +1 -0
- package/src/materials/Material.js +2 -0
- package/src/materials/MeshPhysicalMaterial.js +20 -0
- package/src/objects/BatchedMesh.js +114 -1
- package/src/objects/Line.js +66 -43
- package/src/renderers/WebGLRenderer.js +371 -109
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +15 -0
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +9 -1
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +8 -22
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +1 -0
- package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +3 -14
- package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +10 -31
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +3 -23
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +17 -9
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +47 -13
- package/src/renderers/shaders/ShaderChunk.js +0 -2
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -0
- package/src/renderers/shaders/ShaderLib.js +1 -0
- package/src/renderers/webgl/WebGLBackground.js +24 -3
- package/src/renderers/webgl/WebGLBufferRenderer.js +36 -0
- package/src/renderers/webgl/WebGLCapabilities.js +33 -1
- package/src/renderers/webgl/WebGLExtensions.js +3 -1
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +36 -0
- package/src/renderers/webgl/WebGLLights.js +9 -12
- package/src/renderers/webgl/WebGLMaterials.js +7 -5
- package/src/renderers/webgl/WebGLMorphtargets.js +1 -2
- package/src/renderers/webgl/WebGLProgram.js +5 -36
- package/src/renderers/webgl/WebGLPrograms.js +19 -14
- package/src/renderers/webgl/WebGLRenderStates.js +8 -4
- package/src/renderers/webgl/WebGLShadowMap.js +25 -25
- package/src/renderers/webgl/WebGLTextures.js +206 -129
- package/src/renderers/webgl/WebGLUtils.js +3 -21
- package/src/renderers/webxr/WebXRDepthSensing.js +3 -3
- package/src/renderers/webxr/WebXRManager.js +8 -6
- package/src/textures/CompressedArrayTexture.js +14 -0
- package/src/textures/DataArrayTexture.js +14 -0
- package/src/textures/DepthTexture.js +1 -3
- package/src/utils.js +30 -1
- package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +0 -318
- package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +0 -26
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +0 -792
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +0 -51
- package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +0 -10
|
@@ -25,6 +25,8 @@ class Node extends EventDispatcher {
|
|
|
25
25
|
this._cacheKey = null;
|
|
26
26
|
this._cacheKeyVersion = 0;
|
|
27
27
|
|
|
28
|
+
this.global = false;
|
|
29
|
+
|
|
28
30
|
this.isNode = true;
|
|
29
31
|
|
|
30
32
|
Object.defineProperty( this, 'id', { value: _nodeId ++ } );
|
|
@@ -74,6 +76,14 @@ class Node extends EventDispatcher {
|
|
|
74
76
|
|
|
75
77
|
}
|
|
76
78
|
|
|
79
|
+
onReference( callback ) {
|
|
80
|
+
|
|
81
|
+
this.updateReference = callback.bind( this.getSelf() );
|
|
82
|
+
|
|
83
|
+
return this;
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
77
87
|
getSelf() {
|
|
78
88
|
|
|
79
89
|
// Returns non-node object.
|
|
@@ -90,7 +100,7 @@ class Node extends EventDispatcher {
|
|
|
90
100
|
|
|
91
101
|
isGlobal( /*builder*/ ) {
|
|
92
102
|
|
|
93
|
-
return
|
|
103
|
+
return this.global;
|
|
94
104
|
|
|
95
105
|
}
|
|
96
106
|
|
|
@@ -155,6 +165,15 @@ class Node extends EventDispatcher {
|
|
|
155
165
|
|
|
156
166
|
}
|
|
157
167
|
|
|
168
|
+
getElementType( builder ) {
|
|
169
|
+
|
|
170
|
+
const type = this.getNodeType( builder );
|
|
171
|
+
const elementType = builder.getElementType( type );
|
|
172
|
+
|
|
173
|
+
return elementType;
|
|
174
|
+
|
|
175
|
+
}
|
|
176
|
+
|
|
158
177
|
getNodeType( builder ) {
|
|
159
178
|
|
|
160
179
|
const nodeProperties = builder.getNodeProperties( this );
|
|
@@ -182,9 +201,11 @@ class Node extends EventDispatcher {
|
|
|
182
201
|
|
|
183
202
|
const nodeProperties = builder.getNodeProperties( this );
|
|
184
203
|
|
|
204
|
+
let index = 0;
|
|
205
|
+
|
|
185
206
|
for ( const childNode of this.getChildren() ) {
|
|
186
207
|
|
|
187
|
-
nodeProperties[ '
|
|
208
|
+
nodeProperties[ 'node' + index ++ ] = childNode;
|
|
188
209
|
|
|
189
210
|
}
|
|
190
211
|
|
|
@@ -72,7 +72,6 @@ class NodeBuilder {
|
|
|
72
72
|
this.lightsNode = null;
|
|
73
73
|
this.environmentNode = null;
|
|
74
74
|
this.fogNode = null;
|
|
75
|
-
this.toneMappingNode = null;
|
|
76
75
|
|
|
77
76
|
this.clippingContext = null;
|
|
78
77
|
|
|
@@ -81,7 +80,7 @@ class NodeBuilder {
|
|
|
81
80
|
this.computeShader = null;
|
|
82
81
|
|
|
83
82
|
this.flowNodes = { vertex: [], fragment: [], compute: [] };
|
|
84
|
-
this.flowCode = { vertex: '', fragment: '', compute:
|
|
83
|
+
this.flowCode = { vertex: '', fragment: '', compute: '' };
|
|
85
84
|
this.uniforms = { vertex: [], fragment: [], compute: [], index: 0 };
|
|
86
85
|
this.structs = { vertex: [], fragment: [], compute: [], index: 0 };
|
|
87
86
|
this.bindings = { vertex: [], fragment: [], compute: [] };
|
|
@@ -416,12 +415,6 @@ class NodeBuilder {
|
|
|
416
415
|
|
|
417
416
|
}
|
|
418
417
|
|
|
419
|
-
generateMethod( method ) {
|
|
420
|
-
|
|
421
|
-
return method;
|
|
422
|
-
|
|
423
|
-
}
|
|
424
|
-
|
|
425
418
|
hasGeometryAttribute( name ) {
|
|
426
419
|
|
|
427
420
|
return this.geometry && this.geometry.getAttribute( name ) !== undefined;
|
|
@@ -474,7 +467,7 @@ class NodeBuilder {
|
|
|
474
467
|
|
|
475
468
|
isReference( type ) {
|
|
476
469
|
|
|
477
|
-
return type === 'void' || type === 'property' || type === 'sampler' || type === 'texture' || type === 'cubeTexture' || type === 'storageTexture';
|
|
470
|
+
return type === 'void' || type === 'property' || type === 'sampler' || type === 'texture' || type === 'cubeTexture' || type === 'storageTexture' || type === 'texture3D';
|
|
478
471
|
|
|
479
472
|
}
|
|
480
473
|
|
|
@@ -499,6 +492,16 @@ class NodeBuilder {
|
|
|
499
492
|
|
|
500
493
|
}
|
|
501
494
|
|
|
495
|
+
getElementType( type ) {
|
|
496
|
+
|
|
497
|
+
if ( type === 'mat2' ) return 'vec2';
|
|
498
|
+
if ( type === 'mat3' ) return 'vec3';
|
|
499
|
+
if ( type === 'mat4' ) return 'vec4';
|
|
500
|
+
|
|
501
|
+
return this.getComponentType( type );
|
|
502
|
+
|
|
503
|
+
}
|
|
504
|
+
|
|
502
505
|
getComponentType( type ) {
|
|
503
506
|
|
|
504
507
|
type = this.getVectorType( type );
|
|
@@ -520,7 +523,7 @@ class NodeBuilder {
|
|
|
520
523
|
getVectorType( type ) {
|
|
521
524
|
|
|
522
525
|
if ( type === 'color' ) return 'vec3';
|
|
523
|
-
if ( type === 'texture' || type === 'cubeTexture' || type === 'storageTexture' ) return 'vec4';
|
|
526
|
+
if ( type === 'texture' || type === 'cubeTexture' || type === 'storageTexture' || type === 'texture3D' ) return 'vec4';
|
|
524
527
|
|
|
525
528
|
return type;
|
|
526
529
|
|
|
@@ -908,7 +911,9 @@ class NodeBuilder {
|
|
|
908
911
|
|
|
909
912
|
const previousFlow = this.flow;
|
|
910
913
|
const previousVars = this.vars;
|
|
914
|
+
const previousCache = this.cache;
|
|
911
915
|
const previousBuildStage = this.buildStage;
|
|
916
|
+
const previousStack = this.stack;
|
|
912
917
|
|
|
913
918
|
const flow = {
|
|
914
919
|
code: ''
|
|
@@ -916,6 +921,8 @@ class NodeBuilder {
|
|
|
916
921
|
|
|
917
922
|
this.flow = flow;
|
|
918
923
|
this.vars = {};
|
|
924
|
+
this.cache = new NodeCache();
|
|
925
|
+
this.stack = stack();
|
|
919
926
|
|
|
920
927
|
for ( const buildStage of defaultBuildStages ) {
|
|
921
928
|
|
|
@@ -929,6 +936,9 @@ class NodeBuilder {
|
|
|
929
936
|
|
|
930
937
|
this.flow = previousFlow;
|
|
931
938
|
this.vars = previousVars;
|
|
939
|
+
this.cache = previousCache;
|
|
940
|
+
this.stack = previousStack;
|
|
941
|
+
|
|
932
942
|
this.setBuildStage( previousBuildStage );
|
|
933
943
|
|
|
934
944
|
return flow;
|
|
@@ -1087,21 +1097,18 @@ class NodeBuilder {
|
|
|
1087
1097
|
|
|
1088
1098
|
}
|
|
1089
1099
|
|
|
1090
|
-
build(
|
|
1100
|
+
build() {
|
|
1091
1101
|
|
|
1092
1102
|
const { object, material } = this;
|
|
1093
1103
|
|
|
1094
|
-
if ( convertMaterial ) {
|
|
1095
1104
|
|
|
1096
|
-
|
|
1105
|
+
if ( material !== null ) {
|
|
1097
1106
|
|
|
1098
|
-
|
|
1107
|
+
NodeMaterial.fromMaterial( material ).build( this );
|
|
1099
1108
|
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
this.addFlow( 'compute', object );
|
|
1109
|
+
} else {
|
|
1103
1110
|
|
|
1104
|
-
|
|
1111
|
+
this.addFlow( 'compute', object );
|
|
1105
1112
|
|
|
1106
1113
|
}
|
|
1107
1114
|
|
|
@@ -8,9 +8,10 @@ class OutputStructNode extends Node {
|
|
|
8
8
|
|
|
9
9
|
super();
|
|
10
10
|
|
|
11
|
-
this.isOutputStructNode = true;
|
|
12
11
|
this.members = members;
|
|
13
12
|
|
|
13
|
+
this.isOutputStructNode = true;
|
|
14
|
+
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
setup( builder ) {
|
|
@@ -32,11 +33,7 @@ class OutputStructNode extends Node {
|
|
|
32
33
|
|
|
33
34
|
generate( builder, output ) {
|
|
34
35
|
|
|
35
|
-
const
|
|
36
|
-
nodeVar.isOutputStructVar = true;
|
|
37
|
-
|
|
38
|
-
const propertyName = builder.getPropertyName( nodeVar );
|
|
39
|
-
|
|
36
|
+
const propertyName = builder.getOutputStructName();
|
|
40
37
|
const members = this.members;
|
|
41
38
|
|
|
42
39
|
const structPrefix = propertyName !== '' ? propertyName + '.' : '';
|
|
@@ -62,11 +62,22 @@ export const sheenRoughness = nodeImmutable( PropertyNode, 'float', 'SheenRoughn
|
|
|
62
62
|
export const iridescence = nodeImmutable( PropertyNode, 'float', 'Iridescence' );
|
|
63
63
|
export const iridescenceIOR = nodeImmutable( PropertyNode, 'float', 'IridescenceIOR' );
|
|
64
64
|
export const iridescenceThickness = nodeImmutable( PropertyNode, 'float', 'IridescenceThickness' );
|
|
65
|
+
export const alphaT = nodeImmutable( PropertyNode, 'float', 'AlphaT' );
|
|
66
|
+
export const anisotropy = nodeImmutable( PropertyNode, 'float', 'Anisotropy' );
|
|
67
|
+
export const anisotropyT = nodeImmutable( PropertyNode, 'vec3', 'AnisotropyT' );
|
|
68
|
+
export const anisotropyB = nodeImmutable( PropertyNode, 'vec3', 'AnisotropyB' );
|
|
65
69
|
export const specularColor = nodeImmutable( PropertyNode, 'color', 'SpecularColor' );
|
|
70
|
+
export const specularF90 = nodeImmutable( PropertyNode, 'float', 'SpecularF90' );
|
|
66
71
|
export const shininess = nodeImmutable( PropertyNode, 'float', 'Shininess' );
|
|
67
72
|
export const output = nodeImmutable( PropertyNode, 'vec4', 'Output' );
|
|
68
73
|
export const dashSize = nodeImmutable( PropertyNode, 'float', 'dashSize' );
|
|
69
74
|
export const gapSize = nodeImmutable( PropertyNode, 'float', 'gapSize' );
|
|
70
75
|
export const pointWidth = nodeImmutable( PropertyNode, 'float', 'pointWidth' );
|
|
76
|
+
export const ior = nodeImmutable( PropertyNode, 'float', 'IOR' );
|
|
77
|
+
export const transmission = nodeImmutable( PropertyNode, 'float', 'Transmission' );
|
|
78
|
+
export const thickness = nodeImmutable( PropertyNode, 'float', 'Thickness' );
|
|
79
|
+
export const attenuationDistance = nodeImmutable( PropertyNode, 'float', 'AttenuationDistance' );
|
|
80
|
+
export const attenuationColor = nodeImmutable( PropertyNode, 'color', 'AttenuationColor' );
|
|
81
|
+
export const dispersion = nodeImmutable( PropertyNode, 'float', 'Dispersion' );
|
|
71
82
|
|
|
72
83
|
addNodeClass( 'PropertyNode', PropertyNode );
|
|
@@ -35,22 +35,53 @@ class VaryingNode extends Node {
|
|
|
35
35
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
setupVarying( builder ) {
|
|
39
|
+
|
|
40
|
+
const properties = builder.getNodeProperties( this );
|
|
41
|
+
|
|
42
|
+
let varying = properties.varying;
|
|
43
|
+
|
|
44
|
+
if ( varying === undefined ) {
|
|
45
|
+
|
|
46
|
+
const name = this.name;
|
|
47
|
+
const type = this.getNodeType( builder );
|
|
48
|
+
|
|
49
|
+
properties.varying = varying = builder.getVaryingFromNode( this, name, type );
|
|
50
|
+
properties.node = this.node;
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// this property can be used to check if the varying can be optimized for a variable
|
|
55
|
+
varying.needsInterpolation || ( varying.needsInterpolation = ( builder.shaderStage === 'fragment' ) );
|
|
56
|
+
|
|
57
|
+
return varying;
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
setup( builder ) {
|
|
62
|
+
|
|
63
|
+
this.setupVarying( builder );
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
38
67
|
generate( builder ) {
|
|
39
68
|
|
|
40
|
-
const
|
|
41
|
-
const
|
|
69
|
+
const properties = builder.getNodeProperties( this );
|
|
70
|
+
const varying = this.setupVarying( builder );
|
|
71
|
+
|
|
72
|
+
if ( properties.propertyName === undefined ) {
|
|
42
73
|
|
|
43
|
-
|
|
74
|
+
const type = this.getNodeType( builder );
|
|
75
|
+
const propertyName = builder.getPropertyName( varying, NodeShaderStage.VERTEX );
|
|
44
76
|
|
|
45
|
-
|
|
46
|
-
|
|
77
|
+
// force node run in vertex stage
|
|
78
|
+
builder.flowNodeFromShaderStage( NodeShaderStage.VERTEX, this.node, type, propertyName );
|
|
47
79
|
|
|
48
|
-
|
|
80
|
+
properties.propertyName = propertyName;
|
|
49
81
|
|
|
50
|
-
|
|
51
|
-
builder.flowNodeFromShaderStage( NodeShaderStage.VERTEX, node, type, propertyName );
|
|
82
|
+
}
|
|
52
83
|
|
|
53
|
-
return builder.getPropertyName(
|
|
84
|
+
return builder.getPropertyName( varying );
|
|
54
85
|
|
|
55
86
|
}
|
|
56
87
|
|
|
@@ -8,6 +8,9 @@ import { uniform } from '../core/UniformNode.js';
|
|
|
8
8
|
import { RenderTarget } from 'three';
|
|
9
9
|
import { sign, max } from '../math/MathNode.js';
|
|
10
10
|
import QuadMesh from '../../objects/QuadMesh.js';
|
|
11
|
+
import { NoToneMapping, Vector2 } from 'three';
|
|
12
|
+
|
|
13
|
+
const _size = new Vector2();
|
|
11
14
|
|
|
12
15
|
const quadMeshComp = new QuadMesh();
|
|
13
16
|
|
|
@@ -58,12 +61,21 @@ class AfterImageNode extends TempNode {
|
|
|
58
61
|
this._compRT.texture.type = textureType;
|
|
59
62
|
this._oldRT.texture.type = textureType;
|
|
60
63
|
|
|
64
|
+
renderer.getDrawingBufferSize( _size );
|
|
65
|
+
|
|
66
|
+
this.setSize( _size.x, _size.y );
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
const currentToneMapping = renderer.toneMapping;
|
|
70
|
+
const currentToneMappingNode = renderer.toneMappingNode;
|
|
61
71
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
62
72
|
const currentTexture = textureNode.value;
|
|
63
73
|
|
|
64
74
|
this.textureNodeOld.value = this._oldRT.texture;
|
|
65
75
|
|
|
66
76
|
// comp
|
|
77
|
+
renderer.toneMapping = NoToneMapping;
|
|
78
|
+
renderer.toneMappingNode = null;
|
|
67
79
|
renderer.setRenderTarget( this._compRT );
|
|
68
80
|
quadMeshComp.render( renderer );
|
|
69
81
|
|
|
@@ -72,9 +84,9 @@ class AfterImageNode extends TempNode {
|
|
|
72
84
|
this._oldRT = this._compRT;
|
|
73
85
|
this._compRT = temp;
|
|
74
86
|
|
|
75
|
-
// set size before swapping fails
|
|
76
|
-
this.setSize( map.image.width, map.image.height );
|
|
77
87
|
|
|
88
|
+
renderer.toneMapping = currentToneMapping;
|
|
89
|
+
renderer.toneMappingNode = currentToneMappingNode;
|
|
78
90
|
renderer.setRenderTarget( currentRenderTarget );
|
|
79
91
|
textureNode.value = currentTexture;
|
|
80
92
|
|
|
@@ -9,41 +9,22 @@ import { addNodeElement, tslFn, nodeProxy, float, vec2 } from '../shadernode/Sha
|
|
|
9
9
|
// Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen
|
|
10
10
|
// https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf
|
|
11
11
|
|
|
12
|
-
// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)
|
|
13
|
-
|
|
14
12
|
const dHdxy_fwd = tslFn( ( { textureNode, bumpScale } ) => {
|
|
15
13
|
|
|
16
|
-
let texNode = textureNode;
|
|
17
|
-
|
|
18
|
-
if ( texNode.isTextureNode !== true ) {
|
|
19
|
-
|
|
20
|
-
texNode.traverse( ( node ) => {
|
|
21
|
-
|
|
22
|
-
if ( node.isTextureNode === true ) texNode = node;
|
|
23
|
-
|
|
24
|
-
} );
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if ( texNode.isTextureNode !== true ) {
|
|
29
|
-
|
|
30
|
-
throw new Error( 'THREE.TSL: dHdxy_fwd() requires a TextureNode.' );
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const Hll = float( textureNode );
|
|
35
|
-
const uvNode = texNode.uvNode || uv();
|
|
36
|
-
|
|
37
14
|
// It's used to preserve the same TextureNode instance
|
|
38
|
-
const sampleTexture = (
|
|
15
|
+
const sampleTexture = ( callback ) => textureNode.cache().context( { getUV: ( texNode ) => callback( texNode.uvNode || uv() ), forceUVContext: true } );
|
|
16
|
+
|
|
17
|
+
const Hll = float( sampleTexture( ( uvNode ) => uvNode ) );
|
|
39
18
|
|
|
40
19
|
return vec2(
|
|
41
|
-
float( sampleTexture( uvNode.add( uvNode.dFdx() ) ) ).sub( Hll ),
|
|
42
|
-
float( sampleTexture( uvNode.add( uvNode.dFdy() ) ) ).sub( Hll )
|
|
20
|
+
float( sampleTexture( ( uvNode ) => uvNode.add( uvNode.dFdx() ) ) ).sub( Hll ),
|
|
21
|
+
float( sampleTexture( ( uvNode ) => uvNode.add( uvNode.dFdy() ) ) ).sub( Hll )
|
|
43
22
|
).mul( bumpScale );
|
|
44
23
|
|
|
45
24
|
} );
|
|
46
25
|
|
|
26
|
+
// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)
|
|
27
|
+
|
|
47
28
|
const perturbNormalArb = tslFn( ( inputs ) => {
|
|
48
29
|
|
|
49
30
|
const { surf_pos, surf_norm, dHdxy } = inputs;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Node, { addNodeClass } from '../core/Node.js';
|
|
2
2
|
import { nodeImmutable, float } from '../shadernode/ShaderNode.js';
|
|
3
|
+
import { BackSide, WebGLCoordinateSystem } from 'three';
|
|
3
4
|
|
|
4
5
|
class FrontFacingNode extends Node {
|
|
5
6
|
|
|
@@ -13,6 +14,18 @@ class FrontFacingNode extends Node {
|
|
|
13
14
|
|
|
14
15
|
generate( builder ) {
|
|
15
16
|
|
|
17
|
+
const { renderer, material } = builder;
|
|
18
|
+
|
|
19
|
+
if ( renderer.coordinateSystem === WebGLCoordinateSystem ) {
|
|
20
|
+
|
|
21
|
+
if ( material.side === BackSide ) {
|
|
22
|
+
|
|
23
|
+
return 'false';
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
16
29
|
return builder.getFrontFacing();
|
|
17
30
|
|
|
18
31
|
}
|
|
@@ -7,6 +7,8 @@ import { uniform } from '../core/UniformNode.js';
|
|
|
7
7
|
import { viewZToOrthographicDepth, perspectiveDepthToViewZ } from './ViewportDepthNode.js';
|
|
8
8
|
import { RenderTarget, Vector2, HalfFloatType, DepthTexture, NoToneMapping/*, FloatType*/ } from 'three';
|
|
9
9
|
|
|
10
|
+
const _size = new Vector2();
|
|
11
|
+
|
|
10
12
|
class PassTextureNode extends TextureNode {
|
|
11
13
|
|
|
12
14
|
constructor( passNode, texture ) {
|
|
@@ -135,7 +137,7 @@ class PassNode extends TempNode {
|
|
|
135
137
|
|
|
136
138
|
this._pixelRatio = renderer.getPixelRatio();
|
|
137
139
|
|
|
138
|
-
const size = renderer.getSize(
|
|
140
|
+
const size = renderer.getSize( _size );
|
|
139
141
|
|
|
140
142
|
this.setSize( size.width, size.height );
|
|
141
143
|
|
|
@@ -75,7 +75,7 @@ export const orthographicDepthToViewZ = ( depth, near, far ) => near.sub( far ).
|
|
|
75
75
|
// NOTE: https://twitter.com/gonnavis/status/1377183786949959682
|
|
76
76
|
|
|
77
77
|
// -near maps to 0; -far maps to 1
|
|
78
|
-
export const viewZToPerspectiveDepth = ( viewZ, near, far ) => near.add( viewZ ).mul( far ).div(
|
|
78
|
+
export const viewZToPerspectiveDepth = ( viewZ, near, far ) => near.add( viewZ ).mul( far ).div( far.sub( near ).mul( viewZ ) );
|
|
79
79
|
|
|
80
80
|
// maps perspective depth in [ 0, 1 ] to viewZ
|
|
81
81
|
export const perspectiveDepthToViewZ = ( depth, near, far ) => near.mul( far ).div( far.sub( near ).mul( depth ).sub( far ) );
|
|
@@ -21,7 +21,9 @@ class ViewportNode extends Node {
|
|
|
21
21
|
|
|
22
22
|
getNodeType() {
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
if ( this.scope === ViewportNode.VIEWPORT ) return 'vec4';
|
|
25
|
+
else if ( this.scope === ViewportNode.COORDINATE ) return 'vec3';
|
|
26
|
+
else return 'vec2';
|
|
25
27
|
|
|
26
28
|
}
|
|
27
29
|
|
|
@@ -31,7 +33,7 @@ class ViewportNode extends Node {
|
|
|
31
33
|
|
|
32
34
|
if ( this.scope === ViewportNode.RESOLUTION || this.scope === ViewportNode.VIEWPORT ) {
|
|
33
35
|
|
|
34
|
-
updateType = NodeUpdateType.
|
|
36
|
+
updateType = NodeUpdateType.RENDER;
|
|
35
37
|
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -99,7 +101,7 @@ class ViewportNode extends Node {
|
|
|
99
101
|
|
|
100
102
|
const resolution = builder.getNodeProperties( viewportResolution ).outputNode.build( builder );
|
|
101
103
|
|
|
102
|
-
coord = `${ builder.getType( '
|
|
104
|
+
coord = `${ builder.getType( 'vec3' ) }( ${ coord }.x, ${ resolution }.y - ${ coord }.y, ${ coord }.z )`;
|
|
103
105
|
|
|
104
106
|
}
|
|
105
107
|
|
|
@@ -58,7 +58,10 @@ class ViewportTextureNode extends TextureNode {
|
|
|
58
58
|
|
|
59
59
|
clone() {
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
const viewportTextureNode = new this.constructor( this.uvNode, this.levelNode, this.value );
|
|
62
|
+
viewportTextureNode.generateMipmaps = this.generateMipmaps;
|
|
63
|
+
|
|
64
|
+
return viewportTextureNode;
|
|
62
65
|
|
|
63
66
|
}
|
|
64
67
|
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import F_Schlick from './F_Schlick.js';
|
|
2
2
|
import V_GGX_SmithCorrelated from './V_GGX_SmithCorrelated.js';
|
|
3
|
+
import V_GGX_SmithCorrelated_Anisotropic from './V_GGX_SmithCorrelated_Anisotropic.js';
|
|
3
4
|
import D_GGX from './D_GGX.js';
|
|
5
|
+
import D_GGX_Anisotropic from './D_GGX_Anisotropic.js';
|
|
4
6
|
import { transformedNormalView } from '../../accessors/NormalNode.js';
|
|
5
7
|
import { positionViewDirection } from '../../accessors/PositionNode.js';
|
|
6
|
-
import { iridescence } from '../../core/PropertyNode.js';
|
|
7
|
-
import { tslFn } from '../../shadernode/ShaderNode.js';
|
|
8
|
+
import { iridescence, alphaT, anisotropyT, anisotropyB } from '../../core/PropertyNode.js';
|
|
9
|
+
import { tslFn, defined } from '../../shadernode/ShaderNode.js';
|
|
8
10
|
|
|
9
11
|
// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility
|
|
10
12
|
const BRDF_GGX = tslFn( ( inputs ) => {
|
|
11
13
|
|
|
12
|
-
const { lightDirection, f0, f90, roughness,
|
|
14
|
+
const { lightDirection, f0, f90, roughness, f, USE_IRIDESCENCE, USE_ANISOTROPY } = inputs;
|
|
13
15
|
|
|
14
16
|
const normalView = inputs.normalView || transformedNormalView;
|
|
15
17
|
|
|
@@ -23,15 +25,32 @@ const BRDF_GGX = tslFn( ( inputs ) => {
|
|
|
23
25
|
const dotVH = positionViewDirection.dot( halfDir ).clamp();
|
|
24
26
|
|
|
25
27
|
let F = F_Schlick( { f0, f90, dotVH } );
|
|
28
|
+
let V, D;
|
|
26
29
|
|
|
27
|
-
if (
|
|
30
|
+
if ( defined( USE_IRIDESCENCE ) ) {
|
|
28
31
|
|
|
29
|
-
F = iridescence.mix( F,
|
|
32
|
+
F = iridescence.mix( F, f );
|
|
30
33
|
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
if ( defined( USE_ANISOTROPY ) ) {
|
|
37
|
+
|
|
38
|
+
const dotTL = anisotropyT.dot( lightDirection );
|
|
39
|
+
const dotTV = anisotropyT.dot( positionViewDirection );
|
|
40
|
+
const dotTH = anisotropyT.dot( halfDir );
|
|
41
|
+
const dotBL = anisotropyB.dot( lightDirection );
|
|
42
|
+
const dotBV = anisotropyB.dot( positionViewDirection );
|
|
43
|
+
const dotBH = anisotropyB.dot( halfDir );
|
|
44
|
+
|
|
45
|
+
V = V_GGX_SmithCorrelated_Anisotropic( { alphaT, alphaB: alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL } );
|
|
46
|
+
D = D_GGX_Anisotropic( { alphaT, alphaB: alpha, dotNH, dotTH, dotBH } );
|
|
47
|
+
|
|
48
|
+
} else {
|
|
49
|
+
|
|
50
|
+
V = V_GGX_SmithCorrelated( { alpha, dotNL, dotNV } );
|
|
51
|
+
D = D_GGX( { alpha, dotNH } );
|
|
52
|
+
|
|
53
|
+
}
|
|
35
54
|
|
|
36
55
|
return F.mul( V ).mul( D );
|
|
37
56
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { tslFn, float, vec3 } from '../../shadernode/ShaderNode.js';
|
|
2
|
+
|
|
3
|
+
const RECIPROCAL_PI = float( 1 / Math.PI );
|
|
4
|
+
|
|
5
|
+
// https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf
|
|
6
|
+
|
|
7
|
+
const D_GGX_Anisotropic = tslFn( ( { alphaT, alphaB, dotNH, dotTH, dotBH } ) => {
|
|
8
|
+
|
|
9
|
+
const a2 = alphaT.mul( alphaB );
|
|
10
|
+
const v = vec3( alphaB.mul( dotTH ), alphaT.mul( dotBH ), a2.mul( dotNH ) );
|
|
11
|
+
const v2 = v.dot( v );
|
|
12
|
+
const w2 = a2.div( v2 );
|
|
13
|
+
|
|
14
|
+
return RECIPROCAL_PI.mul( a2.mul( w2.pow2() ) );
|
|
15
|
+
|
|
16
|
+
} ).setLayout( {
|
|
17
|
+
name: 'D_GGX_Anisotropic',
|
|
18
|
+
type: 'float',
|
|
19
|
+
inputs: [
|
|
20
|
+
{ name: 'alphaT', type: 'float', qualifier: 'in' },
|
|
21
|
+
{ name: 'alphaB', type: 'float', qualifier: 'in' },
|
|
22
|
+
{ name: 'dotNH', type: 'float', qualifier: 'in' },
|
|
23
|
+
{ name: 'dotTH', type: 'float', qualifier: 'in' },
|
|
24
|
+
{ name: 'dotBH', type: 'float', qualifier: 'in' }
|
|
25
|
+
]
|
|
26
|
+
} );
|
|
27
|
+
|
|
28
|
+
export default D_GGX_Anisotropic;
|
|
@@ -4,9 +4,7 @@ import { tslFn } from '../../shadernode/ShaderNode.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 = tslFn( (
|
|
8
|
-
|
|
9
|
-
const { alpha, dotNL, dotNV } = inputs;
|
|
7
|
+
const V_GGX_SmithCorrelated = tslFn( ( { alpha, dotNL, dotNV } ) => {
|
|
10
8
|
|
|
11
9
|
const a2 = alpha.pow2();
|
|
12
10
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { div } from '../../math/OperatorNode.js';
|
|
2
|
+
import { tslFn, vec3 } from '../../shadernode/ShaderNode.js';
|
|
3
|
+
|
|
4
|
+
// https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf
|
|
5
|
+
|
|
6
|
+
const V_GGX_SmithCorrelated_Anisotropic = tslFn( ( { alphaT, alphaB, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL } ) => {
|
|
7
|
+
|
|
8
|
+
const gv = dotNL.mul( vec3( alphaT.mul( dotTV ), alphaB.mul( dotBV ), dotNV ).length() );
|
|
9
|
+
const gl = dotNV.mul( vec3( alphaT.mul( dotTL ), alphaB.mul( dotBL ), dotNL ).length() );
|
|
10
|
+
const v = div( 0.5, gv.add( gl ) );
|
|
11
|
+
|
|
12
|
+
return v.saturate();
|
|
13
|
+
|
|
14
|
+
} ).setLayout( {
|
|
15
|
+
name: 'V_GGX_SmithCorrelated_Anisotropic',
|
|
16
|
+
type: 'float',
|
|
17
|
+
inputs: [
|
|
18
|
+
{ name: 'alphaT', type: 'float', qualifier: 'in' },
|
|
19
|
+
{ name: 'alphaB', type: 'float', qualifier: 'in' },
|
|
20
|
+
{ name: 'dotTV', type: 'float', qualifier: 'in' },
|
|
21
|
+
{ name: 'dotBV', type: 'float', qualifier: 'in' },
|
|
22
|
+
{ name: 'dotTL', type: 'float', qualifier: 'in' },
|
|
23
|
+
{ name: 'dotBL', type: 'float', qualifier: 'in' },
|
|
24
|
+
{ name: 'dotNV', type: 'float', qualifier: 'in' },
|
|
25
|
+
{ name: 'dotNL', type: 'float', qualifier: 'in' }
|
|
26
|
+
]
|
|
27
|
+
} );
|
|
28
|
+
|
|
29
|
+
export default V_GGX_SmithCorrelated_Anisotropic;
|
|
@@ -12,7 +12,7 @@ const G_BlinnPhong_Implicit = () => float( 0.25 );
|
|
|
12
12
|
|
|
13
13
|
const D_BlinnPhong = tslFn( ( { dotNH } ) => {
|
|
14
14
|
|
|
15
|
-
return shininess.mul( 0.5
|
|
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
|
|