This node implements the vertex shader logic which is required
when rendering 3D objects via batching. BatchNode must be used
with instances of BatchedMesh.
Constructor
new BatchNode(batchMesh)| Parameter | Type | Default Value |
|---|---|---|
| batchMesh | BatchedMesh | — |
Constructs a new batch node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| batchMesh | BatchedMesh | — | |
| batchingIdNode | any | — | |
| Method | Type | |
|---|---|---|
| setup | (builder: NodeBuilder) => void | |
Extends
NodeIn earlier three.js versions it was only possible to define attribute data
on geometry level. With BufferAttributeNode, it is also possible to do this
on the node level.
const geometry = new THREE.PlaneGeometry();
const positionAttribute = geometry.getAttribute( 'position' );
const colors = [];
for ( let i = 0; i < position.count; i ++ ) {
colors.push( 1, 0, 0 );
}
material.colorNode = bufferAttribute( new THREE.Float32BufferAttribute( colors, 3 ) );
export {}This new approach is especially interesting when geometry data are generated via compute shaders. The below line converts a storage buffer into an attribute node.
material.positionNode = positionBuffer.toAttribute();
export {}Constructor
new BufferAttributeNode(value, bufferType?, bufferStride?, bufferOffset?)| Parameter | Type | Default Value |
|---|---|---|
| value | any | — |
| bufferType? | null | string | null |
| bufferStride? | number | 0 |
| bufferOffset? | number | 0 |
Constructs a new buffer attribute node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isBufferNode | boolean | — | |
| bufferType | null | string | — | |
| bufferStride | number | — | |
| bufferOffset | number | — | |
| usage | number | — | |
| instanced | boolean | — | |
| attribute | any | — | |
| Method | Type | |
|---|---|---|
| getHash | (builder: NodeBuilder) => string | |
| generateNodeType | (builder: NodeBuilder) => string | |
| setup | (builder: NodeBuilder) => void | |
| generate | (builder: NodeBuilder) => string | |
| getInputType | () => string | |
| setUsage | (value: number) => BufferAttributeNode | |
| setInstanced | (value: boolean) => BufferAttributeNode | |
Extends
InputNodeA special type of uniform node which represents array-like data
as uniform buffers. The access usually happens via element()
which returns an instance of ArrayElementNode. For example:
const bufferNode = buffer( array, 'mat4', count );
const matrixNode = bufferNode.element( index ); // access a matrix from the buffer
export {}In general, it is recommended to use the more managed UniformArrayNode since it handles more input types and automatically cares about buffer paddings.
Constructor
new BufferNode(value, bufferType, bufferCount?)| Parameter | Type | Default Value |
|---|---|---|
| value | Array<number> | — |
| bufferType | string | — |
| bufferCount? | number | 0 |
Constructs a new buffer node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isBufferNode | boolean | — | |
| bufferType | string | — | |
| bufferCount | number | — | |
| updateRanges | Array<{ start: number; count: number; }> | — | |
| Method | Type | |
|---|---|---|
| addUpdateRange | (start: number, count: number) => void | |
| clearUpdateRanges | () => void | |
| getElementType | (builder: NodeBuilder) => string | |
| getInputType | () => string | |
Extends
UniformNodeThe node allows to set values for built-in shader variables. That is required for features like hardware-accelerated vertex clipping.
Constructor
new BuiltinNode(name)| Parameter | Type | Default Value |
|---|---|---|
| name | string | — |
Constructs a new builtin node.
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isBuiltinNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generate | () => string | |
Extends
NodeThis node is used in NodeMaterial to setup the clipping which can happen hardware-accelerated (if supported) and optionally use alpha-to-coverage for anti-aliasing clipped edges.
Constructor
new ClippingNode(scope?)| Parameter | Type | Default Value |
|---|---|---|
| scope? | "default" | "hardware" | "alphaToCoverage" | ClippingNode.DEFAULT |
Constructs a new clipping node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| scope | "default" | "hardware" | "alphaToCoverage" | — | |
| hardwareClipping | any | — | |
| Method | Type | |
|---|---|---|
| setup | (builder: NodeBuilder) => Node | |
| setupAlphaToCoverage | (intersectionPlanes: Array<…>, unionPlanes: Array<…>) => Node | |
| setupDefault | (intersectionPlanes: Array<…>, unionPlanes: Array<…>) => Node | |
| setupHardwareClipping | (unionPlanes: Array<…>, builder: NodeBuilder) => Node | |
Extends
NodeThis type of uniform node represents a cube texture.
Constructor
new CubeTextureNode(value, uvNode?, levelNode?, biasNode?)| Parameter | Type | Default Value |
|---|---|---|
| value | CubeTexture | — |
| uvNode? | any | null |
| levelNode? | any | null |
| biasNode? | any | null |
Constructs a new cube texture node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isCubeTextureNode | boolean | — | |
| Method | Type | |
|---|---|---|
| getInputType | () => string | |
| getDefaultUV | () => any | |
| setUpdateMatrix | () => void | |
| setupUV | (builder: NodeBuilder, uvNode: Node) => Node | |
| generateUV | (builder: NodeBuilder, cubeUV: Node) => string | |
Extends
TextureNodeThis is a special version of InstanceNode which requires the usage of InstancedMesh.
It allows an easier setup of the instance node.
Constructor
new InstancedMeshNode(instancedMesh)| Parameter | Type | Default Value |
|---|---|---|
| instancedMesh | InstancedMesh | — |
Constructs a new instanced mesh node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| instancedMesh | InstancedMesh | — | |
Extends
InstanceNodeThis node implements the vertex shader logic which is required when rendering 3D objects via instancing. The code makes sure vertex positions, normals and colors can be modified via instanced data.
Constructor
new InstanceNode(count, instanceMatrix, instanceColor?)| Parameter | Type | Default Value |
|---|---|---|
| count | number | — |
| instanceMatrix | any | — |
| instanceColor? | any | null |
Constructs a new instance node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
| get isStorageMatrix | boolean | |
| get isStorageColor | boolean | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| count | number | — | |
| instanceMatrix | InstancedBufferAttribute | — | |
| instanceColor | InstancedBufferAttribute | — | |
| instanceMatrixNode | null | Node | — | |
| instanceColorNode | null | Node | — | |
| buffer | null | InstancedInterleavedBuffer | — | |
| bufferColor | null | InstancedBufferAttribute | — | |
| previousInstanceMatrixNode | null | Node | — | |
| Method | Type | |
|---|---|---|
| setup | (builder: NodeBuilder) => void | |
| update | (frame: NodeFrame) => void | |
| getPreviousInstancedPosition | (builder: NodeBuilder) => any | |
| _createInstanceMatrixNode | (assignBuffer: boolean, builder: NodeBuilder) => Node | |
Extends
NodeThis class should simplify the node access to material properties.
It internal uses reference nodes to make sure changes to material
properties are automatically reflected to predefined TSL objects
like e.g. materialColor.
Constructor
new MaterialNode(scope)| Parameter | Type | Default Value |
|---|---|---|
| scope | string | — |
Constructs a new material node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| scope | string | — | |
| Method | Type | |
|---|---|---|
| getCache | (property: string, type: string) => MaterialReferenceNode | |
| getFloat | (property: string) => MaterialReferenceNode<…> | |
| getColor | (property: string) => MaterialReferenceNode<…> | |
| getTexture | (property: string) => MaterialReferenceNode | |
| setup | (builder: NodeBuilder) => Node | |
Extends
NodeThis node is a special type of reference node which is intended for linking material properties with node values.
const opacityNode = materialReference( 'opacity', 'float', material );
export {}When changing material.opacity, the node value of opacityNode will
automatically be updated.
Constructor
new MaterialReferenceNode(property, inputType, material?)| Parameter | Type | Default Value |
|---|---|---|
| property | string | — |
| inputType | string | — |
| material? | any | null |
Constructs a new material reference node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| material | any | — | |
| isMaterialReferenceNode | boolean | — | |
| Method | Type | |
|---|---|---|
| updateReference | (state: any) => Object | |
Extends
ReferenceNodeThis type of node is a specialized version of Object3DNode
with larger set of model related metrics. Unlike Object3DNode,
ModelNode extracts the reference to the 3D object from the
current node frame state.
Constructor
new ModelNode(scope)| Parameter | Type | Default Value |
|---|---|---|
| scope | "position" | "viewPosition" | "direction" | "scale" | "worldMatrix" | — |
Constructs a new object model node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
| Method | Type | |
|---|---|---|
| update | (frame: NodeFrame) => void | |
Extends
Object3DNodeThis node implements the vertex transformation shader logic which is required for morph target animation.
Constructor
new MorphNode(mesh)| Parameter | Type | Default Value |
|---|---|---|
| mesh | Mesh | — |
Constructs a new morph node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| mesh | Mesh | — | |
| morphBaseInfluence | UniformNode<any> | — | |
| Method | Type | |
|---|---|---|
| setup | (builder: NodeBuilder) => void | |
| update | () => void | |
Extends
NodeThis node can be used to access transformation related metrics of 3D objects. Depending on the selected scope, a different metric is represented as a uniform in the shader. The following scopes are supported:
-
POSITION: The object’s position in world space. -
VIEW_POSITION: The object’s position in view/camera space. -
DIRECTION: The object’s direction in world space. -
SCALE: The object’s scale in world space. -
WORLD_MATRIX: The object’s matrix in world space.
Constructor
new Object3DNode(scope, object3d?)| Parameter | Type | Default Value |
|---|---|---|
| scope | "position" | "viewPosition" | "direction" | "scale" | "worldMatrix" | — |
| object3d? | any | null |
Constructs a new object 3D node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| scope | "position" | "viewPosition" | "direction" | "scale" | "worldMatrix" | — | |
| object3d | any | — | |
| uniformNode | UniformNode | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | () => "vec3" | "float" | "mat4" | |
| update | (frame: NodeFrame) => void | |
| generate | (builder: NodeBuilder) => string | |
| serialize | (data: any) => void | |
| deserialize | (data: any) => void | |
Extends
NodeA node for representing the uv coordinates of points.
Can only be used with a WebGL backend. In WebGPU, point primitives always have the size of one pixel and can thus can’t be used as sprite-like objects that display textures.
Constructor
new PointUVNode()Constructs a new point uv node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isPointUVNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generate | () => string | |
Extends
NodeBase class for nodes which establishes a reference to a property of another object. In this way, the value of the node is automatically linked to the value of referenced object. Reference nodes internally represent the linked value as a uniform.
Constructor
new ReferenceBaseNode(property, uniformType, object?, count?)| Parameter | Type | Default Value |
|---|---|---|
| property | string | — |
| uniformType | string | — |
| object? | null | Object | null |
| count? | null | number | null |
Constructs a new reference base node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| property | string | — | |
| uniformType | string | — | |
| object | null | Object | — | |
| count | null | number | — | |
| properties | Array<string> | — | |
| reference | null | Object | — | |
| node | UniformNode | — | |
| group | UniformGroupNode | — | |
| Method | Type | |
|---|---|---|
| setGroup | (group: UniformGroupNode) => ReferenceBaseNode | |
| element | (indexNode: IndexNode) => ReferenceElementNode | |
| setNodeType | (uniformType: string) => void | |
| generateNodeType | (builder: NodeBuilder) => string | |
| getValueFromReference | (object?: Object) => any | |
| updateReference | (state: any) => Object | |
| setup | () => UniformNode | |
| update | () => void | |
| updateValue | () => void | |
Extends
NodeThis type of node establishes a reference to a property of another object. In this way, the value of the node is automatically linked to the value of referenced object. Reference nodes internally represent the linked value as a uniform.
Constructor
new ReferenceNode(property, uniformType, object?, count?)| Parameter | Type | Default Value |
|---|---|---|
| property | string | — |
| uniformType | string | — |
| object? | null | Object | null |
| count? | null | number | null |
Constructs a new reference node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| property | string | — | |
| uniformType | string | — | |
| object | null | Object | — | |
| count | null | number | — | |
| properties | Array<string> | — | |
| reference | null | Object | — | |
| node | UniformNode | — | |
| group | UniformGroupNode | — | |
| Method | Type | |
|---|---|---|
| element | (indexNode: IndexNode) => ReferenceElementNode | |
| setGroup | (group: UniformGroupNode) => ReferenceNode | |
| setName | (name: string) => ReferenceNode | |
| label | (name: string) => ReferenceNode | |
| setNodeType | (uniformType: string) => void | |
| generateNodeType | (builder: NodeBuilder) => string | |
| getValueFromReference | (object?: Object) => any | |
| updateReference | (state: any) => Object | |
| setup | () => UniformNode | |
| update | () => void | |
| updateValue | () => void | |
Extends
NodeThis node is a special type of reference node which is intended for linking renderer properties with node values.
const exposureNode = rendererReference( 'toneMappingExposure', 'float', renderer );
export {}When changing renderer.toneMappingExposure, the node value of exposureNode will
automatically be updated.
Constructor
new RendererReferenceNode(property, inputType, renderer?)| Parameter | Type | Default Value |
|---|---|---|
| property | string | — |
| inputType | string | — |
| renderer? | any | null |
Constructs a new renderer reference node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| renderer | any | — | |
| Method | Type | |
|---|---|---|
| updateReference | (state: any) => Object | |
Extends
ReferenceBaseNodeThis node implements the vertex transformation shader logic which is required for skinning/skeletal animation.
Constructor
new SkinningNode(skinnedMesh)| Parameter | Type | Default Value |
|---|---|---|
| skinnedMesh | SkinnedMesh | — |
Constructs a new skinning node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| skinnedMesh | SkinnedMesh | — | |
| skinIndexNode | AttributeNode | — | |
| skinWeightNode | AttributeNode | — | |
| bindMatrixNode | any | — | |
| bindMatrixInverseNode | any | — | |
| boneMatricesNode | Node | — | |
| positionNode | any | — | |
| toPositionNode | any | — | |
| previousBoneMatricesNode | null | Node | — | |
| Method | Type | |
|---|---|---|
| getSkinnedPosition | (boneMatrices?: Node, position?: Node<…>) => any | |
| getSkinnedNormalAndTangent | (boneMatrices?: Node, normal?: Node<…>, tangent?: Node<…>) => { skinNormal: Node<…>; skinTangent: Node<vec3>; } | |
| getPreviousSkinnedPosition | (builder: NodeBuilder) => any | |
| setup | (builder: NodeBuilder) => any | |
| generate | (builder: NodeBuilder, output: string) => string | |
| update | (frame: NodeFrame) => void | |
Extends
NodeThis node is used in context of compute shaders and allows to define a
storage buffer for data. A typical workflow is to create instances of
this node with the convenience functions attributeArray() or instancedArray(),
setup up a compute shader that writes into the buffers and then convert
the storage buffers to attribute nodes for rendering.
const positionBuffer = instancedArray( particleCount, 'vec3' ); // the storage buffer node
const computeInit = Fn( () => { // the compute shader
const position = positionBuffer.element( instanceIndex );
// compute position data
position.x = 1;
position.y = 1;
position.z = 1;
} )().compute( particleCount );
const particleMaterial = new THREE.SpriteNodeMaterial();
particleMaterial.positionNode = positionBuffer.toAttribute();
renderer.computeAsync( computeInit );
export {}Constructor
new StorageBufferNode(value, bufferType?, bufferCount?)| Parameter | Type | Default Value |
|---|---|---|
| value | any | — |
| bufferType? | any | null |
| bufferCount? | number | 0 |
Constructs a new storage buffer node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isStorageBufferNode | boolean | — | |
| structTypeNode | any | — | |
| access | string | — | |
| isAtomic | boolean | — | |
| isPBO | boolean | — | |
| _attribute | any | — | |
| _varying | any | — | |
| Method | Type | |
|---|---|---|
| getHash | (builder: NodeBuilder) => string | |
| getInputType | () => string | |
| element | (indexNode: IndexNode) => StorageArrayElementNode | |
| setPBO | (value: boolean) => StorageBufferNode | |
| getPBO | () => boolean | |
| setAccess | (value: string) => StorageBufferNode | |
| toReadOnly | () => StorageBufferNode | |
| setAtomic | (value: boolean) => StorageBufferNode | |
| toAtomic | () => StorageBufferNode | |
| getAttributeData | () => { attribute: BufferAttributeNode; varying: VaryingNode; } | |
| generateNodeType | (builder: NodeBuilder) => string | |
| getMemberType | (builder: NodeBuilder, name: string) => string | |
| generate | (builder: NodeBuilder) => string | |
Extends
BufferNodeThis special version of a texture node can be used to write data into a storage texture with a compute shader.
const storageTexture = new THREE.StorageTexture( width, height );
const computeTexture = Fn( ( { storageTexture } ) => {
const posX = instanceIndex.mod( width );
const posY = instanceIndex.div( width );
const indexUV = uvec2( posX, posY );
// generate RGB values
const r = 1;
const g = 1;
const b = 1;
textureStore( storageTexture, indexUV, vec4( r, g, b, 1 ) ).toWriteOnly();
} );
const computeNode = computeTexture( { storageTexture } ).compute( width * height );
renderer.computeAsync( computeNode );
export {}This node can only be used with a WebGPU backend.
Constructor
new StorageTextureNode(value, uvNode, storeNode?)| Parameter | Type | Default Value |
|---|---|---|
| value | StorageTexture | — |
| uvNode | Node<vec2|vec3> | — |
| storeNode? | null | Node | null |
Constructs a new storage texture node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| storeNode | null | Node | — | |
| mipLevel | number | — | |
| isStorageTextureNode | boolean | — | |
| access | string | — | |
| Method | Type | |
|---|---|---|
| getInputType | () => string | |
| setup | (builder: any) => any | |
| setAccess | (value: string) => StorageTextureNode | |
| setMipLevel | (level: number) => StorageTextureNode | |
| generate | (builder: NodeBuilder, output: string) => string | |
| generateSnippet | (builder: NodeBuilder, textureProperty: string, uvSnippet: string, levelSnippet: null | string, biasSnippet: null | string, depthSnippet: null | string, compareSnippet: null | string, gradSnippet: null | Array<…>, offsetSnippet: null | string) => string | |
| toReadWrite | () => StorageTextureNode | |
| toReadOnly | () => StorageTextureNode | |
| toWriteOnly | () => StorageTextureNode | |
| generateStore | (builder: NodeBuilder) => void | |
| clone | () => TextureNode | |
Extends
TextureNodeThis type of uniform node represents a 3D texture.
Constructor
new Texture3DNode(value, uvNode?, levelNode?)| Parameter | Type | Default Value |
|---|---|---|
| value | Data3DTexture | — |
| uvNode? | any | null |
| levelNode? | any | null |
Constructs a new 3D texture node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isTexture3DNode | boolean | — | |
| Method | Type | |
|---|---|---|
| getInputType | () => string | |
| getDefaultUV | () => any | |
| setUpdateMatrix | () => void | |
| generateUV | (builder: NodeBuilder, uvNode: Node) => string | |
| generateOffset | (builder: NodeBuilder, offsetNode: Node) => string | |
| normal | (uvNode: Node<…>) => any | |
Extends
TextureNodeThis type of uniform node represents a 2D texture.
Constructor
new TextureNode(value?, uvNode?, levelNode?, biasNode?)| Parameter | Type | Default Value |
|---|---|---|
| value? | Texture | EmptyTexture |
| uvNode? | any | null |
| levelNode? | any | null |
| biasNode? | any | null |
Constructs a new texture node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
| set value | Texture | |
| get value | Texture | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isTextureNode | boolean | — | |
| uvNode | any | — | |
| levelNode | any | — | |
| biasNode | any | — | |
| compareNode | any | — | |
| depthNode | any | — | |
| gradNode | null | Array<any> | — | |
| offsetNode | any | — | |
| sampler | boolean | — | |
| updateMatrix | boolean | — | |
| referenceNode | null | Node | — | |
| _value | Texture | — | |
| _matrixUniform | any | — | |
| _flipYUniform | any | — | |
| Method | Type | |
|---|---|---|
| getUniformHash | () => string | |
| generateNodeType | () => string | |
| getInputType | () => string | |
| getDefaultUV | () => AttributeNode<…> | |
| updateReference | () => Texture | |
| getTransformedUV | (uvNode: Node) => Node | |
| setUpdateMatrix | (value: boolean) => TextureNode | |
| setupUV | (builder: NodeBuilder, uvNode: Node) => Node | |
| setup | (builder: NodeBuilder) => void | |
| generateUV | (builder: NodeBuilder, uvNode: Node) => string | |
| generateOffset | (builder: NodeBuilder, offsetNode: Node) => string | |
| generateSnippet | (builder: NodeBuilder, textureProperty: string, uvSnippet: string, levelSnippet: null | string, biasSnippet: null | string, depthSnippet: null | string, compareSnippet: null | string, gradSnippet: null | Array<…>, offsetSnippet: null | string) => string | |
| generate | (builder: NodeBuilder, output: string) => string | |
| setSampler | (value: boolean) => TextureNode | |
| getSampler | () => boolean | |
| sample | (uvNode: Node) => TextureNode | |
| load | (uvNode: Node<…>) => TextureNode | |
| blur | (amountNode: Node<…>) => TextureNode | |
| level | (levelNode: Node<…>) => TextureNode | |
| size | (levelNode: Node<…>) => TextureSizeNode | |
| bias | (biasNode: Node<…>) => TextureNode | |
| getBase | () => TextureNode | |
| compare | (compareNode: Node<…>) => TextureNode | |
| grad | (gradNodeX: Node<…>, gradNodeY: Node<…>) => TextureNode | |
| depth | (depthNode: Node<…>) => TextureNode | |
| offset | (offsetNode: Node<…>) => TextureNode | |
| serialize | (data: any) => void | |
| deserialize | (data: any) => void | |
| update | () => void | |
| clone | () => TextureNode | |
Extends
UniformNodeA node that represents the dimensions of a texture. The texture size is
retrieved in the shader via built-in shader functions like textureDimensions()
or textureSize().
Constructor
new TextureSizeNode(textureNode, levelNode?)| Parameter | Type | Default Value |
|---|---|---|
| textureNode | TextureNode | — |
| levelNode? | any | null |
Constructs a new texture size node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isTextureSizeNode | boolean | — | |
| textureNode | TextureNode | — | |
| levelNode | any | — | |
| Method | Type | |
|---|---|---|
| generate | (builder: any, output: any) => any | |
Extends
NodeSimilar to BufferNode this module represents array-like data as
uniform buffers. Unlike BufferNode, it can handle more common
data types in the array (e.g three.js primitives) and automatically
manage buffer padding. It should be the first choice when working with
uniforms buffers.
const tintColors = uniformArray( [
new Color( 1, 0, 0 ),
new Color( 0, 1, 0 ),
new Color( 0, 0, 1 )
], 'color' );
const redColor = tintColors.element( 0 );
export {}Constructor
new UniformArrayNode(value, elementType?)| Parameter | Type | Default Value |
|---|---|---|
| value | Array<any> | — |
| elementType? | null | string | null |
Constructs a new uniform array node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| array | Array<any> | — | |
| elementType | string | — | |
| paddedType | string | — | |
| isArrayBufferNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | () => string | |
| getElementType | () => string | |
| getPaddedType | () => string | |
| update | () => void | |
| setup | (builder: NodeBuilder) => null | |
| element | (indexNode: IndexNode) => UniformArrayElementNode | |
Extends
BufferNodeA special type of reference node that allows to link values in
userData fields to node objects.
sprite.userData.rotation = 1; // stores individual rotation per sprite
const material = new THREE.SpriteNodeMaterial();
material.rotationNode = userData( 'rotation', 'float' );
export {}Since UserDataNode is extended from ReferenceNode, the node value
will automatically be updated when the rotation user data field changes.
Constructor
new UserDataNode(property, inputType, userData?)| Parameter | Type | Default Value |
|---|---|---|
| property | string | — |
| inputType | string | — |
| userData? | null | Object | null |
Constructs a new user data node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| userData | null | Object | — | |
| Method | Type | |
|---|---|---|
| updateReference | (state: any) => Object | |
Extends
ReferenceNodeA node for representing motion or velocity vectors. Foundation for advanced post processing effects like motion blur or TRAA.
The node keeps track of the model, view and projection matrices of the previous frame and uses them to compute offsets in NDC space. These offsets represent the final velocity.
Constructor
new VelocityNode()Constructs a new vertex color node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| projectionMatrix | null | Matrix4 | — | |
| previousModelWorldMatrix | UniformNode<mat4> | — | |
| previousProjectionMatrix | UniformNode<mat4> | — | |
| previousCameraViewMatrix | UniformNode<mat4> | — | |
| Method | Type | |
|---|---|---|
| setProjectionMatrix | (projectionMatrix: Matrix4) => void | |
| update | ({ frameId, camera, object }: NodeFrame) => void | |
| updateAfter | ({ object }: NodeFrame) => void | |
| setup | () => any | |
Extends
TempNodeAn attribute node for representing vertex colors.
Constructor
new VertexColorNode(index)| Parameter | Type | Default Value |
|---|---|---|
| index | number | — |
Constructs a new vertex color node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isVertexColorNode | boolean | — | |
| index | number | — | |
| Method | Type | |
|---|---|---|
| getAttributeName | () => string | |
| generate | (builder: any) => any | |
| serialize | (data: any) => void | |
| deserialize | (data: any) => void | |
Extends
AttributeNodeThis class represents native code sections. It is the base class for modules like FunctionNode which allows to implement functions with native shader languages.
Constructor
new CodeNode(code?, includes?, language?)| Parameter | Type | Default Value |
|---|---|---|
| code? | string | |
| includes? | Array<Node> | [] |
| language? | "js" | "wgsl" | "glsl" | |
Constructs a new code node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isCodeNode | boolean | — | |
| code | string | — | |
| includes | Array<Node> | — | |
| language | "js" | "wgsl" | "glsl" | — | |
| Method | Type | |
|---|---|---|
| setIncludes | (includes: Array<…>) => CodeNode | |
| getIncludes | () => Array<…> | |
| generate | (builder: any) => any | |
| serialize | (data: any) => void | |
| deserialize | (data: any) => void | |
Extends
NodeThis class can be used to implement basic expressions in shader code.
Basic examples for that are return, continue or discard statements.
Constructor
new ExpressionNode(snippet?, nodeType?)| Parameter | Type | Default Value |
|---|---|---|
| snippet? | string | |
| nodeType? | string | void |
Constructs a new expression node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| snippet | string | — | |
| Method | Type | |
|---|---|---|
| generate | (builder: any, output: any) => any | |
Extends
NodeThis module represents the call of a FunctionNode. Developers are usually not confronted
with this module since they use the predefined TSL syntax wgslFn and glslFn which encapsulate
this logic.
Constructor
new FunctionCallNode(functionNode?, parameters?)| Parameter | Type | Default Value |
|---|---|---|
| functionNode? | any | null |
| parameters? | { [x: string]: Node; } | {} |
Constructs a new function call node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| functionNode | any | — | |
| parameters | { [x: string]: Node; } | — | |
| Method | Type | |
|---|---|---|
| setParameters | (parameters: { [x: string]: Node; }) => FunctionCallNode | |
| getParameters | () => { [x: string]: Node; } | |
| generateNodeType | (builder: NodeBuilder) => string | |
| getMemberType | (builder: NodeBuilder, name?: string) => string | |
| generate | (builder: any) => string | |
Extends
TempNodeThis class represents a native shader function. It can be used to implement certain aspects of a node material with native shader code. There are two predefined TSL functions for easier usage.
-
wgslFn: Creates a WGSL function node. -
glslFn: Creates a GLSL function node.
A basic example with one include looks like so:
const desaturateWGSLFn = wgslFn( `
fn desaturate( color:vec3<f32> ) -> vec3<f32> {
let lum = vec3<f32>( 0.299, 0.587, 0.114 );
return vec3<f32>( dot( lum, color ) );
}`
);
const someWGSLFn = wgslFn( `
fn someFn( color:vec3<f32> ) -> vec3<f32> {
return desaturate( color );
}
`, [ desaturateWGSLFn ] );
material.colorNode = someWGSLFn( { color: texture( map ) } );
export {}Constructor
new FunctionNode(code?, includes?, language?)| Parameter | Type | Default Value |
|---|---|---|
| code? | string | |
| includes? | Array<Node> | [] |
| language? | "js" | "wgsl" | "glsl" | |
Constructs a new function node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
| Method | Type | |
|---|---|---|
| generateNodeType | (builder: NodeBuilder) => string | |
| getMemberType | (builder: NodeBuilder, name: string) => string | |
| getInputs | (builder: NodeBuilder) => Array<…> | |
| getNodeFunction | (builder: NodeBuilder) => NodeFunction | |
| generate | (builder: any, output: any) => any | |
Extends
CodeNodeArrayNode represents a collection of nodes, typically created using the array function.
const colors = array( [
vec3( 1, 0, 0 ),
vec3( 0, 1, 0 ),
vec3( 0, 0, 1 )
] );
const redColor = tintColors.element( 0 );
export {}Constructor
new ArrayNode(nodeType, count, values?)| Parameter | Type | Default Value |
|---|---|---|
| nodeType | null | string | — |
| count | number | — |
| values? | null | Array<Node> | null |
Constructs a new array node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| count | number | — | |
| values | null | Array<Node> | — | |
| isArrayNode | boolean | — | |
| Method | Type | |
|---|---|---|
| getArrayCount | () => number | |
| generateNodeType | (builder: NodeBuilder) => string | |
| getElementType | (builder: NodeBuilder) => string | |
| getMemberType | (builder: NodeBuilder, name: string) => string | |
| generate | (builder: NodeBuilder) => string | |
Extends
TempNodeThese node represents an assign operation. Meaning a node is assigned to another node.
Constructor
new AssignNode(targetNode, sourceNode)| Parameter | Type | Default Value |
|---|---|---|
| targetNode | Node | — |
| sourceNode | Node | — |
Constructs a new assign node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| targetNode | Node | — | |
| sourceNode | Node | — | |
| isAssignNode | boolean | — | |
| Method | Type | |
|---|---|---|
| hasDependencies | () => boolean | |
| generateNodeType | (builder: any, output: any) => any | |
| needsSplitAssign | (builder: NodeBuilder) => boolean | |
| setup | (builder: any) => void | |
| generate | (builder: any, output: any) => any | |
Extends
TempNodeBase class for representing shader attributes as nodes.
Constructor
new AttributeNode(attributeName, nodeType?)| Parameter | Type | Default Value |
|---|---|---|
| attributeName | string | — |
| nodeType? | null | string | null |
Constructs a new attribute node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| _attributeName | string | — | |
| Method | Type | |
|---|---|---|
| getHash | (builder: any) => string | |
| generateNodeType | (builder: any) => null | string | |
| setAttributeName | (attributeName: string) => AttributeNode | |
| getAttributeName | () => string | |
| generate | (builder: any) => any | |
| serialize | (data: any) => void | |
| deserialize | (data: any) => void | |
Extends
NodeThe class generates the code of a given node but returns another node in the output.
This can be used to call a method or node that does not return a value, i.e.
type void on an input where returning a value is required. Example:
material.colorNode = myColor.bypass( runVoidFn() )
export {}Constructor
new BypassNode(outputNode, callNode)| Parameter | Type | Default Value |
|---|---|---|
| outputNode | Node | — |
| callNode | Node | — |
Constructs a new bypass node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isBypassNode | boolean | — | |
| outputNode | Node | — | |
| callNode | Node | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | (builder: any) => string | |
| generate | (builder: any) => null | string | Node | |
Extends
NodePossible shader stages.
Type
{ VERTEX: string; FRAGMENT: string; }Update types of a node.
Type
{ NONE: string; FRAME: string; RENDER: string; OBJECT: string; }Data types of a node.
Type
{ BOOLEAN: string; INTEGER: string; FLOAT: string; VECTOR2: string; VECTOR3: string; VECTOR4: string; MATRIX2: string; MATRIX3: string; MATRIX4: string; }Access types of a node. These are relevant for compute and storage usage.
Type
{ READ_ONLY: string; WRITE_ONLY: string; READ_WRITE: string; }Type
Array<string>Type
Array<string>Type
Array<string>Type
Array<string>Class for representing a constant value in the shader.
Constructor
new ConstNode(value, nodeType?)| Parameter | Type | Default Value |
|---|---|---|
| value | any | — |
| nodeType? | null | string | null |
Constructs a new input node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isConstNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generateConst | (builder: NodeBuilder) => string | |
| generate | (builder: any, output: any) => any | |
Extends
InputNodeThis node can be used as a context management component for another node.
NodeBuilder performs its node building process in a specific context and
this node allows the modify the context. A typical use case is to overwrite getUV() e.g.:
node.context( { getUV: () => customCoord } );
\// or
material.contextNode = context( { getUV: () => customCoord } );
\// or
renderer.contextNode = context( { getUV: () => customCoord } );
\// or
scenePass.contextNode = context( { getUV: () => customCoord } );
export {}Constructor
new ContextNode(node?, value?)| Parameter | Type | Default Value |
|---|---|---|
| node? | Node | null |
| value? | Object | {} |
Constructs a new context node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isContextNode | boolean | — | |
| node | Node | — | |
| value | Object | — | |
| Method | Type | |
|---|---|---|
| getScope | () => Node | |
| generateNodeType | (builder: NodeBuilder) => string | |
| getFlowContextData | () => Object | |
| getMemberType | (builder: NodeBuilder, name: string) => string | |
| analyze | (builder: any) => void | |
| setup | (builder: any) => void | |
| generate | (builder: any, output: any) => null | string | Node | |
Extends
NodeThis class represents shader indices of different types. The following predefined node objects cover frequent use cases:
-
vertexIndex: The index of a vertex within a mesh. -
instanceIndex: The index of either a mesh instance or an invocation of a compute shader. -
drawIndex: The index of a draw call. -
invocationLocalIndex: The index of a compute invocation within the scope of a workgroup load. -
invocationSubgroupIndex: The index of a compute invocation within the scope of a subgroup. -
subgroupIndex: The index of a compute invocation’s subgroup within its workgroup.
Constructor
new IndexNode(scope)| Parameter | Type | Default Value |
|---|---|---|
| scope | "vertex" | "instance" | "subgroup" | "invocationLocal" | "invocationGlobal" | "invocationSubgroup" | "draw" | — |
Constructs a new index node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| scope | string | — | |
| isIndexNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generate | (builder: any) => any | |
Extends
NodeBase class for representing data input nodes.
Constructor
new InputNode(value, nodeType?)| Parameter | Type | Default Value |
|---|---|---|
| value | any | — |
| nodeType? | null | string | null |
Constructs a new input node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isInputNode | boolean | — | |
| value | any | — | |
| precision | null | "low" | "medium" | "high" | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | () => null | string | |
| getInputType | (builder: NodeBuilder) => string | |
| setPrecision | (precision: "low" | "medium" | "high") => InputNode | |
| serialize | (data: any) => void | |
| deserialize | (data: any) => void | |
| generate | () => void | |
Extends
NodeInspectorNode is a wrapper node that allows inspection of node values during rendering. It can be used to debug or analyze node outputs in the rendering pipeline.
Constructor
new InspectorNode(node, name?, callback?)| Parameter | Type | Default Value |
|---|---|---|
| node | Node | — |
| name? | string | |
| callback? | null | Function | null |
Creates an InspectorNode.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| node | Node | — | |
| name | string | — | |
| callback | null | Function | — | |
| updateType | string | — | |
| isInspectorNode | boolean | — | |
| Method | Type | |
|---|---|---|
| getName | () => string | |
| update | (frame: NodeFrame) => void | |
| generateNodeType | (builder: NodeBuilder) => string | |
| setup | (builder: NodeBuilder) => Node | |
Extends
NodeThis node can be used as a cache management component for another node. Caching is in general used by default in NodeBuilder but this node allows the usage of a shared parent cache during the build process.
Constructor
new IsolateNode(node, parent?)| Parameter | Type | Default Value |
|---|---|---|
| node | Node | — |
| parent? | boolean | true |
Constructs a new cache node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| node | Node | — | |
| parent | boolean | — | |
| isIsolateNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | (builder: any) => string | |
| build | (builder: any, ...params: Array<…>) => null | string | Node | |
| setParent | (parent: any) => this | |
| getParent | () => boolean | |
Extends
NodeAbstract class for implementing lighting models. The module defines multiple methods that concrete lighting models can implement. These methods are executed at different points during the light evaluation process.
| Method | Type | |
|---|---|---|
| start | (builder: NodeBuilder) => void | |
| finish | () => void | |
| direct | () => void | |
| directRectArea | () => void | |
| indirect | () => void | |
| ambientOcclusion | () => void | |
This node can be used setup a MRT context for rendering. A typical MRT setup for post-processing is shown below:
const mrtNode = mrt( {
output: output,
normal: normalView
} ) ;
export {}The MRT output is defined as a dictionary.
Constructor
new MRTNode(outputNodes)| Parameter | Type | Default Value |
|---|---|---|
| outputNodes | { [x: string]: Node; } | — |
Constructs a new output struct node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| outputNodes | { [x: string]: Node; } | — | |
| blendModes | { [x: string]: BlendMode; } | — | |
| isMRTNode | boolean | — | |
| Method | Type | |
|---|---|---|
| setBlendMode | (name: string, blend: BlendMode) => MRTNode | |
| getBlendMode | (name: string) => BlendMode | |
| has | (name: string) => NodeBuilder | |
| get | (name: string) => Node | |
| merge | (mrtNode: MRTNode) => MRTNode | |
| setup | (builder: any) => null | Node | |
Extends
OutputStructNodeBase class for all nodes.
Constructor
new Node(nodeType?)| Parameter | Type | Default Value |
|---|---|---|
| nodeType? | null | string | null |
Constructs a new node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
| set needsUpdate | boolean | |
| get uuid | string | |
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| nodeType | null | string | — | |
| updateType | string | — | |
| updateBeforeType | string | — | |
| updateAfterType | string | — | |
| version | number | — | |
| name | string | — | |
| global | boolean | — | |
| parents | boolean | — | |
| isNode | boolean | — | |
| _beforeNodes | any | — | |
| _cacheKey | null | number | — | |
| _uuid | string | — | |
| _cacheKeyVersion | number | — | |
| id | number | — | |
| stackTrace | null | string | — | |
| Method | Type | |
|---|---|---|
| onUpdate | (callback: Function, updateType: string) => Node | |
| onFrameUpdate | (callback: Function) => Node | |
| onRenderUpdate | (callback: Function) => Node | |
| onObjectUpdate | (callback: Function) => Node | |
| onReference | (callback: Function) => Node | |
| updateReference | () => any | |
| isGlobal | () => boolean | |
| getChildren | () => Generator<…> | |
| dispose | () => void | |
| traverse | (callback: traverseCallback) => void | |
| _getChildren | (ignores?: Set<…>) => Array<…> | |
| getCacheKey | (force?: boolean, ignores?: Set<…>) => number | |
| customCacheKey | () => number | |
| getScope | () => Node | |
| getHash | () => string | |
| getUpdateType | () => { NONE: string; FRAME: string; RENDER: string; OBJECT: string; } | |
| getUpdateBeforeType | () => { NONE: string; FRAME: string; RENDER: string; OBJECT: string; } | |
| getUpdateAfterType | () => { NONE: string; FRAME: string; RENDER: string; OBJECT: string; } | |
| getElementType | (builder: NodeBuilder) => string | |
| getMemberType | () => string | |
| getNodeType | (builder: NodeBuilder, output?: string) => string | |
| generateNodeType | (builder: NodeBuilder, output?: string) => string | |
| getShared | (builder: NodeBuilder) => Node | |
| getArrayCount | () => null | number | |
| setup | (builder: NodeBuilder) => null | Node | |
| analyze | (builder: NodeBuilder, output?: null | Node) => void | |
| generate | (builder: NodeBuilder, output?: null | string) => null | string | |
| updateBefore | () => null | boolean | |
| updateAfter | () => null | boolean | |
| update | () => null | boolean | |
| before | (node: any) => this | |
| build | (builder: NodeBuilder, output?: null | string | Node) => null | string | Node | |
| getSerializeChildren | () => Generator<…> | |
| serialize | (json: Object) => void | |
| deserialize | (json: Object) => void | |
| toJSON | (meta: null | Object) => Object | |
Extends
EventDispatcherNodeBuilder is going to create instances of this class during the build process of nodes. They represent the final shader attributes that are going to be generated by the builder. Arrays of node attributes is maintained in NodeBuilder#attributes and NodeBuilder#bufferAttributes for this purpose.
Constructor
new NodeAttribute(name, type, node?)| Parameter | Type | Default Value |
|---|---|---|
| name | string | — |
| type | string | — |
| node? | null | Node | null |
Constructs a new node attribute.
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isNodeAttribute | boolean | — | |
| name | string | — | |
| type | string | — | |
| node | null | Node | — | |
Base class for builders which generate a shader program based on a 3D object and its node material definition.
Constructor
new NodeBuilder(object, renderer, parser)| Parameter | Type | Default Value |
|---|---|---|
| object | Object3D | — |
| renderer | Renderer | — |
| parser | NodeParser | — |
Constructs a new node builder.
| Accessor | Type | |
|---|---|---|
| get currentNode | Node | |
| get subBuild | SubBuildNode | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| object | Object3D | — | |
| material | any | — | |
| geometry | any | — | |
| renderer | Renderer | — | |
| parser | NodeParser | — | |
| scene | any | — | |
| camera | any | — | |
| nodes | Array<Node> | — | |
| sequentialNodes | Array<Node> | — | |
| updateNodes | Array<Node> | — | |
| updateBeforeNodes | Array<Node> | — | |
| updateAfterNodes | Array<Node> | — | |
| hashNodes | { [x: number]: Node; } | — | |
| observer | any | — | |
| lightsNode | any | — | |
| environmentNode | null | Node | — | |
| fogNode | null | Node | — | |
| clippingContext | any | — | |
| vertexShader | null | string | — | |
| fragmentShader | null | string | — | |
| computeShader | null | string | — | |
| flowNodes | { [x: string]: Array<Node>; } | — | |
| flowCode | { [x: string]: string; } | — | |
| uniforms | Object | — | |
| structs | Object | — | |
| types | Object | — | |
| bindings | Object | — | |
| bindingsIndexes | Object | — | |
| bindGroups | null | Array<BindGroup> | — | |
| attributes | Array<NodeAttribute> | — | |
| bufferAttributes | Array<NodeAttribute> | — | |
| varyings | Array<NodeVarying> | — | |
| codes | { [x: string]: Array<NodeCode>; } | — | |
| vars | { [x: string]: number | Array<NodeVar>; } | — | |
| declarations | Object | — | |
| flow | { code: string; } | — | |
| chaining | Array<Node> | — | |
| stack | StackNode | — | |
| stacks | Array<StackNode> | — | |
| tab | string | — | |
| currentFunctionNode | null | FunctionNode | — | |
| context | Object | — | |
| cache | NodeCache | — | |
| globalCache | NodeCache | — | |
| flowsData | WeakMap<WeakKey, any> | — | |
| shaderStage | null | "vertex" | "fragment" | "compute" | "any" | — | |
| buildStage | null | "generate" | "setup" | "analyze" | — | |
| subBuildLayers | Array<SubBuildNode> | — | |
| activeStacks | Array<StackNode> | — | |
| subBuildFn | null | string | — | |
| fnCall | null | Node | — | |
| Method | Type | |
|---|---|---|
| isFlatShading | () => boolean | |
| isOpaque | () => boolean | |
| createRenderTarget | (width: number, height: number, options: Object) => RenderTarget | |
| createCubeRenderTarget | (size: number, options: Object) => CubeRenderTarget | |
| includes | (node: Node) => boolean | |
| getOutputStructName | () => string | |
| _getBindGroup | (groupName: string, bindings: Array<…>) => BindGroup | |
| getBindGroupArray | (groupName: string, shaderStage: "vertex" | "fragment" | "compute" | "any") => Array<…> | |
| getBindings | () => Array<…> | |
| sortBindingGroups | () => void | |
| setHashNode | (node: Node, hash: number) => void | |
| addNode | (node: Node) => void | |
| addSequentialNode | (node: Node) => void | |
| buildUpdateNodes | () => void | |
| isFilteredTexture | (texture: Texture) => boolean | |
| getUniformBufferLimit | () => number | |
| addChain | (node: Node) => void | |
| removeChain | (node: Node) => void | |
| getMethod | (method: string) => string | |
| getTernary | () => string | |
| getNodeFromHash | (hash: number) => Node | |
| addFlow | (shaderStage: "vertex" | "fragment" | "compute", node: Node) => Node | |
| setContext | (context: Object) => void | |
| getContext | () => Object | |
| addContext | (context: Object) => Object | |
| getSharedContext | () => Object | |
| setCache | (cache: NodeCache) => void | |
| getCache | () => NodeCache | |
| getCacheFromNode | (node: Node, parent?: boolean) => NodeCache | |
| isAvailable | () => boolean | |
| getVertexIndex | () => string | |
| getInstanceIndex | () => string | |
| getDrawIndex | () => null | string | |
| getFrontFacing | () => string | |
| getFragCoord | () => string | |
| isFlipY | () => boolean | |
| increaseUsage | (node: Node) => number | |
| generateTexture | () => string | |
| generateTextureLod | () => string | |
| generateArrayDeclaration | (type: string, count?: null | number) => string | |
| generateArray | (type: string, count?: null | number, values?: null | Array<…>) => string | |
| generateStruct | (type: string, membersLayout?: Array<…>, values?: null | Array<…>) => string | |
| generateConst | (type: string, value?: any) => string | |
| getType | (type: string) => string | |
| hasGeometryAttribute | (name: string) => boolean | |
| getAttribute | (name: string, type: string) => NodeAttribute | |
| getPropertyName | (node: Node) => string | |
| isVector | (type: string) => boolean | |
| isMatrix | (type: string) => boolean | |
| isReference | (type: string) => boolean | |
| needsToWorkingColorSpace | () => boolean | |
| getComponentTypeFromTexture | (texture: Texture) => string | |
| getElementType | (type: string) => string | |
| getComponentType | (type: string) => string | |
| getVectorType | (type: string) => string | |
| getTypeFromLength | (length: number, componentType?: string) => string | |
| getTypeFromArray | (array: TypedArray) => string | |
| isInteger | (type: string) => boolean | |
| getTypeFromAttribute | (attribute: BufferAttribute) => string | |
| getTypeLength | (type: string) => number | |
| getVectorFromMatrix | (type: string) => string | |
| changeComponentType | (type: string, newComponentType: string) => string | |
| getIntegerType | (type: string) => string | |
| setActiveStack | (stack: StackNode) => void | |
| removeActiveStack | (stack: StackNode) => void | |
| getActiveStack | () => StackNode | |
| getBaseStack | () => StackNode | |
| addStack | () => StackNode | |
| removeStack | () => StackNode | |
| getDataFromNode | (node: Node, shaderStage?: "vertex" | "fragment" | "compute" | "any", cache?: null | NodeCache) => Object | |
| getNodeProperties | (node: Node, shaderStage?: "vertex" | "fragment" | "compute" | "any") => Object | |
| getBufferAttributeFromNode | (node: BufferAttributeNode, type: string) => NodeAttribute | |
| getStructTypeNode | (name: string, shaderStage?: "vertex" | "fragment" | "compute" | "any") => null | StructType | |
| getStructTypeFromNode | (node: OutputStructNode, membersLayout: Array<…>, name?: null | string, shaderStage?: "vertex" | "fragment" | "compute" | "any") => StructType | |
| getOutputStructTypeFromNode | (node: OutputStructNode, membersLayout: Array<…>) => StructType | |
| getUniformFromNode | (node: UniformNode, type: string, shaderStage?: "vertex" | "fragment" | "compute" | "any", name?: null | string) => NodeUniform | |
| getVarFromNode | (node: VarNode, name?: null | string, type?: string, shaderStage?: "vertex" | "fragment" | "compute" | "any", readOnly?: boolean) => NodeVar | |
| isDeterministic | (node: Node) => boolean | |
| getVaryingFromNode | (node: any, name?: null | string, type?: string, interpolationType?: null | string, interpolationSampling?: null | string) => NodeVar | |
| registerDeclaration | (node: Object) => void | |
| getCodeFromNode | (node: CodeNode, type: string, shaderStage?: "vertex" | "fragment" | "compute" | "any") => NodeCode | |
| addFlowCodeHierarchy | (node: Node, nodeBlock: Node) => void | |
| addLineFlowCodeBlock | (node: Node, code: string, nodeBlock: Node) => void | |
| addLineFlowCode | (code: string, node?: null | Node) => NodeBuilder | |
| addFlowCode | (code: string) => NodeBuilder | |
| addFlowTab | () => NodeBuilder | |
| removeFlowTab | () => NodeBuilder | |
| getFlowData | (node: Node) => Object | |
| flowNode | (node: Node) => Object | |
| addInclude | (node: Node) => void | |
| buildFunctionNode | (shaderNode: ShaderNodeInternal) => FunctionNode | |
| flowShaderNode | (shaderNode: ShaderNodeInternal) => Object | |
| flowBuildStage | (node: Node, buildStage: string, output?: null | string | Node) => null | string | Node | |
| flowStagesNode | (node: Node, output?: null | string) => Object | |
| getFunctionOperator | () => null | string | |
| buildFunctionCode | () => string | |
| flowChildNode | (node: Node, output?: null | string) => Object | |
| flowNodeFromShaderStage | (shaderStage: "vertex" | "fragment" | "compute" | "any", node: Node, output?: null | string, propertyName?: null | string) => null | Object | Node | |
| getAttributesArray | () => Array<…> | |
| getAttributes | () => string | |
| getVaryings | () => string | |
| getVar | (type: string, name: string, count?: null | number) => string | |
| getVars | (shaderStage: "vertex" | "fragment" | "compute" | "any") => string | |
| getUniforms | () => string | |
| getCodes | (shaderStage: "vertex" | "fragment" | "compute" | "any") => string | |
| getHash | () => string | |
| setShaderStage | (shaderStage: null | "vertex" | "fragment" | "compute" | "any") => void | |
| getShaderStage | () => null | "vertex" | "fragment" | "compute" | "any" | |
| setBuildStage | (buildStage: null | "generate" | "setup" | "analyze") => void | |
| getBuildStage | () => null | "generate" | "setup" | "analyze" | |
| buildCode | () => void | |
| addSubBuild | (subBuild: SubBuildNode) => void | |
| removeSubBuild | () => SubBuildNode | |
| getClosestSubBuild | (data: Node | Array<…> | Set<string>) => null | string | |
| getSubBuildOutput | (node: Node) => string | |
| getSubBuildProperty | (property?: string, node?: null | Node) => string | |
| prebuild | () => void | |
| build | () => NodeBuilder | |
| buildAsync | () => Promise<…> | |
| getSharedDataFromNode | (node: Node) => Object | |
| getNodeUniform | (uniformNode: NodeUniform, type: string) => Uniform | |
| format | (snippet: string, fromType: string, toType: string) => string | |
| getSignature | () => string | |
| needsPreviousData | () => boolean | |
This utility class is used in NodeBuilder as an internal cache data structure for node data.
Constructor
new NodeCache(parent?)| Parameter | Type | Default Value |
|---|---|---|
| parent? | null | NodeCache | null |
Constructs a new node cache.
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| id | number | — | |
| nodesData | WeakMap<Node, Object> | — | |
| parent | null | NodeCache | — | |
| Method | Type | |
|---|---|---|
| getData | (node: Node) => null | Object | |
| setData | (node: Node, data: Object) => void | |
NodeBuilder is going to create instances of this class during the build process of nodes. They represent user-defined, native shader code portions that are going to be injected by the builder. A dictionary of node codes is maintained in NodeBuilder#codes for this purpose.
Constructor
new NodeCode(name, type, code?)| Parameter | Type | Default Value |
|---|---|---|
| name | string | — |
| type | string | — |
| code? | string | |
Constructs a new code node.
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| name | string | — | |
| type | string | — | |
| code | string | — | |
Custom error class for node-related errors, including stack trace information.
Constructor
new NodeError(message, stackTrace?)| Parameter | Type | Default Value |
|---|---|---|
| message | any | — |
| stackTrace? | null | null |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| stackTrace | any | — | |
Extends
ErrorManagement class for updating nodes. The module tracks metrics like the elapsed time, delta time, the render and frame ID to correctly call the node update methods Node#updateBefore, Node#update and Node#updateAfter depending on the node’s configuration.
Constructor
new NodeFrame()Constructs a new node fame.
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| time | number | — | |
| deltaTime | number | — | |
| frameId | number | — | |
| renderId | number | — | |
| updateMap | WeakMap<Node, Object> | — | |
| updateBeforeMap | WeakMap<Node, Object> | — | |
| updateAfterMap | WeakMap<Node, Object> | — | |
| renderer | any | — | |
| material | any | — | |
| camera | any | — | |
| object | any | — | |
| scene | any | — | |
| lastTime | number | — | |
| Method | Type | |
|---|---|---|
| _getMaps | (referenceMap: WeakMap<…>, nodeRef: Node) => { [x: string]: WeakMap<…>; } | |
| updateBeforeNode | (node: Node) => void | |
| updateAfterNode | (node: Node) => void | |
| updateNode | (node: Node) => void | |
| update | () => void | |
Describes the input of a NodeFunction.
Constructor
new NodeFunctionInput(type, name, count?, qualifier?, isConst?)| Parameter | Type | Default Value |
|---|---|---|
| type | string | — |
| name | string | — |
| count? | null | number | null |
| qualifier? | "in" | "out" | "inout" | |
| isConst? | boolean | false |
Constructs a new node function input.
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| type | string | — | |
| name | string | — | |
| count | null | number | — | |
| qualifier | "in" | "out" | "inout" | — | |
| isConst | boolean | — | |
NodeBuilder is going to create instances of this class during the build process of nodes. They represent the final shader uniforms that are going to be generated by the builder. A dictionary of node uniforms is maintained in NodeBuilder#uniforms for this purpose.
Constructor
new NodeUniform(name, type, node)| Parameter | Type | Default Value |
|---|---|---|
| name | string | — |
| type | string | — |
| node | UniformNode | — |
Constructs a new node uniform.
| Accessor | Type | |
|---|---|---|
| get value | any | |
| set value | any | |
| get id | number | |
| get groupNode | UniformGroupNode | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isNodeUniform | boolean | — | |
| name | string | — | |
| type | string | — | |
| node | UniformNode | — | |
NodeBuilder is going to create instances of this class during the build process of nodes. They represent the final shader variables that are going to be generated by the builder. A dictionary of node variables is maintained in NodeBuilder#vars for this purpose.
Constructor
new NodeVar(name, type, readOnly?, count?)| Parameter | Type | Default Value |
|---|---|---|
| name | string | — |
| type | string | — |
| readOnly? | boolean | false |
| count? | null | number | null |
Constructs a new node variable.
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isNodeVar | boolean | — | |
| name | string | — | |
| type | string | — | |
| readOnly | boolean | — | |
| count | null | number | — | |
NodeBuilder is going to create instances of this class during the build process of nodes. They represent the final shader varyings that are going to be generated by the builder. An array of node varyings is maintained in NodeBuilder#varyings for this purpose.
Constructor
new NodeVarying(name, type, interpolationType?, interpolationSampling?)| Parameter | Type | Default Value |
|---|---|---|
| name | string | — |
| type | string | — |
| interpolationType? | null | string | null |
| interpolationSampling? | null | string | null |
Constructs a new node varying.
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| needsInterpolation | boolean | — | |
| isNodeVarying | boolean | — | |
| interpolationType | null | string | — | |
| interpolationSampling | null | string | — | |
Extends
NodeVarThis node can be used to define multiple outputs in a shader programs.
Constructor
new OutputStructNode(...members)| Parameter | Type | Default Value |
|---|---|---|
| members | ...Array<Node> | — |
Constructs a new output struct node. The constructor can be invoked with an arbitrary number of nodes representing the members.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| members | Array<Node> | — | |
| isOutputStructNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | () => string | |
| generate | (builder: any) => any | |
Extends
NodeSpecial version of PropertyNode which is used for parameters.
Constructor
new ParameterNode(nodeType, name?)| Parameter | Type | Default Value |
|---|---|---|
| nodeType | string | — |
| name? | null | string | null |
Constructs a new parameter node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isParameterNode | boolean | — | |
| Method | Type | |
|---|---|---|
| getMemberType | (builder: NodeBuilder, name: string) => string | |
| getHash | () => string | |
| generate | () => string | |
Extends
PropertyNodeThis class represents a shader property. It can be used to explicitly define a property and assign a value to it.
const threshold = property( 'float', 'threshold' ).assign( THRESHOLD );
export {}PropertyNode is used by the engine to predefined common material properties
for TSL code.
Constructor
new PropertyNode(nodeType, name?, varying?)| Parameter | Type | Default Value |
|---|---|---|
| nodeType | string | — |
| name? | null | string | null |
| varying? | boolean | false |
Constructs a new property node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| varying | boolean | — | |
| isPropertyNode | boolean | — | |
| Method | Type | |
|---|---|---|
| customCacheKey | () => number | |
| getHash | (builder: any) => string | |
| generate | (builder: any) => any | |
Extends
NodeStack is a helper for Nodes that need to produce stack-based code instead of continuous flow.
They are usually needed in cases like If, Else.
Constructor
new StackNode(parent?)| Parameter | Type | Default Value |
|---|---|---|
| parent? | null | StackNode | null |
Constructs a new stack node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| nodes | Array<Node> | — | |
| outputNode | null | Node | — | |
| parent | null | StackNode | — | |
| _currentCond | ConditionalNode | — | |
| _expressionNode | Node | — | |
| _currentNode | Node | — | |
| isStackNode | boolean | — | |
| Method | Type | |
|---|---|---|
| getElementType | (builder: any) => string | |
| generateNodeType | (builder: any) => string | |
| getMemberType | (builder: any, name: any) => string | |
| addToStack | (node: Node, index?: number) => StackNode | |
| addToStackBefore | (node: Node) => StackNode | |
| If | (boolNode: Node, method: Function) => StackNode | |
| ElseIf | (boolNode: Node, method: Function) => StackNode | |
| Else | (method: Function) => StackNode | |
| Switch | (expression: any) => StackNode | |
| Case | (...params: Array<…>) => StackNode | |
| Default | (method: Function) => StackNode | |
| setup | (builder: any) => any | |
| hasOutput | (builder: any) => null | boolean | |
| build | (builder: any, ...params: Array<…>) => null | string | Node | |
Extends
NodeClass representing a stack trace for debugging purposes.
Constructor
new StackTrace(stackMessage?)| Parameter | Type | Default Value |
|---|---|---|
| stackMessage? | null | string | Error | null |
Creates a StackTrace instance by capturing and filtering the current stack trace.
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isStackTrace | boolean | — | |
| stack | Array<{ fn: string; file: string; line: number; column: number; }> | — | |
| Method | Type | |
|---|---|---|
| getLocation | () => string | |
| getError | (message: string) => string | |
StructNode allows to create custom structures with multiple members. This can also be used to define structures in attribute and uniform data.
// Define a custom struct
const BoundingBox = struct( { min: 'vec3', max: 'vec3' } );
// Create a new instance of the struct
const bb = BoundingBox( vec3( 0 ), vec3( 1 ) ); // style 1
Cannot redeclare block-scoped variable 'bb'. (2451)const bb = BoundingBox( { min: vec3( 0 ), max: vec3( 1 ) } ); // style 2
Cannot redeclare block-scoped variable 'bb'. (2451)
// Access the struct members
const min = bb.get( 'min' );
// Assign a new value to a member
min.assign( vec3() );
export {}Constructor
new StructNode(structTypeNode, values)| Parameter | Type | Default Value |
|---|---|---|
| structTypeNode | any | — |
| values | any | — |
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| structTypeNode | any | — | |
| values | any | — | |
| isStructNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | (builder: any) => any | |
| getMemberType | (builder: any, name: any) => any | |
| _getChildren | () => Array<…> | |
| generate | (builder: any) => any | |
Extends
NodeRepresents a struct type node in the node-based system. This class is used to define and manage the layout and types of struct members. It extends the base Node class and provides methods to get the length of the struct, retrieve member types, and generate the struct type for a builder.
Constructor
new StructTypeNode(membersLayout, name?)| Parameter | Type | Default Value |
|---|---|---|
| membersLayout | Object | — |
| name? | null | string | null |
Creates an instance of StructTypeNode.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| membersLayout | Array<{ name: string; type: string; atomic: boolean; }> | — | |
| isStructLayoutNode | boolean | — | |
| Method | Type | |
|---|---|---|
| getLength | () => number | |
| getMemberType | (builder: any, name: any) => string | |
| generateNodeType | (builder: any) => any | |
| setup | (builder: any) => void | |
| generate | (builder: any) => string | |
Extends
NodeThis node is used to build a sub-build in the node system.
Constructor
new SubBuildNode(node, name, nodeType?)| Parameter | Type | Default Value |
|---|---|---|
| node | any | — |
| name | any | — |
| nodeType? | null | null |
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| node | Node | — | |
| isSubBuildNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | (builder: any) => string | |
| build | (builder: any, ...params: Array<…>) => null | string | Node | |
Extends
NodeThis module uses cache management to create temporary variables if the node is used more than once to prevent duplicate calculations.
The class acts as a base class for many other nodes types.
Constructor
new TempNode(nodeType?)| Parameter | Type | Default Value |
|---|---|---|
| nodeType? | null | string | null |
Constructs a temp node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isTempNode | boolean | — | |
| Method | Type | |
|---|---|---|
| hasDependencies | (builder: NodeBuilder) => boolean | |
| build | (builder: any, output: any) => any | |
Extends
NodeThis node can be used to group single instances of UniformNode and manage them as a uniform buffer.
In most cases, the predefined nodes objectGroup, renderGroup and frameGroup
will be used when defining the UniformNode#groupNode property.
-
objectGroup: Uniform buffer per object. -
renderGroup: Shared uniform buffer, updated once per render call. -
frameGroup: Shared uniform buffer, updated once per frame.
Constructor
new UniformGroupNode(name, shared?, order?, updateType?)| Parameter | Type | Default Value |
|---|---|---|
| name | string | — |
| shared? | boolean | false |
| order? | number | 1 |
| updateType? | null | string | null |
Constructs a new uniform group node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| shared | boolean | — | |
| order | number | — | |
| isUniformGroup | boolean | — | |
| Method | Type | |
|---|---|---|
| update | () => void | |
| serialize | (data: Object) => void | |
| deserialize | (data: Object) => void | |
Extends
NodeClass for representing a uniform.
Constructor
new UniformNode(value, nodeType?)| Parameter | Type | Default Value |
|---|---|---|
| value | any | — |
| nodeType? | null | string | null |
Constructs a new uniform node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isUniformNode | boolean | — | |
| groupNode | UniformGroupNode | — | |
| Method | Type | |
|---|---|---|
| setName | (name: string) => UniformNode | |
| label | (name: string) => UniformNode | |
| setGroup | (group: UniformGroupNode) => UniformNode | |
| getGroup | () => UniformGroupNode | |
| getUniformHash | (builder: NodeBuilder) => string | |
| onUpdate | (callback: any, updateType: any) => Node | |
| getInputType | (builder: any) => string | |
| generate | (builder: any, output: any) => any | |
Extends
InputNodeClass for representing shader variables as nodes. Variables are created from existing nodes like the following:
const depth = sampleDepth( uvNode ).toVar( 'depth' );
export {}Constructor
new VarNode(node, name?, readOnly?)| Parameter | Type | Default Value |
|---|---|---|
| node | Node | — |
| name? | null | string | null |
| readOnly? | boolean | false |
Constructs a new variable node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| node | Node | — | |
| isVarNode | boolean | — | |
| readOnly | boolean | — | |
| intent | boolean | — | |
| Method | Type | |
|---|---|---|
| setIntent | (value: boolean) => VarNode | |
| isIntent | (builder: NodeBuilder) => boolean | |
| getIntent | () => boolean | |
| getMemberType | (builder: any, name: any) => string | |
| getElementType | (builder: any) => string | |
| generateNodeType | (builder: any) => string | |
| getArrayCount | (builder: any) => null | number | |
| isAssign | (builder: any) => any | |
| build | (...params: Array<…>) => null | string | Node | |
| generate | (builder: any) => any | |
| _hasStack | (builder: any) => boolean | |
Extends
NodeClass for representing shader varyings as nodes. Varyings are create from existing nodes like the following:
const positionLocal = positionGeometry.toVarying( 'vPositionLocal' );
export {}Constructor
new VaryingNode(node, name?)| Parameter | Type | Default Value |
|---|---|---|
| node | Node | — |
| name? | null | string | null |
Constructs a new varying node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| node | Node | — | |
| isVaryingNode | boolean | — | |
| interpolationType | null | string | — | |
| interpolationSampling | null | string | — | |
| Method | Type | |
|---|---|---|
| setInterpolation | (type: string, sampling?: null | string) => VaryingNode | |
| getHash | (builder: any) => string | |
| generateNodeType | (builder: any) => string | |
| setupVarying | (builder: NodeBuilder) => NodeVarying | |
| setup | (builder: any) => void | |
| analyze | (builder: any) => void | |
| generate | (builder: any) => any | |
Extends
NodeThis class can be used for applying bump maps to materials.
material.normalNode = bumpMap( texture( bumpTex ) );
export {}Constructor
new BumpMapNode(textureNode, scaleNode?)| Parameter | Type | Default Value |
|---|---|---|
| textureNode | Node<float> | — |
| scaleNode? | any | null |
Constructs a new bump map node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| textureNode | any | — | |
| scaleNode | any | — | |
| Method | Type | |
|---|---|---|
| setup | () => void | |
Extends
TempNodeThis node represents a color space conversion. Meaning it converts a color value from a source to a target color space.
Constructor
new ColorSpaceNode(colorNode, source, target)| Parameter | Type | Default Value |
|---|---|---|
| colorNode | Node | — |
| source | string | — |
| target | string | — |
Constructs a new color space node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| colorNode | Node | — | |
| source | string | — | |
| target | string | — | |
| Method | Type | |
|---|---|---|
| resolveColorSpace | (builder: NodeBuilder, colorSpace: string) => string | |
| setup | (builder: any) => Node | |
Extends
TempNodeThis node can be used to evaluate whether a primitive is front or back facing.
Constructor
new FrontFacingNode()Constructs a new front facing node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isFrontFacingNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generate | (builder: any) => any | |
Extends
NodeThis class can be used for applying normals maps to materials.
material.normalNode = normalMap( texture( normalTex ) );
export {}Constructor
new NormalMapNode(node, scaleNode?)| Parameter | Type | Default Value |
|---|---|---|
| node | Node<vec3> | — |
| scaleNode? | any | null |
Constructs a new normal map node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| node | any | — | |
| scaleNode | any | — | |
| normalMapType | number | — | |
| unpackNormalMode | string | — | |
| Method | Type | |
|---|---|---|
| setup | (builder: any) => any | |
Extends
TempNodeRepresents a render pass (sometimes called beauty pass) in context of post processing. This pass produces a render for the given scene and camera and can provide multiple outputs via MRT for further processing.
const postProcessing = new RenderPipeline( renderer );
const scenePass = pass( scene, camera );
postProcessing.outputNode = scenePass;
export {}Constructor
new PassNode(scope, scene, camera, options?)| Parameter | Type | Default Value |
|---|---|---|
| scope | "color" | "depth" | — |
| scene | Scene | — |
| camera | Camera | — |
| options? | Object | {} |
Constructs a new pass node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| scope | "color" | "depth" | — | |
| scene | Scene | — | |
| camera | Camera | — | |
| options | Object | — | |
| _pixelRatio | number | — | |
| _width | number | — | |
| _height | number | — | |
| renderTarget | RenderTarget | — | |
| overrideMaterial | any | — | |
| transparent | boolean | — | |
| opaque | boolean | — | |
| contextNode | any | — | |
| _contextNodeCache | null | Object | — | |
| _textures | { [x: string]: Texture; } | — | |
| _textureNodes | { [x: string]: TextureNode; } | — | |
| _linearDepthNodes | Object | — | |
| _viewZNodes | Object | — | |
| _previousTextures | { [x: string]: Texture; } | — | |
| _previousTextureNodes | { [x: string]: TextureNode; } | — | |
| _cameraNear | UniformNode | — | |
| _cameraFar | UniformNode | — | |
| _mrt | any | — | |
| _layers | any | — | |
| _resolutionScale | number | — | |
| _viewport | null | Vector4 | — | |
| _scissor | null | Vector4 | — | |
| isPassNode | boolean | — | |
| Method | Type | |
|---|---|---|
| setResolutionScale | (resolutionScale: number) => PassNode | |
| getResolutionScale | () => number | |
| setResolution | (resolution: number) => PassNode | |
| getResolution | () => number | |
| setLayers | (layers: Layers) => PassNode | |
| getLayers | () => any | |
| setMRT | (mrt: MRTNode) => PassNode | |
| getMRT | () => MRTNode | |
| getTexture | (name: string) => Texture | |
| getPreviousTexture | (name: string) => Texture | |
| toggleTexture | (name: string) => void | |
| getTextureNode | (name?: string) => TextureNode | |
| getPreviousTextureNode | (name?: string) => TextureNode | |
| getViewZNode | (name?: string) => Node | |
| getLinearDepthNode | (name?: string) => Node | |
| compileAsync | (renderer: Renderer) => Promise<…> | |
| setup | ({ renderer }: { renderer: any; }) => Node | TextureNode | |
| updateBefore | (frame: any) => void | |
| setSize | (width: number, height: number) => void | |
| setScissor | (x: null | number | Vector4, y: number, width: number, height: number) => void | |
| setViewport | (x: number | Vector4, y: number, width: number, height: number) => void | |
| setPixelRatio | (pixelRatio: number) => void | |
| dispose | () => void | |
Extends
TempNodeNormally, tone mapping and color conversion happens automatically just
before outputting a pixel to the default (screen) framebuffer. In certain
post processing setups this is too late because some effects such as FXAA
require e.g. sRGB input. For such scenarios, RenderOutputNode can be used
to apply tone mapping and color space conversion at an arbitrary point
in the effect chain.
When applying tone mapping and color space conversion manually with this node,
you have to set RenderPipeline#outputColorTransform to false.
const postProcessing = new RenderPipeline( renderer );
postProcessing.outputColorTransform = false;
const scenePass = pass( scene, camera );
const outputPass = renderOutput( scenePass );
postProcessing.outputNode = outputPass;
export {}Constructor
new RenderOutputNode(colorNode, toneMapping, outputColorSpace)| Parameter | Type | Default Value |
|---|---|---|
| colorNode | Node | — |
| toneMapping | null | number | — |
| outputColorSpace | null | string | — |
Constructs a new render output node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| colorNode | Node | — | |
| _toneMapping | null | number | — | |
| outputColorSpace | null | string | — | |
| isRenderOutputNode | boolean | — | |
| Method | Type | |
|---|---|---|
| setToneMapping | (value: number) => ToneMappingNode | |
| getToneMapping | () => number | |
| setup | ({ context }: { context: any; }) => Node | |
Extends
TempNodeThis node provides a collection of screen related metrics. Depending on ScreenNode#scope, the nodes can represent resolution or viewport data as well as fragment or uv coordinates.
Constructor
new ScreenNode(scope)| Parameter | Type | Default Value |
|---|---|---|
| scope | "size" | "coordinate" | "viewport" | "uv" | "dpr" | — |
Constructs a new screen node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| scope | "size" | "coordinate" | "viewport" | "uv" | "dpr" | — | |
| _output | null | Node | — | |
| isViewportNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | () => "float" | "vec2" | "vec4" | |
| getUpdateType | () => { NONE: string; FRAME: string; RENDER: string; OBJECT: string; } | |
| update | ({ renderer }: NodeFrame) => void | |
| setup | () => any | |
| generate | (builder: any) => any | |
Extends
NodeThis node represents a tone mapping operation.
Constructor
new ToneMappingNode(toneMapping, exposureNode?, colorNode?)| Parameter | Type | Default Value |
|---|---|---|
| toneMapping | number | — |
| exposureNode? | Node | toneMappingExposure |
| colorNode? | Node | null |
Constructs a new tone mapping node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| _toneMapping | number | — | |
| exposureNode | Node | — | |
| colorNode | null | Node | — | |
| Method | Type | |
|---|---|---|
| customCacheKey | () => number | |
| setToneMapping | (value: number) => ToneMappingNode | |
| getToneMapping | () => number | |
| setup | (builder: any) => any | |
Extends
TempNodeRepresents a render pass for producing a toon outline effect on compatible objects.
Only 3D objects with materials of type MeshToonMaterial and MeshToonNodeMaterial
will receive the outline.
const postProcessing = new RenderPipeline( renderer );
const scenePass = toonOutlinePass( scene, camera );
postProcessing.outputNode = scenePass;
export {}Constructor
new ToonOutlinePassNode(scene, camera, colorNode, thicknessNode, alphaNode)| Parameter | Type | Default Value |
|---|---|---|
| scene | Scene | — |
| camera | Camera | — |
| colorNode | Node | — |
| thicknessNode | Node | — |
| alphaNode | Node | — |
Constructs a new outline pass node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| colorNode | Node | — | |
| thicknessNode | Node | — | |
| alphaNode | Node | — | |
| _materialCache | WeakMap<Material, NodeMaterial> | — | |
| Method | Type | |
|---|---|---|
| updateBefore | (frame: any) => void | |
| _createMaterial | () => NodeMaterial | |
| _getOutlineMaterial | (originalMaterial: any) => NodeMaterial | |
Extends
PassNodeThis node offers a collection of features in context of the depth logic in the fragment shader. Depending on ViewportDepthNode#scope, it can be used to define a depth value for the current fragment or for depth evaluation purposes.
Constructor
new ViewportDepthNode(scope, valueNode?)| Parameter | Type | Default Value |
|---|---|---|
| scope | "depth" | "depthBase" | "linearDepth" | — |
| valueNode? | null | Node | null |
Constructs a new viewport depth node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| scope | "depth" | "depthBase" | "linearDepth" | — | |
| valueNode | null | Node | — | |
| isViewportDepthNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generate | (builder: any) => any | |
| setup | ({ camera }: { camera: any; }) => any | |
Extends
NodeRepresents the depth of the current viewport as a texture. This module can be used in combination with viewport texture to achieve effects that require depth evaluation.
Constructor
new ViewportDepthTextureNode(uvNode?, levelNode?, depthTexture?)| Parameter | Type | Default Value |
|---|---|---|
| uvNode? | Node | screenUV |
| levelNode? | null | Node | null |
| depthTexture? | null | DepthTexture | null |
Constructs a new viewport depth texture node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Extends
ViewportTextureNodeA special type of texture node which represents the data of the current viewport
as a texture. The module extracts data from the current bound framebuffer with
a copy operation so no extra render pass is required to produce the texture data
(which is good for performance). ViewportTextureNode can be used as an input for a
variety of effects like refractive or transmissive materials.
Constructor
new ViewportTextureNode(uvNode?, levelNode?, framebufferTexture?)| Parameter | Type | Default Value |
|---|---|---|
| uvNode? | Node | screenUV |
| levelNode? | null | Node | null |
| framebufferTexture? | any | null |
Constructs a new viewport texture node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| generateMipmaps | boolean | — | |
| defaultFramebuffer | FramebufferTexture | — | |
| isOutputTextureNode | boolean | — | |
| _cacheTextures | WeakMap<RenderTarget, FramebufferTexture> | — | |
| Method | Type | |
|---|---|---|
| getTextureForReference | (reference?: any) => Texture | |
| updateReference | (frame: any) => Texture | |
| updateBefore | (frame: any) => void | |
| clone | () => any | |
Extends
TextureNodeRepresents the lighting model for a phong material. Used in MeshPhongNodeMaterial.
Constructor
new PhongLightingModel(specular?)| Parameter | Type | Default Value |
|---|---|---|
| specular? | boolean | true |
Constructs a new phong lighting model.
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| specular | boolean | — | |
| Method | Type | |
|---|---|---|
| direct | ({ lightDirection, lightColor, reflectedLight }: Object) => void | |
| indirect | (builder: NodeBuilder) => void | |
Extends
BasicLightingModelRepresents the lighting model for a PBR material.
Constructor
new PhysicalLightingModel(clearcoat?, sheen?, iridescence?, anisotropy?, transmission?, dispersion?)| Parameter | Type | Default Value |
|---|---|---|
| clearcoat? | boolean | false |
| sheen? | boolean | false |
| iridescence? | boolean | false |
| anisotropy? | boolean | false |
| transmission? | boolean | false |
| dispersion? | boolean | false |
Constructs a new physical lighting model.
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| clearcoat | boolean | — | |
| sheen | boolean | — | |
| iridescence | boolean | — | |
| anisotropy | boolean | — | |
| transmission | boolean | — | |
| dispersion | boolean | — | |
| clearcoatRadiance | null | Node | — | |
| clearcoatSpecularDirect | null | Node | — | |
| clearcoatSpecularIndirect | null | Node | — | |
| sheenSpecularDirect | null | Node | — | |
| sheenSpecularIndirect | null | Node | — | |
| iridescenceFresnel | null | Node | — | |
| iridescenceF0 | null | Node | — | |
| iridescenceF0Dielectric | null | Node | — | |
| iridescenceF0Metallic | null | Node | — | |
| Method | Type | |
|---|---|---|
| start | (builder: NodeBuilder) => void | |
| computeMultiscattering | (singleScatter: any, multiScatter: any, specularF90: any, f0: any, iridescenceF0?: null) => void | |
| direct | ({ lightDirection, lightColor, reflectedLight }: Object) => void | |
| directRectArea | ({ lightColor, lightPosition, halfWidth, halfHeight, reflectedLight, ltc_1, ltc_2 }: Object) => void | |
| indirect | (builder: NodeBuilder) => void | |
| indirectDiffuse | (builder: NodeBuilder) => void | |
| indirectSpecular | (builder: NodeBuilder) => void | |
| ambientOcclusion | (builder: NodeBuilder) => void | |
| finish | ({ context }: NodeBuilder) => void | |
Extends
LightingModelRangeNode generates random instanced attribute data in a defined range.
An exemplary use case for this utility node is to generate random per-instance
colors:
const material = new MeshBasicNodeMaterial();
material.colorNode = range( new Color( 0x000000 ), new Color( 0xFFFFFF ) );
const mesh = new InstancedMesh( geometry, material, count );
export {}Constructor
new RangeNode(minNode?, maxNode?)| Parameter | Type | Default Value |
|---|---|---|
| minNode? | Node<any> | float() |
| maxNode? | Node<any> | float() |
Constructs a new range node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| minNode | any | — | |
| maxNode | any | — | |
| Method | Type | |
|---|---|---|
| getVectorLength | (builder: NodeBuilder) => number | |
| generateNodeType | (builder: NodeBuilder) => string | |
| getConstNode | (node: Node) => Node | |
| setup | (builder: any) => any | |
Extends
NodeAtomicFunctionNode represents any function that can operate on atomic variable types
within a shader. In an atomic function, any modification to an atomic variable will
occur as an indivisible step with a defined order relative to other modifications.
Accordingly, even if multiple atomic functions are modifying an atomic variable at once
atomic operations will not interfere with each other.
This node can only be used with a WebGPU backend.
Constructor
new AtomicFunctionNode(method, pointerNode, valueNode)| Parameter | Type | Default Value |
|---|---|---|
| method | string | — |
| pointerNode | Node | — |
| valueNode | Node | — |
Constructs a new atomic function node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| method | string | — | |
| pointerNode | Node | — | |
| valueNode | Node | — | |
| Method | Type | |
|---|---|---|
| getInputType | (builder: NodeBuilder) => string | |
| generateNodeType | (builder: NodeBuilder) => string | |
| generate | (builder: any) => any | |
Extends
NodeRepresents a GPU control barrier that synchronizes compute operations within a given scope.
This node can only be used with a WebGPU backend.
Constructor
new BarrierNode(scope)| Parameter | Type | Default Value |
|---|---|---|
| scope | string | — |
Constructs a new barrier node.
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| scope | string | — | |
| isBarrierNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generate | (builder: any) => void | |
Extends
NodeComputeBuiltinNode represents a compute-scope builtin value that expose information
about the currently running dispatch and/or the device it is running on.
This node can only be used with a WebGPU backend.
Constructor
new ComputeBuiltinNode(builtinName, nodeType)| Parameter | Type | Default Value |
|---|---|---|
| builtinName | string | — |
| nodeType | string | — |
Constructs a new compute builtin node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| _builtinName | string | — | |
| Method | Type | |
|---|---|---|
| getHash | (builder: NodeBuilder) => string | |
| generateNodeType | () => string | |
| setBuiltinName | (builtinName: string) => ComputeBuiltinNode | |
| getBuiltinName | () => string | |
| hasBuiltin | (builder: NodeBuilder) => boolean | |
| generate | (builder: any, output: any) => any | |
| serialize | (data: any) => void | |
| deserialize | (data: any) => void | |
Extends
NodeRepresents a compute shader node.
Constructor
new ComputeNode(computeNode, workgroupSize)| Parameter | Type | Default Value |
|---|---|---|
| computeNode | Node | — |
| workgroupSize | Array<number> | — |
Constructs a new compute node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isComputeNode | boolean | — | |
| computeNode | Node | — | |
| workgroupSize | Array<number> | — | |
| count | number | Array<number> | — | |
| dispatchSize | number | Array<number> | — | |
| onInitFunction | null | Function | — | |
| countNode | any | — | |
| Method | Type | |
|---|---|---|
| dispose | () => void | |
| setName | (name: string) => ComputeNode | |
| label | (name: string) => ComputeNode | |
| onInit | (callback: Function) => ComputeNode | |
| updateBefore | ({ renderer }: NodeFrame) => void | |
| setup | (builder: any) => null | string | Node | |
| generate | (builder: any, output: any) => any | |
Extends
NodeThis class represents a set of built in WGSL shader functions that sync synchronously execute an operation across a subgroup, or ‘warp’, of compute or fragment shader invocations within a workgroup. Typically, these functions will synchronously execute an operation using data from all active invocations within the subgroup, then broadcast that result to all active invocations. In other graphics APIs, subgroup functions are also referred to as wave intrinsics (DirectX/HLSL) or warp intrinsics (CUDA).
Constructor
new SubgroupFunctionNode(method, aNode?, bNode?)| Parameter | Type | Default Value |
|---|---|---|
| method | string | — |
| aNode? | Node | null |
| bNode? | Node | null |
Constructs a new function node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| method | string | — | |
| aNode | Node | — | |
| bNode | Node | — | |
| Method | Type | |
|---|---|---|
| getInputType | (builder: any) => any | |
| generateNodeType | (builder: any) => any | |
| generate | (builder: any, output: any) => any | |
| serialize | (data: any) => void | |
| deserialize | (data: any) => void | |
Extends
TempNodeA node allowing the user to create a ‘workgroup’ scoped buffer within the context of a compute shader. Typically, workgroup scoped buffers are created to hold data that is transferred from a global storage scope into a local workgroup scope. For invocations within a workgroup, data access speeds on ‘workgroup’ scoped buffers can be significantly faster than similar access operations on globally accessible storage buffers.
This node can only be used with a WebGPU backend.
Constructor
new WorkgroupInfoNode(scope, bufferType, bufferCount?)| Parameter | Type | Default Value |
|---|---|---|
| scope | string | — |
| bufferType | string | — |
| bufferCount? | number | 0 |
Constructs a new buffer scoped to type scope.
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| bufferType | string | — | |
| bufferCount | number | — | |
| isWorkgroupInfoNode | boolean | — | |
| elementType | string | — | |
| scope | string | — | |
| Method | Type | |
|---|---|---|
| setName | (name: string) => WorkgroupInfoNode | |
| label | (name: string) => WorkgroupInfoNode | |
| setScope | (scope: string) => WorkgroupInfoNode | |
| getElementType | () => string | |
| getInputType | () => string | |
| element | (indexNode: IndexNode) => WorkgroupInfoElementNode | |
| generate | (builder: any) => any | |
Extends
NodeModule for representing ambient lights as nodes.
Constructor
new AmbientLightNode(light?)| Parameter | Type | Default Value |
|---|---|---|
| light? | any | null |
Constructs a new ambient light node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
| Method | Type | |
|---|---|---|
| setup | ({ context }: { context: any; }) => void | |
Extends
AnalyticLightNodeBase class for analytic light nodes.
Constructor
new AnalyticLightNode(light?)| Parameter | Type | Default Value |
|---|---|---|
| light? | any | null |
Constructs a new analytic light node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| light | any | — | |
| color | Color | — | |
| colorNode | Node | — | |
| baseColorNode | null | Node | — | |
| shadowNode | any | — | |
| shadowColorNode | null | Node | — | |
| isAnalyticLightNode | boolean | — | |
| _shadowDisposeListener | () => void | — | |
| Method | Type | |
|---|---|---|
| dispose | () => void | |
| disposeShadow | () => void | |
| getHash | () => any | |
| getLightVector | (builder: NodeBuilder) => any | |
| setupDirect | () => undefined | Object | |
| setupDirectRectArea | () => undefined | Object | |
| setupShadowNode | () => ShadowNode | |
| setupShadow | (builder: NodeBuilder) => void | |
| setup | (builder: NodeBuilder) => void | |
| update | () => void | |
Extends
LightingNodeA generic class that can be used by nodes which contribute ambient occlusion to the scene. E.g. an ambient occlusion map node can be used as input for this module. Used in NodeMaterial.
Constructor
new AONode(aoNode?)| Parameter | Type | Default Value |
|---|---|---|
| aoNode? | any | null |
Constructs a new AO node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| aoNode | any | — | |
| Method | Type | |
|---|---|---|
| setup | (builder: any) => void | |
Extends
LightingNodeRepresents a basic model for Image-based lighting (IBL). The environment
is defined via environment maps in the equirectangular or cube map format.
BasicEnvironmentNode is intended for non-PBR materials like MeshBasicNodeMaterial
or MeshPhongNodeMaterial.
Constructor
new BasicEnvironmentNode(envNode?)| Parameter | Type | Default Value |
|---|---|---|
| envNode? | Node | null |
Constructs a new basic environment node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| envNode | Node | — | |
| Method | Type | |
|---|---|---|
| setup | (builder: any) => void | |
Extends
LightingNodeA specific version of IrradianceNode that is only relevant for MeshBasicNodeMaterial. Since the material is unlit, it requires a special scaling factor for the light map.
Constructor
new BasicLightMapNode(lightMapNode?)| Parameter | Type | Default Value |
|---|---|---|
| lightMapNode? | any | null |
Constructs a new basic light map node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| lightMapNode | any | — | |
| Method | Type | |
|---|---|---|
| setup | (builder: any) => void | |
Extends
LightingNodeModule for representing directional lights as nodes.
Constructor
new DirectionalLightNode(light?)| Parameter | Type | Default Value |
|---|---|---|
| light? | any | null |
Constructs a new directional light node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
| Method | Type | |
|---|---|---|
| setupDirect | () => { lightDirection: any; lightColor: Node; } | |
Extends
AnalyticLightNodeRepresents a physical model for Image-based lighting (IBL). The environment
is defined via environment maps in the equirectangular, cube map or cubeUV (PMREM) format.
EnvironmentNode is intended for PBR materials like MeshStandardNodeMaterial.
Constructor
new EnvironmentNode(envNode?)| Parameter | Type | Default Value |
|---|---|---|
| envNode? | Node | null |
Constructs a new environment node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| envNode | null | Node | — | |
| Method | Type | |
|---|---|---|
| setup | (builder: any) => void | |
| _getPMREMNodeCache | (renderer: Renderer) => WeakMap<…> | |
Extends
LightingNodeModule for representing hemisphere lights as nodes.
Constructor
new HemisphereLightNode(light?)| Parameter | Type | Default Value |
|---|---|---|
| light? | any | null |
Constructs a new hemisphere light node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| lightPositionNode | UniformNode<vec3> | — | |
| lightDirectionNode | any | — | |
| groundColorNode | UniformNode<vec3> | — | |
| Method | Type | |
|---|---|---|
| update | (frame: NodeFrame) => void | |
| setup | (builder: any) => void | |
Extends
AnalyticLightNodeAn IES version of the default spot light node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
| Method | Type | |
|---|---|---|
| getSpotAttenuation | (builder: NodeBuilder, angleCosine: Node<…>) => any | |
Extends
SpotLightNodeA generic class that can be used by nodes which contribute irradiance to the scene. E.g. a light map node can be used as input for this module. Used in NodeMaterial.
Constructor
new IrradianceNode(node)| Parameter | Type | Default Value |
|---|---|---|
| node | Node<vec3> | — |
Constructs a new irradiance node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| node | any | — | |
| Method | Type | |
|---|---|---|
| setup | (builder: any) => void | |
Extends
LightingNodeLightingContextNode represents an extension of the ContextNode module
by adding lighting specific context data. It represents the runtime context of
LightsNode.
Constructor
new LightingContextNode(lightsNode, lightingModel?, backdropNode?, backdropAlphaNode?)| Parameter | Type | Default Value |
|---|---|---|
| lightsNode | LightsNode | — |
| lightingModel? | any | null |
| backdropNode? | any | null |
| backdropAlphaNode? | any | null |
Constructs a new lighting context node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| lightingModel | any | — | |
| backdropNode | any | — | |
| backdropAlphaNode | any | — | |
| _value | null | { radiance: Node<any>; irradiance: Node<any>; iblIrradiance: Node<any>; ambientOcclusion: Node<any>; reflectedLight: { directDiffuse: Node<any>; directSpecular: Node<any>; indirectDiffuse: Node<any>; indirectSpecular: Node<any>; }; backdrop: Node<any>; backdropAlpha: Node<any>; } | — | |
| Method | Type | |
|---|---|---|
| getContext | () => { radiance: Node<…>; irradiance: Node<any>; iblIrradiance: Node<any>; ambientOcclusion: Node<any>; reflectedLight: { directDiffuse: Node<any>; directSpecular: Node<any>; indirectDiffuse: Node<any>; indirectSpecular: Node<any>; }; backdrop: Node<any>; backdropAlpha: Node<any>; } | |
| setup | (builder: any) => void | |
Extends
ContextNodeBase class for lighting nodes.
Constructor
new LightingNode()Constructs a new lighting node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isLightingNode | boolean | — | |
Extends
NodeModule for representing light probes as nodes.
Constructor
new LightProbeNode(light?)| Parameter | Type | Default Value |
|---|---|---|
| light? | any | null |
Constructs a new light probe node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| lightProbe | UniformArrayNode | — | |
| Method | Type | |
|---|---|---|
| update | (frame: NodeFrame) => void | |
| setup | (builder: any) => void | |
Extends
AnalyticLightNodeThis node represents the scene’s lighting and manages the lighting model’s life cycle for the current build 3D object. It is responsible for computing the total outgoing light in a given lighting context.
Constructor
new LightsNode()Constructs a new lights node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
| get hasLights | boolean | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| totalDiffuseNode | any | — | |
| totalSpecularNode | any | — | |
| outgoingLightNode | any | — | |
| _lights | Array<Light> | — | |
| _lightNodes | null | Array<LightingNode> | — | |
| _lightNodesHash | null | string | — | |
| Method | Type | |
|---|---|---|
| customCacheKey | () => number | |
| getHash | (builder: NodeBuilder) => string | |
| analyze | (builder: any) => void | |
| setupLightsNode | (builder: NodeBuilder) => void | |
| setupDirectLight | (builder: Object, lightNode: Object, lightData: Object) => void | |
| setupDirectRectAreaLight | (builder: any, lightNode: any, lightData: any) => void | |
| setupLights | (builder: NodeBuilder, lightNodes: Array<…>) => void | |
| getLightNodes | (builder: any) => null | Array<…> | |
| setup | (builder: NodeBuilder) => any | |
| setLights | (lights: Array<…>) => LightsNode | |
| getLights | () => Array<…> | |
Extends
NodeModule for representing point lights as nodes.
Constructor
new PointLightNode(light?)| Parameter | Type | Default Value |
|---|---|---|
| light? | any | null |
Constructs a new point light node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| cutoffDistanceNode | UniformNode<float> | — | |
| decayExponentNode | UniformNode<float> | — | |
| Method | Type | |
|---|---|---|
| update | (frame: NodeFrame) => void | |
| setupShadowNode | () => PointShadowNode | |
| setupDirect | (builder: any) => { lightDirection: any; lightColor: any; } | |
Extends
AnalyticLightNodeRepresents the shadow implementation for point light nodes.
Constructor
new PointShadowNode(light, shadow?)| Parameter | Type | Default Value |
|---|---|---|
| light | PointLight | — |
| shadow? | any | null |
Constructs a new point shadow node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
| Method | Type | |
|---|---|---|
| getShadowFilterFn | (type: number) => Function | |
| setupShadowCoord | (builder: NodeBuilder, shadowPosition: Node<…>) => any | |
| setupShadowFilter | (builder: NodeBuilder, { filterFn, depthTexture, shadowCoord, shadow }: { filterFn: Function; depthTexture: DepthTexture; shadowCoord: Node<…>; shadow: LightShadow; }) => any | |
| setupRenderTarget | (shadow: LightShadow, builder: NodeBuilder) => Object | |
| renderShadow | (frame: NodeFrame) => void | |
Extends
ShadowNodeAn implementation of a projector light node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
| Method | Type | |
|---|---|---|
| update | (frame: any) => void | |
| getSpotAttenuation | (builder: NodeBuilder) => any | |
Extends
SpotLightNodeModule for representing rect area lights as nodes.
Constructor
new RectAreaLightNode(light?)| Parameter | Type | Default Value |
|---|---|---|
| light? | any | null |
Constructs a new rect area light node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| halfHeight | UniformNode<vec3> | — | |
| halfWidth | UniformNode<vec3> | — | |
| Method | Type | |
|---|---|---|
| update | (frame: NodeFrame) => void | |
| setupDirectRectArea | (builder: any) => { lightColor: Node; lightPosition: UniformNode<…>; halfWidth: UniformNode<vec3>; halfHeight: UniformNode<vec3>; ltc_1: TextureNode; ltc_2: TextureNode; } | |
| setLTC | (ltc: RectAreaLightTexturesLib) => void | |
Extends
AnalyticLightNodeBase class for all shadow nodes.
Shadow nodes encapsulate shadow related logic and are always coupled to lighting nodes. Lighting nodes might share the same shadow node type or use specific ones depending on their requirements.
Constructor
new ShadowBaseNode(light)| Parameter | Type | Default Value |
|---|---|---|
| light | Light | — |
Constructs a new shadow base node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| light | Light | — | |
| isShadowBaseNode | boolean | — | |
| Method | Type | |
|---|---|---|
| setupShadowPosition | ({ context, material }: NodeBuilder) => void | |
Extends
NodeRepresents the default shadow implementation for lighting nodes.
Constructor
new ShadowNode(light, shadow?)| Parameter | Type | Default Value |
|---|---|---|
| light | Light | — |
| shadow? | any | null |
Constructs a new shadow node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| shadow | any | — | |
| shadowMap | any | — | |
| vsmShadowMapVertical | any | — | |
| vsmShadowMapHorizontal | any | — | |
| vsmMaterialVertical | null | NodeMaterial | — | |
| vsmMaterialHorizontal | null | NodeMaterial | — | |
| _node | null | Node | — | |
| _currentShadowType | null | number | — | |
| _cameraFrameId | WeakMap<Camera, number> | — | |
| isShadowNode | boolean | — | |
| depthLayer | number | — | |
| _depthVersionCached | any | — | |
| Method | Type | |
|---|---|---|
| setupShadowFilter | (builder: NodeBuilder, { filterFn, depthTexture, shadowCoord, shadow, depthLayer }: { filterFn: Function; depthTexture: DepthTexture; shadowCoord: Node<…>; shadow: LightShadow; }) => any | |
| setupShadowCoord | (builder: NodeBuilder, shadowPosition: Node<…>) => any | |
| getShadowFilterFn | (type: number) => Function | |
| setupRenderTarget | (shadow: any, builder: any) => { shadowMap: any; depthTexture: DepthTexture; } | |
| setupShadow | (builder: NodeBuilder) => any | |
| setup | (builder: NodeBuilder) => ShaderCallNodeInternal | |
| renderShadow | (frame: NodeFrame) => void | |
| updateShadow | (frame: NodeFrame) => void | |
| vsmPass | (renderer: Renderer) => void | |
| dispose | () => void | |
| _reset | () => void | |
| updateBefore | (frame: NodeFrame) => void | |
Extends
ShadowBaseNodeModule for representing spot lights as nodes.
Constructor
new SpotLightNode(light?)| Parameter | Type | Default Value |
|---|---|---|
| light? | any | null |
Constructs a new spot light node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| coneCosNode | UniformNode<float> | — | |
| penumbraCosNode | UniformNode<float> | — | |
| cutoffDistanceNode | UniformNode<float> | — | |
| decayExponentNode | UniformNode<float> | — | |
| Method | Type | |
|---|---|---|
| update | (frame: NodeFrame) => void | |
| getSpotAttenuation | (builder: NodeBuilder, angleCosine: Node<…>) => any | |
| getLightCoord | (builder: any) => any | |
| setupDirect | (builder: any) => { lightColor: any; lightDirection: any; } | |
Extends
AnalyticLightNodeThis node represents an operation that reinterprets the bit representation of a value in one type as a value in another type.
Constructor
new BitcastNode(valueNode, conversionType, inputType?)| Parameter | Type | Default Value |
|---|---|---|
| valueNode | Node | — |
| conversionType | string | — |
| inputType? | null | string | null |
Constructs a new bitcast node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| valueNode | Node | — | |
| conversionType | string | — | |
| inputType | string | — | |
| isBitcastNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | (builder: any) => any | |
| generate | (builder: any) => string | |
Extends
TempNodeThis node represents an operation that counts the bits of a piece of shader data.
Constructor
new BitcountNode(method, aNode)| Parameter | Type | Default Value |
|---|---|---|
| method | "countTrailingZeros" | "countLeadingZeros" | "countOneBits" | — |
| aNode | Node | — |
Constructs a new math node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isBitcountNode | boolean | — | |
| Method | Type | |
|---|---|---|
| _resolveElementType | (inputNode: any, outputNode: Node<…>, elementType: string) => void | |
| _returnDataNode | (inputType: any) => any | |
| _createTrailingZerosBaseLayout | (method: string, elementType: string) => Function | |
| _createLeadingZerosBaseLayout | (method: string, elementType: string) => Function | |
| _createOneBitsBaseLayout | (method: string, elementType: string) => Function | |
| _createMainLayout | (method: string, inputType: string, typeLength: number, baseFn: Function) => Function | |
| setup | (builder: any) => any | |
Extends
MathNodeRepresents a logical if/else statement. Can be used as an alternative
to the If()/Else() syntax.
The corresponding TSL select() looks like so:
velocity = position.greaterThanEqual( limit ).select( velocity.negate(), velocity );
export {}The select() method is called in a chaining fashion on a condition. The parameter nodes of select()
determine the outcome of the entire statement.
Constructor
new ConditionalNode(condNode, ifNode, elseNode?)| Parameter | Type | Default Value |
|---|---|---|
| condNode | Node | — |
| ifNode | Node | — |
| elseNode? | null | Node | null |
Constructs a new conditional node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| condNode | Node | — | |
| ifNode | Node | — | |
| elseNode | null | Node | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | (builder: NodeBuilder) => string | |
| setup | (builder: any) => void | |
| generate | (builder: any, output: any) => any | |
Extends
NodeThis node represents a variety of mathematical methods available in shaders. They are divided into three categories:
-
Methods with one input like
sin,cosornormalize. -
Methods with two inputs like
dot,crossorpow. -
Methods with three inputs like
mix,clamporsmoothstep.
Constructor
new MathNode(method, aNode, bNode?, cNode?, args)| Parameter | Type | Default Value |
|---|---|---|
| method | string | — |
| aNode | Node | — |
| bNode? | null | Node | null |
| cNode? | null | Node | null |
| args | Array<any> | — |
Constructs a new math node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| method | string | — | |
| aNode | Node | — | |
| bNode | null | Node | — | |
| cNode | null | Node | — | |
| isMathNode | boolean | — | |
| Method | Type | |
|---|---|---|
| getInputType | (builder: NodeBuilder) => string | |
| generateNodeType | (builder: NodeBuilder) => string | |
| setup | (builder: any) => any | |
| generate | (builder: any, output: any) => any | |
| serialize | (data: any) => void | |
| deserialize | (data: any) => void | |
Extends
TempNodeThis node represents basic mathematical and logical operations like addition,
subtraction or comparisons (e.g. equal()).
Constructor
new OperatorNode(op, aNode, bNode, ...params)| Parameter | Type | Default Value |
|---|---|---|
| op | string | — |
| aNode | Node | — |
| bNode | Node | — |
| params | ...Array<Node> | — |
Constructs a new operator node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| op | string | — | |
| aNode | Node | — | |
| bNode | Node | — | |
| isOperatorNode | boolean | — | |
| Method | Type | |
|---|---|---|
| getOperatorMethod | (builder: NodeBuilder, output: string) => string | |
| generateNodeType | (builder: NodeBuilder, output?: null | string) => string | |
| generate | (builder: any, output: any) => any | |
| serialize | (data: any) => void | |
| deserialize | (data: any) => void | |
Extends
TempNodeThis node represents an operation that packs floating-point values of a vector into an unsigned 32-bit integer
Constructor
new PackFloatNode(encoding, vectorNode)| Parameter | Type | Default Value |
|---|---|---|
| encoding | "snorm" | "unorm" | "float16" | — |
| vectorNode | Node | — |
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| vectorNode | Node | — | |
| encoding | string | — | |
| isPackFloatNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | () => string | |
| generate | (builder: any) => string | |
Extends
TempNodeThis node represents an operation that unpacks values from a 32-bit unsigned integer, reinterpreting the results as a floating-point vector
Constructor
new UnpackFloatNode(encoding, uintNode)| Parameter | Type | Default Value |
|---|---|---|
| encoding | "snorm" | "unorm" | "float16" | — |
| uintNode | Node | — |
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| uintNode | Node | — | |
| encoding | string | — | |
| isUnpackFloatNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | () => string | |
| generate | (builder: any) => string | |
Extends
TempNodeComputes a hash for the given string.
| Parameter | Type | Default Value |
|---|---|---|
| str | string | — |
Returns
numberComputes a hash for the given array.
| Parameter | Type | Default Value |
|---|---|---|
| array | Array<number> | — |
Returns
numberComputes a hash for the given list of parameters.
| Parameter | Type | Default Value |
|---|---|---|
| params | ...Array<number> | — |
Returns
numberReturns the data type for the given the length.
| Parameter | Type | Default Value |
|---|---|---|
| length | number | — |
Returns
stringReturns the typed array for the given data type.
| Parameter | Type | Default Value |
|---|---|---|
| type | string | — |
Returns
TypedArrayReturns the length for the given data type.
| Parameter | Type | Default Value |
|---|---|---|
| type | string | — |
Returns
numberReturns the gpu memory length for the given data type.
| Parameter | Type | Default Value |
|---|---|---|
| type | string | — |
Returns
numberReturns the alignment requirement for the given data type.
| Parameter | Type | Default Value |
|---|---|---|
| type | string | — |
Returns
numberReturns the data type for the given value.
| Parameter | Type | Default Value |
|---|---|---|
| value | any | — |
Returns
null | stringReturns the value/object for the given data type and parameters.
| Parameter | Type | Default Value |
|---|---|---|
| type | string | — |
| params | ...Array<any> | — |
Returns
anyGets the object data that can be shared between different rendering steps.
| Parameter | Type | Default Value |
|---|---|---|
| object | Object | — |
Returns
ObjectConverts the given array buffer to a Base64 string.
| Parameter | Type | Default Value |
|---|---|---|
| arrayBuffer | ArrayBuffer | — |
Returns
stringConverts the given Base64 string to an array buffer.
| Parameter | Type | Default Value |
|---|---|---|
| base64 | string | — |
Returns
ArrayBufferA GLSL node parser.
| Method | Type | |
|---|---|---|
| parseFunction | (source: string) => GLSLNodeFunction | |
Extends
NodeParserThis node represents a PMREM which is a special type of preprocessed environment map intended for PBR materials.
const material = new MeshStandardNodeMaterial();
material.envNode = pmremTexture( envMap );
export {}Constructor
new PMREMNode(value, uvNode?, levelNode?)| Parameter | Type | Default Value |
|---|---|---|
| value | Texture | — |
| uvNode? | Node<vec2> | null |
| levelNode? | Node<float> | null |
Constructs a new function overloading node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
| set value | Texture | |
| get value | Texture | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| _value | Texture | — | |
| _pmrem | null | Texture | — | |
| uvNode | any | — | |
| levelNode | any | — | |
| _generator | null | PMREMGenerator | — | |
| _texture | TextureNode | — | |
| _width | UniformNode<float> | — | |
| _height | UniformNode<float> | — | |
| _maxMip | UniformNode<float> | — | |
| Method | Type | |
|---|---|---|
| updateFromTexture | (texture: Texture) => void | |
| updateBefore | (frame: any) => void | |
| setup | (builder: any) => void | |
| dispose | () => void | |
Extends
TempNodeBase class for representing element access on an array-like node data structures.
Constructor
new ArrayElementNode(node, indexNode)| Parameter | Type | Default Value |
|---|---|---|
| node | Node | — |
| indexNode | Node | — |
Constructs an array element node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| node | Node | — | |
| indexNode | Node | — | |
| isArrayElementNode | boolean | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | (builder: NodeBuilder) => string | |
| getMemberType | (builder: NodeBuilder, name: string) => string | |
| generate | (builder: any) => string | |
Extends
NodeThis module is part of the TSL core and usually not used in app level code. It represents a convert operation during the shader generation process meaning it converts the data type of a node to a target data type.
Constructor
new ConvertNode(node, convertTo)| Parameter | Type | Default Value |
|---|---|---|
| node | Node | — |
| convertTo | string | — |
Constructs a new convert node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| node | Node | — | |
| convertTo | string | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | (builder: NodeBuilder) => string | |
| serialize | (data: any) => void | |
| deserialize | (data: any) => void | |
| generate | (builder: any, output: any) => any | |
Extends
NodeThis node can be used to automatically convert environment maps in the equirectangular format into the cube map format.
Constructor
new CubeMapNode(envNode)| Parameter | Type | Default Value |
|---|---|---|
| envNode | Node | — |
Constructs a new cube map node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| envNode | Node | — | |
| _cubeTexture | null | CubeTexture | — | |
| _cubeTextureNode | CubeTextureNode | — | |
| _defaultTexture | CubeTexture | — | |
| Method | Type | |
|---|---|---|
| updateBefore | (frame: any) => void | |
| setup | (builder: any) => CubeTextureNode | |
Extends
TempNodeConstructor
new DebugNode(node, callback?)| Parameter | Type | Default Value |
|---|---|---|
| node | any | — |
| callback? | null | null |
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| node | any | — | |
| callback | any | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | (builder: any) => any | |
| setup | (builder: any) => any | |
| analyze | (builder: any) => any | |
| generate | (builder: any) => any | |
Extends
TempNodeEventNode is a node that executes a callback during specific update phases.
Constructor
new EventNode(eventType, callback)| Parameter | Type | Default Value |
|---|---|---|
| eventType | string | — |
| callback | Function | — |
Creates an EventNode.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| eventType | string | — | |
| callback | Function | — | |
| updateType | string | — | |
| updateBeforeType | string | — | |
| Method | Type | |
|---|---|---|
| update | (frame: any) => void | |
| updateBefore | (frame: any) => void | |
Extends
NodeThis module is part of the TSL core and usually not used in app level code. It represents a flip operation during the shader generation process meaning it flips normalized values with the following formula:
x = 1 - x;
FlipNode is internally used to implement any flipXYZW(), flipRGBA() and
flipSTPQ() method invocations on node objects. For example:
uvNode = uvNode.flipY();
export {}Constructor
new FlipNode(sourceNode, components)| Parameter | Type | Default Value |
|---|---|---|
| sourceNode | Node | — |
| components | string | — |
Constructs a new flip node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| sourceNode | Node | — | |
| components | string | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | (builder: NodeBuilder) => string | |
| generate | (builder: any) => string | |
Extends
TempNodeThis class allows to define multiple overloaded versions of the same function. Depending on the parameters of the function call, the node picks the best-fit overloaded version.
Constructor
new FunctionOverloadingNode(functionNodes?, ...parametersNodes)| Parameter | Type | Default Value |
|---|---|---|
| functionNodes? | Array<Function> | [] |
| parametersNodes | ...Array<Node> | — |
Constructs a new function overloading node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| functionNodes | Array<Function> | — | |
| parametersNodes | Array<Node> | — | |
| _candidateFn | ShaderCallNodeInternal | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | (builder: NodeBuilder) => string | |
| getCandidateFn | (builder: NodeBuilder) => FunctionNode | |
| setup | (builder: NodeBuilder) => Node | |
Extends
NodeThis module is part of the TSL core and usually not used in app level code.
It represents a join operation during the shader generation process.
For example in can compose/join two single floats into a vec2 type.
Constructor
new JoinNode(nodes?, nodeType?)| Parameter | Type | Default Value |
|---|---|---|
| nodes? | Array<Node> | [] |
| nodeType? | null | string | null |
Constructs a new join node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| nodes | Array<Node> | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | (builder: NodeBuilder) => string | |
| generate | (builder: any, output: any) => any | |
Extends
TempNodeThis module offers a variety of ways to implement loops in TSL. In it’s basic form it’s:
Loop( count, ( { i } ) => {
} );
export {}However, it is also possible to define a start and end ranges, data types and loop conditions:
Loop( { start: int( 0 ), end: int( 10 ), type: 'int', condition: '<' }, ( { i } ) => {
} );
export {}Nested loops can be defined in a compacted form:
Loop( 10, 5, ( { i, j } ) => {
} );
export {}Loops that should run backwards can be defined like so:
Loop( { start: 10 }, () => {} );
export {}It is possible to execute with boolean values, similar to the while syntax.
const value = float( 0 ).toVar();
Loop( value.lessThan( 10 ), () => {
value.addAssign( 1 );
} );
export {}The module also provides Break() and Continue() TSL expression for loop control.
Constructor
new LoopNode(params?)| Parameter | Type | Default Value |
|---|---|---|
| params? | Array<any> | [] |
Constructs a new loop node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| params | Array<any> | — | |
| Method | Type | |
|---|---|---|
| getVarName | (index: number) => string | |
| getProperties | (builder: NodeBuilder) => Object | |
| setup | (builder: any) => void | |
| generate | (builder: any) => void | |
Extends
NodeA special type of uniform node that computes the maximum mipmap level for a given texture node.
const level = maxMipLevel( textureNode );
export {}Constructor
new MaxMipLevelNode(textureNode)| Parameter | Type | Default Value |
|---|---|---|
| textureNode | TextureNode | — |
Constructs a new max mip level node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
| get textureNode | TextureNode | |
| get texture | Texture | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| _textureNode | TextureNode | — | |
| Method | Type | |
|---|---|---|
| update | () => void | |
Extends
UniformNodeBase class for representing member access on an object-like node data structures.
Constructor
new MemberNode(structNode, property)| Parameter | Type | Default Value |
|---|---|---|
| structNode | Node | — |
| property | string | — |
Constructs a member node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| structNode | Node | — | |
| property | Node | — | |
| isMemberNode | boolean | — | |
| Method | Type | |
|---|---|---|
| hasMember | (builder: any) => boolean | |
| generateNodeType | (builder: any) => string | |
| getMemberType | (builder: any, name: any) => any | |
| generate | (builder: any) => any | |
Extends
NodeThis node can be used to implement mirror-like flat reflective surfaces.
const groundReflector = reflector();
material.colorNode = groundReflector;
const plane = new Mesh( geometry, material );
plane.add( groundReflector.target );
export {}Constructor
new ReflectorNode(parameters?)| Parameter | Type | Default Value |
|---|---|---|
| parameters? | { target?: Object3D | undefined; resolutionScale?: number | undefined; generateMipmaps?: boolean | undefined; bounces?: boolean | undefined; depth?: boolean | undefined; samples?: number | undefined; defaultTexture?: TextureNode | undefined; reflector?: ReflectorBaseNode | undefined; } | {} |
Constructs a new reflector node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
| get reflector | ReflectorBaseNode | |
| get target | Object3D | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| _reflectorBaseNode | ReflectorBaseNode | — | |
| _depthNode | null | Node | — | |
| Method | Type | |
|---|---|---|
| getDepthNode | () => Node | |
| setup | (builder: any) => void | |
| clone | () => any | |
| dispose | () => void | |
Extends
TextureNodeApplies a rotation to the given position node.
Constructor
new RotateNode(positionNode, rotationNode)| Parameter | Type | Default Value |
|---|---|---|
| positionNode | Node | — |
| rotationNode | Node | — |
Constructs a new rotate node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| positionNode | Node | — | |
| rotationNode | Node | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | (builder: NodeBuilder) => string | |
| setup | (builder: any) => any | |
Extends
TempNodeRTTNode takes another node and uses it with a QuadMesh to render into a texture (RTT).
This module is especially relevant in context of post processing where certain nodes require
texture input for their effects. With the helper function convertToTexture() which is based
on this module, the node system can automatically ensure texture input if required.
Constructor
new RTTNode(node, width?, height?, options?)| Parameter | Type | Default Value |
|---|---|---|
| node | Node | — |
| width? | null | number | null |
| height? | null | number | null |
| options? | Object | {"type":1016} |
Constructs a new RTT node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
| get autoResize | boolean | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isRTTNode | boolean | — | |
| node | Node | — | |
| width | null | number | — | |
| height | null | number | — | |
| pixelRatio | number | — | |
| renderTarget | RenderTarget | — | |
| textureNeedsUpdate | boolean | — | |
| autoUpdate | boolean | — | |
| _rttNode | Node | — | |
| _quadMesh | QuadMesh | — | |
| Method | Type | |
|---|---|---|
| setup | (builder: any) => void | |
| setSize | (width: number, height: number) => void | |
| setPixelRatio | (pixelRatio: number) => void | |
| updateBefore | ({ renderer }: { renderer: any; }) => void | |
| clone | () => TextureNode | |
Extends
TextureNodeClass representing a node that samples a value using a provided callback function.
Constructor
new SampleNode(callback, uvNode?)| Parameter | Type | Default Value |
|---|---|---|
| callback | Function | — |
| uvNode? | any | null |
Creates an instance of SampleNode.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| callback | Function | — | |
| uvNode | any | — | |
| isSampleNode | boolean | — | |
| Method | Type | |
|---|---|---|
| setup | () => Node | |
| sample | (uv: Node<…>) => Node | |
Extends
NodeThis module is part of the TSL core and usually not used in app level code.
SetNode represents a set operation which means it is used to implement any
setXYZW(), setRGBA() and setSTPQ() method invocations on node objects.
For example:
materialLine.colorNode = color( 0, 0, 0 ).setR( float( 1 ) );
export {}Constructor
new SetNode(sourceNode, components, targetNode)| Parameter | Type | Default Value |
|---|---|---|
| sourceNode | Node | — |
| components | string | — |
| targetNode | Node | — |
Constructs a new set node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| sourceNode | Node | — | |
| components | string | — | |
| targetNode | Node | — | |
| Method | Type | |
|---|---|---|
| generateNodeType | (builder: NodeBuilder) => string | |
| generate | (builder: any) => string | |
Extends
TempNodeThis module is part of the TSL core and usually not used in app level code.
SplitNode represents a property access operation which means it is
used to implement any .xyzw, .rgba and stpq usage on node objects.
For example:
const redValue = color.r;
export {}Constructor
new SplitNode(node, components?)| Parameter | Type | Default Value |
|---|---|---|
| node | Node | — |
| components? | string | x |
Constructs a new split node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| node | Node | — | |
| components | string | — | |
| isSplitNode | boolean | — | |
| Method | Type | |
|---|---|---|
| getVectorLength | () => number | |
| getComponentType | (builder: NodeBuilder) => string | |
| generateNodeType | (builder: NodeBuilder) => string | |
| getScope | () => Node | |
| generate | (builder: any, output: any) => any | |
| serialize | (data: any) => void | |
| deserialize | (data: any) => void | |
Extends
NodeThis class enables element access on instances of StorageBufferNode. In most cases, it is indirectly used when accessing elements with the StorageBufferNode#element method.
const position = positionStorage.element( instanceIndex );
export {}Constructor
new StorageArrayElementNode(storageBufferNode, indexNode)| Parameter | Type | Default Value |
|---|---|---|
| storageBufferNode | StorageBufferNode | — |
| indexNode | Node | — |
Constructs storage buffer element node.
| Accessor | Type | |
|---|---|---|
| get type | string | |
| set storageBufferNode | Node | |
| get storageBufferNode | Node | |
Properties
| Property | Type | Default Value | |
|---|---|---|---|
| isStorageArrayElementNode | boolean | — | |
| Method | Type | |
|---|---|---|
| getMemberType | (builder: any, name: any) => any | |
| setup | (builder: any) => null | Node | |
| generate | (builder: any, output: any) => any | |
Extends
ArrayElementNode