BatchNode

Last modified: Jun 30, 2024

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)
ParameterTypeDefault Value
batchMeshBatchedMesh

Constructs a new batch node.

AccessorType

Properties

PropertyTypeDefault Value
batchMeshBatchedMesh
batchingIdNodeany
MethodType

Extends

Node

BufferAttributeNode

In 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?)
ParameterTypeDefault Value
valueany
bufferType?null | stringnull
bufferStride?number0
bufferOffset?number0

Constructs a new buffer attribute node.

AccessorType

Properties

PropertyTypeDefault Value
isBufferNodeboolean
bufferTypenull | string
bufferStridenumber
bufferOffsetnumber
usagenumber
instancedboolean
attributeany
MethodType

Extends

InputNode

BufferNode

A 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?)
ParameterTypeDefault Value
valueArray<number>
bufferTypestring
bufferCount?number0

Constructs a new buffer node.

AccessorType

Properties

PropertyTypeDefault Value
isBufferNodeboolean
bufferTypestring
bufferCountnumber
updateRangesArray<{ start: number; count: number; }>
MethodType

Extends

UniformNode
N E W

BuiltinNode

The node allows to set values for built-in shader variables. That is required for features like hardware-accelerated vertex clipping.

Constructor

new BuiltinNode(name)
ParameterTypeDefault Value
namestring

Constructs a new builtin node.

Properties

PropertyTypeDefault Value
isBuiltinNodeboolean
MethodType

Extends

Node
N E W

ClippingNode

This 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?)
ParameterTypeDefault Value
scope?"default" | "hardware" | "alphaToCoverage"ClippingNode.DEFAULT

Constructs a new clipping node.

AccessorType

Properties

PropertyTypeDefault Value
scope"default" | "hardware" | "alphaToCoverage"
hardwareClippingany
MethodType

Extends

Node

CubeTextureNode

This type of uniform node represents a cube texture.

Constructor

new CubeTextureNode(value, uvNode?, levelNode?, biasNode?)
ParameterTypeDefault Value
valueCubeTexture
uvNode?anynull
levelNode?anynull
biasNode?anynull

Constructs a new cube texture node.

AccessorType

Properties

PropertyTypeDefault Value
isCubeTextureNodeboolean
MethodType

Extends

TextureNode

InstancedMeshNode

This 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)
ParameterTypeDefault Value
instancedMeshInstancedMesh

Constructs a new instanced mesh node.

AccessorType

Properties

PropertyTypeDefault Value
instancedMeshInstancedMesh

Extends

InstanceNode

InstanceNode

This 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?)
ParameterTypeDefault Value
countnumber
instanceMatrixany
instanceColor?anynull

Constructs a new instance node.

AccessorType

Properties

PropertyTypeDefault Value
countnumber
instanceMatrixInstancedBufferAttribute
instanceColorInstancedBufferAttribute
instanceMatrixNodenull | Node
instanceColorNodenull | Node
buffernull | InstancedInterleavedBuffer
bufferColornull | InstancedBufferAttribute
previousInstanceMatrixNodenull | Node
MethodType

Extends

Node

MaterialNode

This 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)
ParameterTypeDefault Value
scopestring

Constructs a new material node.

AccessorType

Properties

PropertyTypeDefault Value
scopestring
MethodType

Extends

Node

MaterialReferenceNode

This 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?)
ParameterTypeDefault Value
propertystring
inputTypestring
material?anynull

Constructs a new material reference node.

AccessorType

Properties

PropertyTypeDefault Value
materialany
isMaterialReferenceNodeboolean
MethodType

Extends

ReferenceNode

ModelNode

This 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)
ParameterTypeDefault Value
scope"position" | "viewPosition" | "direction" | "scale" | "worldMatrix"

Constructs a new object model node.

AccessorType
MethodType

Extends

Object3DNode

MorphNode

This node implements the vertex transformation shader logic which is required for morph target animation.

Constructor

new MorphNode(mesh)
ParameterTypeDefault Value
meshMesh

Constructs a new morph node.

AccessorType

Properties

PropertyTypeDefault Value
meshMesh
morphBaseInfluenceUniformNode<any>
MethodType

Extends

Node

Object3DNode

This 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?)
ParameterTypeDefault Value
scope"position" | "viewPosition" | "direction" | "scale" | "worldMatrix"
object3d?anynull

Constructs a new object 3D node.

AccessorType

Properties

PropertyTypeDefault Value
scope"position" | "viewPosition" | "direction" | "scale" | "worldMatrix"
object3dany
uniformNodeUniformNode
MethodType

Extends

Node

PointUVNode

A 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.

AccessorType

Properties

PropertyTypeDefault Value
isPointUVNodeboolean
MethodType

Extends

Node
N E W

ReferenceBaseNode

Base 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?)
ParameterTypeDefault Value
propertystring
uniformTypestring
object?null | Objectnull
count?null | numbernull

Constructs a new reference base node.

AccessorType

Properties

PropertyTypeDefault Value
propertystring
uniformTypestring
objectnull | Object
countnull | number
propertiesArray<string>
referencenull | Object
nodeUniformNode
groupUniformGroupNode
MethodType

Extends

Node

ReferenceNode

This 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?)
ParameterTypeDefault Value
propertystring
uniformTypestring
object?null | Objectnull
count?null | numbernull

Constructs a new reference node.

AccessorType

Properties

PropertyTypeDefault Value
propertystring
uniformTypestring
objectnull | Object
countnull | number
propertiesArray<string>
referencenull | Object
nodeUniformNode
groupUniformGroupNode
MethodType

Extends

Node

RendererReferenceNode

This 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?)
ParameterTypeDefault Value
propertystring
inputTypestring
renderer?anynull

Constructs a new renderer reference node.

AccessorType

Properties

PropertyTypeDefault Value
rendererany
MethodType

Extends

ReferenceBaseNode

SkinningNode

This node implements the vertex transformation shader logic which is required for skinning/skeletal animation.

Constructor

new SkinningNode(skinnedMesh)
ParameterTypeDefault Value
skinnedMeshSkinnedMesh

Constructs a new skinning node.

AccessorType

Properties

PropertyTypeDefault Value
skinnedMeshSkinnedMesh
skinIndexNodeAttributeNode
skinWeightNodeAttributeNode
bindMatrixNodeany
bindMatrixInverseNodeany
boneMatricesNodeNode
positionNodeany
toPositionNodeany
previousBoneMatricesNodenull | Node
MethodType

Extends

Node

StorageBufferNode

This 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?)
ParameterTypeDefault Value
valueany
bufferType?anynull
bufferCount?number0

Constructs a new storage buffer node.

AccessorType

Properties

PropertyTypeDefault Value
isStorageBufferNodeboolean
structTypeNodeany
accessstring
isAtomicboolean
isPBOboolean
_attributeany
_varyingany
MethodType

Extends

BufferNode

StorageTextureNode

This 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?)
ParameterTypeDefault Value
valueStorageTexture
uvNodeNode<vec2|vec3>
storeNode?null | Nodenull

Constructs a new storage texture node.

AccessorType

Properties

PropertyTypeDefault Value
storeNodenull | Node
mipLevelnumber
isStorageTextureNodeboolean
accessstring
MethodType

Extends

TextureNode

Texture3DNode

This type of uniform node represents a 3D texture.

Constructor

new Texture3DNode(value, uvNode?, levelNode?)
ParameterTypeDefault Value
valueData3DTexture
uvNode?anynull
levelNode?anynull

Constructs a new 3D texture node.

AccessorType

Properties

PropertyTypeDefault Value
isTexture3DNodeboolean
MethodType

Extends

TextureNode

TextureNode

This type of uniform node represents a 2D texture.

Constructor

new TextureNode(value?, uvNode?, levelNode?, biasNode?)
ParameterTypeDefault Value
value?TextureEmptyTexture
uvNode?anynull
levelNode?anynull
biasNode?anynull

Constructs a new texture node.

AccessorType

Properties

PropertyTypeDefault Value
isTextureNodeboolean
uvNodeany
levelNodeany
biasNodeany
compareNodeany
depthNodeany
gradNodenull | Array<any>
offsetNodeany
samplerboolean
updateMatrixboolean
referenceNodenull | Node
_valueTexture
_matrixUniformany
_flipYUniformany
MethodType

Extends

UniformNode

TextureSizeNode

A 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?)
ParameterTypeDefault Value
textureNodeTextureNode
levelNode?anynull

Constructs a new texture size node.

AccessorType

Properties

PropertyTypeDefault Value
isTextureSizeNodeboolean
textureNodeTextureNode
levelNodeany
MethodType

Extends

Node

UniformArrayNode

Similar 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?)
ParameterTypeDefault Value
valueArray<any>
elementType?null | stringnull

Constructs a new uniform array node.

AccessorType

Properties

PropertyTypeDefault Value
arrayArray<any>
elementTypestring
paddedTypestring
isArrayBufferNodeboolean
MethodType

Extends

BufferNode

UserDataNode

A 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?)
ParameterTypeDefault Value
propertystring
inputTypestring
userData?null | Objectnull

Constructs a new user data node.

AccessorType

Properties

PropertyTypeDefault Value
userDatanull | Object
MethodType

Extends

ReferenceNode
N E W

VelocityNode

A 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.

AccessorType

Properties

PropertyTypeDefault Value
projectionMatrixnull | Matrix4
previousModelWorldMatrixUniformNode<mat4>
previousProjectionMatrixUniformNode<mat4>
previousCameraViewMatrixUniformNode<mat4>
MethodType

Extends

TempNode

VertexColorNode

An attribute node for representing vertex colors.

Constructor

new VertexColorNode(index)
ParameterTypeDefault Value
indexnumber

Constructs a new vertex color node.

AccessorType

Properties

PropertyTypeDefault Value
isVertexColorNodeboolean
indexnumber
MethodType

Extends

AttributeNode

CodeNode

This 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?)
ParameterTypeDefault Value
code?string
includes?Array<Node>[]
language?"js" | "wgsl" | "glsl"

Constructs a new code node.

AccessorType

Properties

PropertyTypeDefault Value
isCodeNodeboolean
codestring
includesArray<Node>
language"js" | "wgsl" | "glsl"
MethodType

Extends

Node

ExpressionNode

This 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?)
ParameterTypeDefault Value
snippet?string
nodeType?stringvoid

Constructs a new expression node.

AccessorType

Properties

PropertyTypeDefault Value
snippetstring
MethodType

Extends

Node

FunctionCallNode

This 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?)
ParameterTypeDefault Value
functionNode?anynull
parameters?{ [x: string]: Node; }{}

Constructs a new function call node.

AccessorType

Properties

PropertyTypeDefault Value
functionNodeany
parameters{ [x: string]: Node; }
MethodType

Extends

TempNode

FunctionNode

This 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?)
ParameterTypeDefault Value
code?string
includes?Array<Node>[]
language?"js" | "wgsl" | "glsl"

Constructs a new function node.

AccessorType
MethodType

Extends

CodeNode

ArrayNode

ArrayNode 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?)
ParameterTypeDefault Value
nodeTypenull | string
countnumber
values?null | Array<Node>null

Constructs a new array node.

AccessorType

Properties

PropertyTypeDefault Value
countnumber
valuesnull | Array<Node>
isArrayNodeboolean
MethodType

Extends

TempNode

AssignNode

These node represents an assign operation. Meaning a node is assigned to another node.

Constructor

new AssignNode(targetNode, sourceNode)
ParameterTypeDefault Value
targetNodeNode
sourceNodeNode

Constructs a new assign node.

AccessorType

Properties

PropertyTypeDefault Value
targetNodeNode
sourceNodeNode
isAssignNodeboolean
MethodType

Extends

TempNode

AttributeNode

Base class for representing shader attributes as nodes.

Constructor

new AttributeNode(attributeName, nodeType?)
ParameterTypeDefault Value
attributeNamestring
nodeType?null | stringnull

Constructs a new attribute node.

AccessorType

Properties

PropertyTypeDefault Value
_attributeNamestring
MethodType

Extends

Node

BypassNode

The 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)
ParameterTypeDefault Value
outputNodeNode
callNodeNode

Constructs a new bypass node.

AccessorType

Properties

PropertyTypeDefault Value
isBypassNodeboolean
outputNodeNode
callNodeNode
MethodType

Extends

Node

NodeShaderStage

Possible shader stages.

Type

{ VERTEX: string; FRAGMENT: string; }

NodeUpdateType

Update types of a node.

Type

{ NONE: string; FRAME: string; RENDER: string; OBJECT: string; }

NodeType

Data types of a node.

Type

{ BOOLEAN: string; INTEGER: string; FLOAT: string; VECTOR2: string; VECTOR3: string; VECTOR4: string; MATRIX2: string; MATRIX3: string; MATRIX4: string; }

NodeAccess

Access types of a node. These are relevant for compute and storage usage.

Type

{ READ_ONLY: string; WRITE_ONLY: string; READ_WRITE: string; }

defaultShaderStages

Type

Array<string>

defaultBuildStages

Type

Array<string>

shaderStages

Type

Array<string>

vectorComponents

Type

Array<string>

ConstNode

Class for representing a constant value in the shader.

Constructor

new ConstNode(value, nodeType?)
ParameterTypeDefault Value
valueany
nodeType?null | stringnull

Constructs a new input node.

AccessorType

Properties

PropertyTypeDefault Value
isConstNodeboolean
MethodType

Extends

InputNode

ContextNode

This 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?)
ParameterTypeDefault Value
node?Nodenull
value?Object{}

Constructs a new context node.

AccessorType

Properties

PropertyTypeDefault Value
isContextNodeboolean
nodeNode
valueObject
MethodType

Extends

Node

IndexNode

This 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)
ParameterTypeDefault Value
scope"vertex" | "instance" | "subgroup" | "invocationLocal" | "invocationGlobal" | "invocationSubgroup" | "draw"

Constructs a new index node.

AccessorType

Properties

PropertyTypeDefault Value
scopestring
isIndexNodeboolean
MethodType

Extends

Node
N E W

InputNode

Base class for representing data input nodes.

Constructor

new InputNode(value, nodeType?)
ParameterTypeDefault Value
valueany
nodeType?null | stringnull

Constructs a new input node.

AccessorType

Properties

PropertyTypeDefault Value
isInputNodeboolean
valueany
precisionnull | "low" | "medium" | "high"
MethodType

Extends

Node
N E W

InspectorNode

InspectorNode 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?)
ParameterTypeDefault Value
nodeNode
name?string
callback?null | Functionnull

Creates an InspectorNode.

AccessorType

Properties

PropertyTypeDefault Value
nodeNode
namestring
callbacknull | Function
updateTypestring
isInspectorNodeboolean
MethodType

Extends

Node

IsolateNode

This 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?)
ParameterTypeDefault Value
nodeNode
parent?booleantrue

Constructs a new cache node.

AccessorType

Properties

PropertyTypeDefault Value
nodeNode
parentboolean
isIsolateNodeboolean
MethodType

Extends

Node

LightingModel

Abstract 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.

MethodType

MRTNode

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)
ParameterTypeDefault Value
outputNodes{ [x: string]: Node; }

Constructs a new output struct node.

AccessorType

Properties

PropertyTypeDefault Value
outputNodes{ [x: string]: Node; }
blendModes{ [x: string]: BlendMode; }
isMRTNodeboolean
MethodType

Extends

OutputStructNode

Node

Base class for all nodes.

Constructor

new Node(nodeType?)
ParameterTypeDefault Value
nodeType?null | stringnull

Constructs a new node.

AccessorType

Properties

PropertyTypeDefault Value
nodeTypenull | string
updateTypestring
updateBeforeTypestring
updateAfterTypestring
versionnumber
namestring
globalboolean
parentsboolean
isNodeboolean
_beforeNodesany
_cacheKeynull | number
_uuidstring
_cacheKeyVersionnumber
idnumber
stackTracenull | string
MethodType

Extends

EventDispatcher

NodeAttribute

NodeBuilder 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?)
ParameterTypeDefault Value
namestring
typestring
node?null | Nodenull

Constructs a new node attribute.

Properties

PropertyTypeDefault Value
isNodeAttributeboolean
namestring
typestring
nodenull | Node

NodeBuilder

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)
ParameterTypeDefault Value
objectObject3D
rendererRenderer
parserNodeParser

Constructs a new node builder.

AccessorType

Properties

PropertyTypeDefault Value
objectObject3D
materialany
geometryany
rendererRenderer
parserNodeParser
sceneany
cameraany
nodesArray<Node>
sequentialNodesArray<Node>
updateNodesArray<Node>
updateBeforeNodesArray<Node>
updateAfterNodesArray<Node>
hashNodes{ [x: number]: Node; }
observerany
lightsNodeany
environmentNodenull | Node
fogNodenull | Node
clippingContextany
vertexShadernull | string
fragmentShadernull | string
computeShadernull | string
flowNodes{ [x: string]: Array<Node>; }
flowCode{ [x: string]: string; }
uniformsObject
structsObject
typesObject
bindingsObject
bindingsIndexesObject
bindGroupsnull | Array<BindGroup>
attributesArray<NodeAttribute>
bufferAttributesArray<NodeAttribute>
varyingsArray<NodeVarying>
codes{ [x: string]: Array<NodeCode>; }
vars{ [x: string]: number | Array<NodeVar>; }
declarationsObject
flow{ code: string; }
chainingArray<Node>
stackStackNode
stacksArray<StackNode>
tabstring
currentFunctionNodenull | FunctionNode
contextObject
cacheNodeCache
globalCacheNodeCache
flowsDataWeakMap<WeakKey, any>
shaderStagenull | "vertex" | "fragment" | "compute" | "any"
buildStagenull | "generate" | "setup" | "analyze"
subBuildLayersArray<SubBuildNode>
activeStacksArray<StackNode>
subBuildFnnull | string
fnCallnull | Node
MethodType

NodeCache

This utility class is used in NodeBuilder as an internal cache data structure for node data.

Constructor

new NodeCache(parent?)
ParameterTypeDefault Value
parent?null | NodeCachenull

Constructs a new node cache.

Properties

PropertyTypeDefault Value
idnumber
nodesDataWeakMap<Node, Object>
parentnull | NodeCache
MethodType

NodeCode

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?)
ParameterTypeDefault Value
namestring
typestring
code?string

Constructs a new code node.

Properties

PropertyTypeDefault Value
namestring
typestring
codestring
N E W

NodeError

Custom error class for node-related errors, including stack trace information.

Constructor

new NodeError(message, stackTrace?)
ParameterTypeDefault Value
messageany
stackTrace?nullnull

Properties

PropertyTypeDefault Value
stackTraceany

Extends

Error

NodeFrame

Management 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

PropertyTypeDefault Value
timenumber
deltaTimenumber
frameIdnumber
renderIdnumber
updateMapWeakMap<Node, Object>
updateBeforeMapWeakMap<Node, Object>
updateAfterMapWeakMap<Node, Object>
rendererany
materialany
cameraany
objectany
sceneany
lastTimenumber
MethodType

NodeFunctionInput

Describes the input of a NodeFunction.

Constructor

new NodeFunctionInput(type, name, count?, qualifier?, isConst?)
ParameterTypeDefault Value
typestring
namestring
count?null | numbernull
qualifier?"in" | "out" | "inout"
isConst?booleanfalse

Constructs a new node function input.

Properties

PropertyTypeDefault Value
typestring
namestring
countnull | number
qualifier"in" | "out" | "inout"
isConstboolean

NodeUniform

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)
ParameterTypeDefault Value
namestring
typestring
nodeUniformNode

Constructs a new node uniform.

AccessorType

Properties

PropertyTypeDefault Value
isNodeUniformboolean
namestring
typestring
nodeUniformNode

NodeVar

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?)
ParameterTypeDefault Value
namestring
typestring
readOnly?booleanfalse
count?null | numbernull

Constructs a new node variable.

Properties

PropertyTypeDefault Value
isNodeVarboolean
namestring
typestring
readOnlyboolean
countnull | number

NodeVarying

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?)
ParameterTypeDefault Value
namestring
typestring
interpolationType?null | stringnull
interpolationSampling?null | stringnull

Constructs a new node varying.

Properties

PropertyTypeDefault Value
needsInterpolationboolean
isNodeVaryingboolean
interpolationTypenull | string
interpolationSamplingnull | string

Extends

NodeVar

OutputStructNode

This node can be used to define multiple outputs in a shader programs.

Constructor

new OutputStructNode(...members)
ParameterTypeDefault Value
members...Array<Node>

Constructs a new output struct node. The constructor can be invoked with an arbitrary number of nodes representing the members.

AccessorType

Properties

PropertyTypeDefault Value
membersArray<Node>
isOutputStructNodeboolean
MethodType

Extends

Node

ParameterNode

Special version of PropertyNode which is used for parameters.

Constructor

new ParameterNode(nodeType, name?)
ParameterTypeDefault Value
nodeTypestring
name?null | stringnull

Constructs a new parameter node.

AccessorType

Properties

PropertyTypeDefault Value
isParameterNodeboolean
MethodType

Extends

PropertyNode

PropertyNode

This 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?)
ParameterTypeDefault Value
nodeTypestring
name?null | stringnull
varying?booleanfalse

Constructs a new property node.

AccessorType

Properties

PropertyTypeDefault Value
varyingboolean
isPropertyNodeboolean
MethodType

Extends

Node

StackNode

Stack 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?)
ParameterTypeDefault Value
parent?null | StackNodenull

Constructs a new stack node.

AccessorType

Properties

PropertyTypeDefault Value
nodesArray<Node>
outputNodenull | Node
parentnull | StackNode
_currentCondConditionalNode
_expressionNodeNode
_currentNodeNode
isStackNodeboolean
MethodType

Extends

Node
N E W

StackTrace

Class representing a stack trace for debugging purposes.

Constructor

new StackTrace(stackMessage?)
ParameterTypeDefault Value
stackMessage?null | string | Errornull

Creates a StackTrace instance by capturing and filtering the current stack trace.

Properties

PropertyTypeDefault Value
isStackTraceboolean
stackArray<{ fn: string; file: string; line: number; column: number; }>
MethodType

StructNode

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)
ParameterTypeDefault Value
structTypeNodeany
valuesany
AccessorType

Properties

PropertyTypeDefault Value
structTypeNodeany
valuesany
isStructNodeboolean
MethodType

Extends

Node

StructTypeNode

Represents 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?)
ParameterTypeDefault Value
membersLayoutObject
name?null | stringnull

Creates an instance of StructTypeNode.

AccessorType

Properties

PropertyTypeDefault Value
membersLayoutArray<{ name: string; type: string; atomic: boolean; }>
isStructLayoutNodeboolean
MethodType

Extends

Node

SubBuildNode

This node is used to build a sub-build in the node system.

Constructor

new SubBuildNode(node, name, nodeType?)
ParameterTypeDefault Value
nodeany
nameany
nodeType?nullnull
AccessorType

Properties

PropertyTypeDefault Value
nodeNode
isSubBuildNodeboolean
MethodType

Extends

Node

TempNode

This 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?)
ParameterTypeDefault Value
nodeType?null | stringnull

Constructs a temp node.

AccessorType

Properties

PropertyTypeDefault Value
isTempNodeboolean
MethodType

Extends

Node

UniformGroupNode

This 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?)
ParameterTypeDefault Value
namestring
shared?booleanfalse
order?number1
updateType?null | stringnull

Constructs a new uniform group node.

AccessorType

Properties

PropertyTypeDefault Value
sharedboolean
ordernumber
isUniformGroupboolean
MethodType

Extends

Node

UniformNode

Class for representing a uniform.

Constructor

new UniformNode(value, nodeType?)
ParameterTypeDefault Value
valueany
nodeType?null | stringnull

Constructs a new uniform node.

AccessorType

Properties

PropertyTypeDefault Value
isUniformNodeboolean
groupNodeUniformGroupNode
MethodType

Extends

InputNode

VarNode

Class 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?)
ParameterTypeDefault Value
nodeNode
name?null | stringnull
readOnly?booleanfalse

Constructs a new variable node.

AccessorType

Properties

PropertyTypeDefault Value
nodeNode
isVarNodeboolean
readOnlyboolean
intentboolean
MethodType

Extends

Node

VaryingNode

Class 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?)
ParameterTypeDefault Value
nodeNode
name?null | stringnull

Constructs a new varying node.

AccessorType

Properties

PropertyTypeDefault Value
nodeNode
isVaryingNodeboolean
interpolationTypenull | string
interpolationSamplingnull | string
MethodType

Extends

Node

BumpMapNode

This class can be used for applying bump maps to materials.

material.normalNode = bumpMap( texture( bumpTex ) );
export {}

Constructor

new BumpMapNode(textureNode, scaleNode?)
ParameterTypeDefault Value
textureNodeNode<float>
scaleNode?anynull

Constructs a new bump map node.

AccessorType

Properties

PropertyTypeDefault Value
textureNodeany
scaleNodeany
MethodType

Extends

TempNode

ColorSpaceNode

This 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)
ParameterTypeDefault Value
colorNodeNode
sourcestring
targetstring

Constructs a new color space node.

AccessorType

Properties

PropertyTypeDefault Value
colorNodeNode
sourcestring
targetstring
MethodType

Extends

TempNode

FrontFacingNode

This node can be used to evaluate whether a primitive is front or back facing.

Constructor

new FrontFacingNode()

Constructs a new front facing node.

AccessorType

Properties

PropertyTypeDefault Value
isFrontFacingNodeboolean
MethodType

Extends

Node

NormalMapNode

This class can be used for applying normals maps to materials.

material.normalNode = normalMap( texture( normalTex ) );
export {}

Constructor

new NormalMapNode(node, scaleNode?)
ParameterTypeDefault Value
nodeNode<vec3>
scaleNode?anynull

Constructs a new normal map node.

AccessorType

Properties

PropertyTypeDefault Value
nodeany
scaleNodeany
normalMapTypenumber
unpackNormalModestring
MethodType

Extends

TempNode

PassNode

Represents 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?)
ParameterTypeDefault Value
scope"color" | "depth"
sceneScene
cameraCamera
options?Object{}

Constructs a new pass node.

AccessorType

Properties

PropertyTypeDefault Value
scope"color" | "depth"
sceneScene
cameraCamera
optionsObject
_pixelRationumber
_widthnumber
_heightnumber
renderTargetRenderTarget
overrideMaterialany
transparentboolean
opaqueboolean
contextNodeany
_contextNodeCachenull | Object
_textures{ [x: string]: Texture; }
_textureNodes{ [x: string]: TextureNode; }
_linearDepthNodesObject
_viewZNodesObject
_previousTextures{ [x: string]: Texture; }
_previousTextureNodes{ [x: string]: TextureNode; }
_cameraNearUniformNode
_cameraFarUniformNode
_mrtany
_layersany
_resolutionScalenumber
_viewportnull | Vector4
_scissornull | Vector4
isPassNodeboolean
MethodType

Extends

TempNode

RenderOutputNode

Normally, 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)
ParameterTypeDefault Value
colorNodeNode
toneMappingnull | number
outputColorSpacenull | string

Constructs a new render output node.

AccessorType

Properties

PropertyTypeDefault Value
colorNodeNode
_toneMappingnull | number
outputColorSpacenull | string
isRenderOutputNodeboolean
MethodType

Extends

TempNode

ScreenNode

This 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)
ParameterTypeDefault Value
scope"size" | "coordinate" | "viewport" | "uv" | "dpr"

Constructs a new screen node.

AccessorType

Properties

PropertyTypeDefault Value
scope"size" | "coordinate" | "viewport" | "uv" | "dpr"
_outputnull | Node
isViewportNodeboolean
MethodType

Extends

Node

ToneMappingNode

This node represents a tone mapping operation.

Constructor

new ToneMappingNode(toneMapping, exposureNode?, colorNode?)
ParameterTypeDefault Value
toneMappingnumber
exposureNode?NodetoneMappingExposure
colorNode?Nodenull

Constructs a new tone mapping node.

AccessorType

Properties

PropertyTypeDefault Value
_toneMappingnumber
exposureNodeNode
colorNodenull | Node
MethodType

Extends

TempNode

ToonOutlinePassNode

Represents 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)
ParameterTypeDefault Value
sceneScene
cameraCamera
colorNodeNode
thicknessNodeNode
alphaNodeNode

Constructs a new outline pass node.

AccessorType

Properties

PropertyTypeDefault Value
colorNodeNode
thicknessNodeNode
alphaNodeNode
_materialCacheWeakMap<Material, NodeMaterial>
MethodType

Extends

PassNode

ViewportDepthNode

This 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?)
ParameterTypeDefault Value
scope"depth" | "depthBase" | "linearDepth"
valueNode?null | Nodenull

Constructs a new viewport depth node.

AccessorType

Properties

PropertyTypeDefault Value
scope"depth" | "depthBase" | "linearDepth"
valueNodenull | Node
isViewportDepthNodeboolean
MethodType

Extends

Node

ViewportDepthTextureNode

Represents 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?)
ParameterTypeDefault Value
uvNode?NodescreenUV
levelNode?null | Nodenull
depthTexture?null | DepthTexturenull

Constructs a new viewport depth texture node.

AccessorType

Extends

ViewportTextureNode

ViewportSharedTextureNode

ViewportTextureNode creates an internal texture for each node instance. This module shares a texture across all instances of ViewportSharedTextureNode. It should be the first choice when using data of the default/screen framebuffer for performance reasons.

Constructor

new ViewportSharedTextureNode(uvNode?, levelNode?)
ParameterTypeDefault Value
uvNode?NodescreenUV
levelNode?null | Nodenull

Constructs a new viewport shared texture node.

AccessorType
MethodType

Extends

ViewportTextureNode

ViewportTextureNode

A 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?)
ParameterTypeDefault Value
uvNode?NodescreenUV
levelNode?null | Nodenull
framebufferTexture?anynull

Constructs a new viewport texture node.

AccessorType

Properties

PropertyTypeDefault Value
generateMipmapsboolean
defaultFramebufferFramebufferTexture
isOutputTextureNodeboolean
_cacheTexturesWeakMap<RenderTarget, FramebufferTexture>
MethodType

Extends

TextureNode

PhongLightingModel

Represents the lighting model for a phong material. Used in MeshPhongNodeMaterial.

Constructor

new PhongLightingModel(specular?)
ParameterTypeDefault Value
specular?booleantrue

Constructs a new phong lighting model.

Properties

PropertyTypeDefault Value
specularboolean
MethodType

Extends

BasicLightingModel

PhysicalLightingModel

Represents the lighting model for a PBR material.

Constructor

new PhysicalLightingModel(clearcoat?, sheen?, iridescence?, anisotropy?, transmission?, dispersion?)
ParameterTypeDefault Value
clearcoat?booleanfalse
sheen?booleanfalse
iridescence?booleanfalse
anisotropy?booleanfalse
transmission?booleanfalse
dispersion?booleanfalse

Constructs a new physical lighting model.

Properties

PropertyTypeDefault Value
clearcoatboolean
sheenboolean
iridescenceboolean
anisotropyboolean
transmissionboolean
dispersionboolean
clearcoatRadiancenull | Node
clearcoatSpecularDirectnull | Node
clearcoatSpecularIndirectnull | Node
sheenSpecularDirectnull | Node
sheenSpecularIndirectnull | Node
iridescenceFresnelnull | Node
iridescenceF0null | Node
iridescenceF0Dielectricnull | Node
iridescenceF0Metallicnull | Node
MethodType

Extends

LightingModel

RangeNode

RangeNode 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?)
ParameterTypeDefault Value
minNode?Node<any>float()
maxNode?Node<any>float()

Constructs a new range node.

AccessorType

Properties

PropertyTypeDefault Value
minNodeany
maxNodeany
MethodType

Extends

Node
N E W

AtomicFunctionNode

AtomicFunctionNode 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)
ParameterTypeDefault Value
methodstring
pointerNodeNode
valueNodeNode

Constructs a new atomic function node.

AccessorType

Properties

PropertyTypeDefault Value
methodstring
pointerNodeNode
valueNodeNode
MethodType

Extends

Node
N E W

BarrierNode

Represents 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)
ParameterTypeDefault Value
scopestring

Constructs a new barrier node.

Properties

PropertyTypeDefault Value
scopestring
isBarrierNodeboolean
MethodType

Extends

Node
N E W

ComputeBuiltinNode

ComputeBuiltinNode 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)
ParameterTypeDefault Value
builtinNamestring
nodeTypestring

Constructs a new compute builtin node.

AccessorType

Properties

PropertyTypeDefault Value
_builtinNamestring
MethodType

Extends

Node

ComputeNode

Represents a compute shader node.

Constructor

new ComputeNode(computeNode, workgroupSize)
ParameterTypeDefault Value
computeNodeNode
workgroupSizeArray<number>

Constructs a new compute node.

AccessorType

Properties

PropertyTypeDefault Value
isComputeNodeboolean
computeNodeNode
workgroupSizeArray<number>
countnumber | Array<number>
dispatchSizenumber | Array<number>
onInitFunctionnull | Function
countNodeany
MethodType

Extends

Node
N E W

SubgroupFunctionNode

This 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?)
ParameterTypeDefault Value
methodstring
aNode?Nodenull
bNode?Nodenull

Constructs a new function node.

AccessorType

Properties

PropertyTypeDefault Value
methodstring
aNodeNode
bNodeNode
MethodType

Extends

TempNode
N E W

WorkgroupInfoNode

A 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?)
ParameterTypeDefault Value
scopestring
bufferTypestring
bufferCount?number0

Constructs a new buffer scoped to type scope.

Properties

PropertyTypeDefault Value
bufferTypestring
bufferCountnumber
isWorkgroupInfoNodeboolean
elementTypestring
scopestring
MethodType

Extends

Node

AmbientLightNode

Module for representing ambient lights as nodes.

Constructor

new AmbientLightNode(light?)
ParameterTypeDefault Value
light?anynull

Constructs a new ambient light node.

AccessorType
MethodType

Extends

AnalyticLightNode

AnalyticLightNode

Base class for analytic light nodes.

Constructor

new AnalyticLightNode(light?)
ParameterTypeDefault Value
light?anynull

Constructs a new analytic light node.

AccessorType

Properties

PropertyTypeDefault Value
lightany
colorColor
colorNodeNode
baseColorNodenull | Node
shadowNodeany
shadowColorNodenull | Node
isAnalyticLightNodeboolean
_shadowDisposeListener() => void
MethodType

Extends

LightingNode

AONode

A 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?)
ParameterTypeDefault Value
aoNode?anynull

Constructs a new AO node.

AccessorType

Properties

PropertyTypeDefault Value
aoNodeany
MethodType

Extends

LightingNode

BasicEnvironmentNode

Represents 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?)
ParameterTypeDefault Value
envNode?Nodenull

Constructs a new basic environment node.

AccessorType

Properties

PropertyTypeDefault Value
envNodeNode
MethodType

Extends

LightingNode
N E W

BasicLightMapNode

A 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?)
ParameterTypeDefault Value
lightMapNode?anynull

Constructs a new basic light map node.

AccessorType

Properties

PropertyTypeDefault Value
lightMapNodeany
MethodType

Extends

LightingNode

DirectionalLightNode

Module for representing directional lights as nodes.

Constructor

new DirectionalLightNode(light?)
ParameterTypeDefault Value
light?anynull

Constructs a new directional light node.

AccessorType
MethodType

Extends

AnalyticLightNode

EnvironmentNode

Represents 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?)
ParameterTypeDefault Value
envNode?Nodenull

Constructs a new environment node.

AccessorType

Properties

PropertyTypeDefault Value
envNodenull | Node
MethodType

Extends

LightingNode

HemisphereLightNode

Module for representing hemisphere lights as nodes.

Constructor

new HemisphereLightNode(light?)
ParameterTypeDefault Value
light?anynull

Constructs a new hemisphere light node.

AccessorType

Properties

PropertyTypeDefault Value
lightPositionNodeUniformNode<vec3>
lightDirectionNodeany
groundColorNodeUniformNode<vec3>
MethodType

Extends

AnalyticLightNode

IESSpotLightNode

An IES version of the default spot light node.

AccessorType
MethodType

Extends

SpotLightNode

IrradianceNode

A 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)
ParameterTypeDefault Value
nodeNode<vec3>

Constructs a new irradiance node.

AccessorType

Properties

PropertyTypeDefault Value
nodeany
MethodType

Extends

LightingNode

LightingContextNode

LightingContextNode 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?)
ParameterTypeDefault Value
lightsNodeLightsNode
lightingModel?anynull
backdropNode?anynull
backdropAlphaNode?anynull

Constructs a new lighting context node.

AccessorType

Properties

PropertyTypeDefault Value
lightingModelany
backdropNodeany
backdropAlphaNodeany
_valuenull | { 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>; }
MethodType

Extends

ContextNode

LightingNode

Base class for lighting nodes.

Constructor

new LightingNode()

Constructs a new lighting node.

AccessorType

Properties

PropertyTypeDefault Value
isLightingNodeboolean

Extends

Node

LightProbeNode

Module for representing light probes as nodes.

Constructor

new LightProbeNode(light?)
ParameterTypeDefault Value
light?anynull

Constructs a new light probe node.

AccessorType

Properties

PropertyTypeDefault Value
lightProbeUniformArrayNode
MethodType

Extends

AnalyticLightNode

LightsNode

This 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.

AccessorType

Properties

PropertyTypeDefault Value
totalDiffuseNodeany
totalSpecularNodeany
outgoingLightNodeany
_lightsArray<Light>
_lightNodesnull | Array<LightingNode>
_lightNodesHashnull | string
MethodType

Extends

Node

PointLightNode

Module for representing point lights as nodes.

Constructor

new PointLightNode(light?)
ParameterTypeDefault Value
light?anynull

Constructs a new point light node.

AccessorType

Properties

PropertyTypeDefault Value
cutoffDistanceNodeUniformNode<float>
decayExponentNodeUniformNode<float>
MethodType

Extends

AnalyticLightNode
N E W

PointShadowNode

Represents the shadow implementation for point light nodes.

Constructor

new PointShadowNode(light, shadow?)
ParameterTypeDefault Value
lightPointLight
shadow?anynull

Constructs a new point shadow node.

AccessorType
MethodType

Extends

ShadowNode

ProjectorLightNode

An implementation of a projector light node.

AccessorType
MethodType

Extends

SpotLightNode

RectAreaLightNode

Module for representing rect area lights as nodes.

Constructor

new RectAreaLightNode(light?)
ParameterTypeDefault Value
light?anynull

Constructs a new rect area light node.

AccessorType

Properties

PropertyTypeDefault Value
halfHeightUniformNode<vec3>
halfWidthUniformNode<vec3>
MethodType

Extends

AnalyticLightNode

ShadowBaseNode

Base 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)
ParameterTypeDefault Value
lightLight

Constructs a new shadow base node.

AccessorType

Properties

PropertyTypeDefault Value
lightLight
isShadowBaseNodeboolean
MethodType

Extends

Node

ShadowNode

Represents the default shadow implementation for lighting nodes.

Constructor

new ShadowNode(light, shadow?)
ParameterTypeDefault Value
lightLight
shadow?anynull

Constructs a new shadow node.

AccessorType

Properties

PropertyTypeDefault Value
shadowany
shadowMapany
vsmShadowMapVerticalany
vsmShadowMapHorizontalany
vsmMaterialVerticalnull | NodeMaterial
vsmMaterialHorizontalnull | NodeMaterial
_nodenull | Node
_currentShadowTypenull | number
_cameraFrameIdWeakMap<Camera, number>
isShadowNodeboolean
depthLayernumber
_depthVersionCachedany
MethodType

Extends

ShadowBaseNode

SpotLightNode

Module for representing spot lights as nodes.

Constructor

new SpotLightNode(light?)
ParameterTypeDefault Value
light?anynull

Constructs a new spot light node.

AccessorType

Properties

PropertyTypeDefault Value
coneCosNodeUniformNode<float>
penumbraCosNodeUniformNode<float>
cutoffDistanceNodeUniformNode<float>
decayExponentNodeUniformNode<float>
MethodType

Extends

AnalyticLightNode

BitcastNode

This 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?)
ParameterTypeDefault Value
valueNodeNode
conversionTypestring
inputType?null | stringnull

Constructs a new bitcast node.

AccessorType

Properties

PropertyTypeDefault Value
valueNodeNode
conversionTypestring
inputTypestring
isBitcastNodeboolean
MethodType

Extends

TempNode
N E W

BitcountNode

This node represents an operation that counts the bits of a piece of shader data.

Constructor

new BitcountNode(method, aNode)
ParameterTypeDefault Value
method"countTrailingZeros" | "countLeadingZeros" | "countOneBits"
aNodeNode

Constructs a new math node.

AccessorType

Properties

PropertyTypeDefault Value
isBitcountNodeboolean
MethodType

Extends

MathNode
N E W

ConditionalNode

Represents 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?)
ParameterTypeDefault Value
condNodeNode
ifNodeNode
elseNode?null | Nodenull

Constructs a new conditional node.

AccessorType

Properties

PropertyTypeDefault Value
condNodeNode
ifNodeNode
elseNodenull | Node
MethodType

Extends

Node

MathNode

This node represents a variety of mathematical methods available in shaders. They are divided into three categories:

  • Methods with one input like sin , cos or normalize .
  • Methods with two inputs like dot , cross or pow .
  • Methods with three inputs like mix , clamp or smoothstep .

Constructor

new MathNode(method, aNode, bNode?, cNode?, args)
ParameterTypeDefault Value
methodstring
aNodeNode
bNode?null | Nodenull
cNode?null | Nodenull
argsArray<any>

Constructs a new math node.

AccessorType

Properties

PropertyTypeDefault Value
methodstring
aNodeNode
bNodenull | Node
cNodenull | Node
isMathNodeboolean
MethodType

Extends

TempNode

OperatorNode

This node represents basic mathematical and logical operations like addition, subtraction or comparisons (e.g. equal()).

Constructor

new OperatorNode(op, aNode, bNode, ...params)
ParameterTypeDefault Value
opstring
aNodeNode
bNodeNode
params...Array<Node>

Constructs a new operator node.

AccessorType

Properties

PropertyTypeDefault Value
opstring
aNodeNode
bNodeNode
isOperatorNodeboolean
MethodType

Extends

TempNode
N E W

PackFloatNode

This node represents an operation that packs floating-point values of a vector into an unsigned 32-bit integer

Constructor

new PackFloatNode(encoding, vectorNode)
ParameterTypeDefault Value
encoding"snorm" | "unorm" | "float16"
vectorNodeNode
AccessorType

Properties

PropertyTypeDefault Value
vectorNodeNode
encodingstring
isPackFloatNodeboolean
MethodType

Extends

TempNode
N E W

UnpackFloatNode

This 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)
ParameterTypeDefault Value
encoding"snorm" | "unorm" | "float16"
uintNodeNode
AccessorType

Properties

PropertyTypeDefault Value
uintNodeNode
encodingstring
isUnpackFloatNodeboolean
MethodType

Extends

TempNode

NodeUtils

hashString

Computes a hash for the given string.

ParameterTypeDefault Value
strstring

Returns

number

hashArray

Computes a hash for the given array.

ParameterTypeDefault Value
arrayArray<number>

Returns

number

hash

Computes a hash for the given list of parameters.

ParameterTypeDefault Value
params...Array<number>

Returns

number

getTypeFromLength

Returns the data type for the given the length.

ParameterTypeDefault Value
lengthnumber

Returns

string

getTypedArrayFromType

Returns the typed array for the given data type.

ParameterTypeDefault Value
typestring

Returns

TypedArray

getLengthFromType

Returns the length for the given data type.

ParameterTypeDefault Value
typestring

Returns

number

getMemoryLengthFromType

Returns the gpu memory length for the given data type.

ParameterTypeDefault Value
typestring

Returns

number

getAlignmentFromType

Returns the alignment requirement for the given data type.

ParameterTypeDefault Value
typestring

Returns

number

getValueType

Returns the data type for the given value.

ParameterTypeDefault Value
valueany

Returns

null | string

getValueFromType

Returns the value/object for the given data type and parameters.

ParameterTypeDefault Value
typestring
params...Array<any>

Returns

any

getDataFromObject

Gets the object data that can be shared between different rendering steps.

ParameterTypeDefault Value
objectObject

Returns

Object

arrayBufferToBase64

Converts the given array buffer to a Base64 string.

ParameterTypeDefault Value
arrayBufferArrayBuffer

Returns

string

base64ToArrayBuffer

Converts the given Base64 string to an array buffer.

ParameterTypeDefault Value
base64string

Returns

ArrayBuffer

GLSLNodeParser

A GLSL node parser.

MethodType

Extends

NodeParser

PMREMNode

This 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?)
ParameterTypeDefault Value
valueTexture
uvNode?Node<vec2>null
levelNode?Node<float>null

Constructs a new function overloading node.

AccessorType

Properties

PropertyTypeDefault Value
_valueTexture
_pmremnull | Texture
uvNodeany
levelNodeany
_generatornull | PMREMGenerator
_textureTextureNode
_widthUniformNode<float>
_heightUniformNode<float>
_maxMipUniformNode<float>
MethodType

Extends

TempNode

ArrayElementNode

Base class for representing element access on an array-like node data structures.

Constructor

new ArrayElementNode(node, indexNode)
ParameterTypeDefault Value
nodeNode
indexNodeNode

Constructs an array element node.

AccessorType

Properties

PropertyTypeDefault Value
nodeNode
indexNodeNode
isArrayElementNodeboolean
MethodType

Extends

Node

ConvertNode

This 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)
ParameterTypeDefault Value
nodeNode
convertTostring

Constructs a new convert node.

AccessorType

Properties

PropertyTypeDefault Value
nodeNode
convertTostring
MethodType

Extends

Node
N E W

CubeMapNode

This node can be used to automatically convert environment maps in the equirectangular format into the cube map format.

Constructor

new CubeMapNode(envNode)
ParameterTypeDefault Value
envNodeNode

Constructs a new cube map node.

AccessorType

Properties

PropertyTypeDefault Value
envNodeNode
_cubeTexturenull | CubeTexture
_cubeTextureNodeCubeTextureNode
_defaultTextureCubeTexture
MethodType

Extends

TempNode

DebugNode

Constructor

new DebugNode(node, callback?)
ParameterTypeDefault Value
nodeany
callback?nullnull
AccessorType

Properties

PropertyTypeDefault Value
nodeany
callbackany
MethodType

Extends

TempNode

EventNode

EventNode is a node that executes a callback during specific update phases.

Constructor

new EventNode(eventType, callback)
ParameterTypeDefault Value
eventTypestring
callbackFunction

Creates an EventNode.

AccessorType

Properties

PropertyTypeDefault Value
eventTypestring
callbackFunction
updateTypestring
updateBeforeTypestring
MethodType

Extends

Node
N E W

FlipNode

This 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)
ParameterTypeDefault Value
sourceNodeNode
componentsstring

Constructs a new flip node.

AccessorType

Properties

PropertyTypeDefault Value
sourceNodeNode
componentsstring
MethodType

Extends

TempNode

FunctionOverloadingNode

This 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)
ParameterTypeDefault Value
functionNodes?Array<Function>[]
parametersNodes...Array<Node>

Constructs a new function overloading node.

AccessorType

Properties

PropertyTypeDefault Value
functionNodesArray<Function>
parametersNodesArray<Node>
_candidateFnShaderCallNodeInternal
MethodType

Extends

Node

JoinNode

This 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?)
ParameterTypeDefault Value
nodes?Array<Node>[]
nodeType?null | stringnull

Constructs a new join node.

AccessorType

Properties

PropertyTypeDefault Value
nodesArray<Node>
MethodType

Extends

TempNode

LoopNode

This 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?)
ParameterTypeDefault Value
params?Array<any>[]

Constructs a new loop node.

AccessorType

Properties

PropertyTypeDefault Value
paramsArray<any>
MethodType

Extends

Node

MaxMipLevelNode

A 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)
ParameterTypeDefault Value
textureNodeTextureNode

Constructs a new max mip level node.

AccessorType

Properties

PropertyTypeDefault Value
_textureNodeTextureNode
MethodType

Extends

UniformNode

MemberNode

Base class for representing member access on an object-like node data structures.

Constructor

new MemberNode(structNode, property)
ParameterTypeDefault Value
structNodeNode
propertystring

Constructs a member node.

AccessorType

Properties

PropertyTypeDefault Value
structNodeNode
propertyNode
isMemberNodeboolean
MethodType

Extends

Node

ReflectorNode

This 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?)
ParameterTypeDefault 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.

AccessorType

Properties

PropertyTypeDefault Value
_reflectorBaseNodeReflectorBaseNode
_depthNodenull | Node
MethodType

Extends

TextureNode

RotateNode

Applies a rotation to the given position node.

Constructor

new RotateNode(positionNode, rotationNode)
ParameterTypeDefault Value
positionNodeNode
rotationNodeNode

Constructs a new rotate node.

AccessorType

Properties

PropertyTypeDefault Value
positionNodeNode
rotationNodeNode
MethodType

Extends

TempNode

RTTNode

RTTNode 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?)
ParameterTypeDefault Value
nodeNode
width?null | numbernull
height?null | numbernull
options?Object{"type":1016}

Constructs a new RTT node.

AccessorType

Properties

PropertyTypeDefault Value
isRTTNodeboolean
nodeNode
widthnull | number
heightnull | number
pixelRationumber
renderTargetRenderTarget
textureNeedsUpdateboolean
autoUpdateboolean
_rttNodeNode
_quadMeshQuadMesh
MethodType

Extends

TextureNode
N E W

SampleNode

Class representing a node that samples a value using a provided callback function.

Constructor

new SampleNode(callback, uvNode?)
ParameterTypeDefault Value
callbackFunction
uvNode?anynull

Creates an instance of SampleNode.

AccessorType

Properties

PropertyTypeDefault Value
callbackFunction
uvNodeany
isSampleNodeboolean
MethodType

Extends

Node

SetNode

This 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)
ParameterTypeDefault Value
sourceNodeNode
componentsstring
targetNodeNode

Constructs a new set node.

AccessorType

Properties

PropertyTypeDefault Value
sourceNodeNode
componentsstring
targetNodeNode
MethodType

Extends

TempNode

SplitNode

This 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?)
ParameterTypeDefault Value
nodeNode
components?stringx

Constructs a new split node.

AccessorType

Properties

PropertyTypeDefault Value
nodeNode
componentsstring
isSplitNodeboolean
MethodType

Extends

Node

StorageArrayElementNode

This 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)
ParameterTypeDefault Value
storageBufferNodeStorageBufferNode
indexNodeNode

Constructs storage buffer element node.

AccessorType
get storageBufferNodeNode

Properties

PropertyTypeDefault Value
isStorageArrayElementNodeboolean
MethodType

Extends

ArrayElementNode