TBNViewMatrix

Last modified: Mar 5, 2026

TSL object that represents the TBN matrix in view space.

Type

Node<mat3>

parallaxDirection

TSL object that represents the parallax direction.

Type

Node<mat3>

parallaxUV

TSL function for computing parallax uv coordinates.

ParameterTypeDefault Value
uvNode<vec2>
scaleNode<vec2>

Returns

Node<vec2>

bentNormalView

TSL function for computing bent normals.

Returns

Node<vec3>

attributeArray

TSL function for creating a storage buffer node with a configured StorageBufferAttribute.

ParameterTypeDefault Value
countany
type?any

Returns

StorageBufferNode

instancedArray

TSL function for creating a storage buffer node with a configured StorageInstancedBufferAttribute.

ParameterTypeDefault Value
countany
type?any

Returns

StorageBufferNode

batch

TSL function for creating a batch node.

ParameterTypeDefault Value
batchMeshBatchedMesh

Returns

BatchNode

bitangentGeometry

TSL object that represents the bitangent attribute of the current rendered object.

Type

Node<vec3>

bitangentLocal

TSL object that represents the vertex bitangent in local space of the current rendered object.

Type

Node<vec3>

bitangentView

TSL object that represents the vertex bitangent in view space of the current rendered object.

Type

Node<vec3>

bitangentWorld

TSL object that represents the vertex bitangent in world space of the current rendered object.

Type

Node<vec3>

bufferAttribute

TSL function for creating a buffer attribute node.

ParameterTypeDefault Value
arrayany
type?null | stringnull
stride?number0
offset?number0

Returns

Node | BufferAttributeNode

dynamicBufferAttribute

TSL function for creating a buffer attribute node but with dynamic draw usage. Use this function if attribute data are updated per frame.

ParameterTypeDefault Value
arrayany
type?null | stringnull
stride?number0
offset?number0

Returns

Node | BufferAttributeNode

instancedBufferAttribute

TSL function for creating a buffer attribute node but with enabled instancing

ParameterTypeDefault Value
arrayany
type?null | stringnull
stride?number0
offset?number0

Returns

Node | BufferAttributeNode

instancedDynamicBufferAttribute

TSL function for creating a buffer attribute node but with dynamic draw usage and enabled instancing

ParameterTypeDefault Value
arrayany
type?null | stringnull
stride?number0
offset?number0

Returns

Node | BufferAttributeNode

buffer

TSL function for creating a buffer node.

ParameterTypeDefault Value
valueArray<number>
typestring
countnumber

Returns

BufferNode

builtin

TSL function for creating a builtin node.

ParameterTypeDefault Value
namestring

Returns

BuiltinNode

cameraIndex

TSL object that represents the current index value of the camera if used ArrayCamera.

Type

UniformNode<uint>

cameraNear

TSL object that represents the near value of the camera used for the current render.

Type

UniformNode<float>

cameraFar

TSL object that represents the far value of the camera used for the current render.

Type

UniformNode<float>

cameraProjectionMatrix

TSL object that represents the projection matrix of the camera used for the current render.

Type

UniformNode<mat4>

cameraProjectionMatrixInverse

TSL object that represents the inverse projection matrix of the camera used for the current render.

Type

UniformNode<mat4>

cameraViewMatrix

TSL object that represents the view matrix of the camera used for the current render.

Type

UniformNode<mat4>

cameraWorldMatrix

TSL object that represents the world matrix of the camera used for the current render.

Type

UniformNode<mat4>

cameraNormalMatrix

TSL object that represents the normal matrix of the camera used for the current render.

Type

UniformNode<mat3>

cameraPosition

TSL object that represents the position in world space of the camera used for the current render.

Type

UniformNode<vec3>

cameraViewport

TSL object that represents the viewport of the camera used for the current render.

Type

UniformNode<vec4>

cubeTextureBase

TSL function for creating a cube texture node.

ParameterTypeDefault Value
valueCubeTexture
uvNode?Node<vec3>
levelNode?Node<int>
biasNode?Node<float>

Returns

CubeTextureNode

cubeTexture

TSL function for creating a cube texture uniform node.

ParameterTypeDefault Value
value?null | CubeTextureNode | CubeTextureEmptyTexture
uvNode?anynull
levelNode?anynull
biasNode?anynull

Returns

CubeTextureNode

uniformCubeTexture

TSL function for creating a uniform cube texture node.

ParameterTypeDefault Value
value?null | CubeTextureEmptyTexture

Returns

CubeTextureNode

instancedMesh

TSL function for creating an instanced mesh node.

ParameterTypeDefault Value
instancedMeshInstancedMesh

Returns

InstancedMeshNode

instance

TSL function for creating an instance node.

ParameterTypeDefault Value
countnumber
instanceMatrixany
instanceColorany

Returns

InstanceNode

lightShadowMatrix

TSL function for getting a shadow matrix uniform node for the given light.

ParameterTypeDefault Value
lightLight

Returns

UniformNode<mat4>

lightProjectionUV

TSL function for getting projected uv coordinates for the given light. Relevant when using maps with spot lights.

ParameterTypeDefault Value
lightLight
position?Node<vec3>positionWorld

Returns

any

lightPosition

TSL function for getting the position in world space for the given light.

ParameterTypeDefault Value
lightLight

Returns

UniformNode<vec3>

lightTargetPosition

TSL function for getting the light target position in world space for the given light.

ParameterTypeDefault Value
lightLight

Returns

UniformNode<vec3>

lightViewPosition

TSL function for getting the position in view space for the given light.

ParameterTypeDefault Value
lightLight

Returns

UniformNode<vec3>

lightTargetDirection

TSL function for getting the light target direction for the given light.

ParameterTypeDefault Value
lightLight

Returns

Node<vec3>

materialAlphaTest

TSL object that represents alpha test of the current material.

Type

Node<float>

materialColor

TSL object that represents the diffuse color of the current material. The value is composed via color * map.

Type

Node<vec3>

materialShininess

TSL object that represents the shininess of the current material.

Type

Node<float>

materialEmissive

TSL object that represents the emissive color of the current material. The value is composed via emissive * emissiveIntensity * emissiveMap.

Type

Node<vec3>

materialOpacity

TSL object that represents the opacity of the current material. The value is composed via opacity * alphaMap.

Type

Node<float>

materialSpecular

TSL object that represents the specular of the current material.

Type

Node<vec3>

materialSpecularIntensity

TSL object that represents the specular intensity of the current material. The value is composed via specularIntensity * specularMap.a.

Type

Node<float>

materialSpecularColor

TSL object that represents the specular color of the current material. The value is composed via specularColor * specularMap.rgb.

Type

Node<vec3>

materialSpecularStrength

TSL object that represents the specular strength of the current material. The value is composed via specularMap.r.

Type

Node<float>

materialReflectivity

TSL object that represents the reflectivity of the current material.

Type

Node<float>

materialRoughness

TSL object that represents the roughness of the current material. The value is composed via roughness * roughnessMap.g.

Type

Node<float>

materialMetalness

TSL object that represents the metalness of the current material. The value is composed via metalness * metalnessMap.b.

Type

Node<float>

materialNormal

TSL object that represents the normal of the current material. The value will be either normalMap * normalScale, bumpMap * bumpScale or normalView.

Type

Node<vec3>

materialClearcoat

TSL object that represents the clearcoat of the current material. The value is composed via clearcoat * clearcoatMap.r

Type

Node<float>

materialClearcoatRoughness

TSL object that represents the clearcoat roughness of the current material. The value is composed via clearcoatRoughness * clearcoatRoughnessMap.r.

Type

Node<float>

materialClearcoatNormal

TSL object that represents the clearcoat normal of the current material. The value will be either clearcoatNormalMap or normalView.

Type

Node<vec3>

materialRotation

TSL object that represents the rotation of the current sprite material.

Type

Node<float>

materialSheen

TSL object that represents the sheen color of the current material. The value is composed via sheen * sheenColor * sheenColorMap.

Type

Node<vec3>

materialSheenRoughness

TSL object that represents the sheen roughness of the current material. The value is composed via sheenRoughness * sheenRoughnessMap.a.

Type

Node<float>

materialAnisotropy

TSL object that represents the anisotropy of the current material.

Type

Node<vec2>

materialIridescence

TSL object that represents the iridescence of the current material.

Type

Node<float>

materialIridescenceIOR

TSL object that represents the iridescence IOR of the current material.

Type

Node<float>

materialIridescenceThickness

TSL object that represents the iridescence thickness of the current material.

Type

Node<float>

materialTransmission

TSL object that represents the transmission of the current material. The value is composed via transmission * transmissionMap.r.

Type

Node<float>

materialThickness

TSL object that represents the thickness of the current material. The value is composed via thickness * thicknessMap.g.

Type

Node<float>

materialIOR

TSL object that represents the IOR of the current material.

Type

Node<float>

materialAttenuationDistance

TSL object that represents the attenuation distance of the current material.

Type

Node<float>

materialAttenuationColor

TSL object that represents the attenuation color of the current material.

Type

Node<vec3>

materialLineScale

TSL object that represents the scale of the current dashed line material.

Type

Node<float>

materialLineDashSize

TSL object that represents the dash size of the current dashed line material.

Type

Node<float>

materialLineGapSize

TSL object that represents the gap size of the current dashed line material.

Type

Node<float>

materialLineWidth

TSL object that represents the line width of the current line material.

Type

Node<float>

materialLineDashOffset

TSL object that represents the dash offset of the current line material.

Type

Node<float>

materialPointSize

TSL object that represents the point size of the current points material.

Type

Node<float>

materialDispersion

TSL object that represents the dispersion of the current material.

Type

Node<float>

materialLightMap

TSL object that represents the light map of the current material. The value is composed via lightMapIntensity * lightMap.rgb.

Type

Node<vec3>

materialAO

TSL object that represents the ambient occlusion map of the current material. The value is composed via aoMap.r - 1 * aoMapIntensity + 1.

Type

Node<float>

materialAnisotropyVector

TSL object that represents the anisotropy vector of the current material.

Type

Node<vec2>

materialRefractionRatio

TSL object that represents the refraction ratio of the material used for rendering the current object.

Type

UniformNode<float>

materialEnvIntensity

TSL object that represents the intensity of environment maps of PBR materials. When material.envMap is set, the value is material.envMapIntensity otherwise scene.environmentIntensity.

Type

Node<float>

materialEnvRotation

TSL object that represents the rotation of environment maps. When material.envMap is set, the value is material.envMapRotation. scene.environmentRotation controls the rotation of scene.environment instead.

Type

Node<mat4>

materialReference

TSL function for creating a material reference node.

ParameterTypeDefault Value
namestring
typestring
material?anynull

Returns

MaterialReferenceNode

modelDirection

TSL object that represents the object’s direction in world space.

Type

ModelNode<vec3>

modelWorldMatrix

TSL object that represents the object’s world matrix.

Type

ModelNode<mat4>

modelPosition

TSL object that represents the object’s position in world space.

Type

ModelNode<vec3>

modelScale

TSL object that represents the object’s scale in world space.

Type

ModelNode<vec3>

modelViewPosition

TSL object that represents the object’s position in view/camera space.

Type

ModelNode<vec3>

modelRadius

TSL object that represents the object’s radius.

Type

ModelNode<float>

modelNormalMatrix

TSL object that represents the object’s normal matrix.

Type

UniformNode<mat3>

modelWorldMatrixInverse

TSL object that represents the object’s inverse world matrix.

Type

UniformNode<mat4>

modelViewMatrix

TSL object that represents the object’s model view matrix.

Type

Node<mat4>

mediumpModelViewMatrix

TSL object that represents the object’s model view in mediump precision.

Type

Node<mat4>

highpModelViewMatrix

TSL object that represents the object’s model view in highp precision which is achieved by computing the matrix in JS and not in the shader.

Type

Node<mat4>

highpModelNormalViewMatrix

TSL object that represents the object’s model normal view in highp precision which is achieved by computing the matrix in JS and not in the shader.

Type

Node<mat3>

modelViewProjection

TSL object that represents the position in clip space after the model-view-projection transform of the current rendered object.

Type

VaryingNode<vec4>

morphReference

TSL function for creating a morph node.

ParameterTypeDefault Value
meshMesh

Returns

MorphNode

normalGeometry

TSL object that represents the normal attribute of the current rendered object in local space.

Type

Node<vec3>

normalLocal

TSL object that represents the vertex normal of the current rendered object in local space.

Type

Node<vec3>

normalFlat

TSL object that represents the flat vertex normal of the current rendered object in view space.

Type

Node<vec3>

normalViewGeometry

TSL object that represents the vertex normal of the current rendered object in view space.

Type

Node<vec3>

normalWorldGeometry

TSL object that represents the vertex normal of the current rendered object in world space.

Type

Node<vec3>

normalView

TSL object that represents the vertex normal of the current rendered object in view space.

Type

Node<vec3>

normalWorld

TSL object that represents the vertex normal of the current rendered object in world space.

Type

Node<vec3>

clearcoatNormalView

TSL object that represents the clearcoat vertex normal of the current rendered object in view space.

Type

Node<vec3>

transformNormal

Transforms the normal with the given matrix.

ParameterTypeDefault Value
normalNode<vec3>
matrix?Node<mat3>

Returns

Node<vec3>

transformNormalToView

Transforms the given normal from local to view space.

ParameterTypeDefault Value
normalNode<vec3>
builderNodeBuilder

Returns

Node<vec3>

transformedNormalView

TSL object that represents the transformed vertex normal of the current rendered object in view space.

Type

Node<vec3>

transformedNormalWorld

TSL object that represents the transformed vertex normal of the current rendered object in world space.

Type

Node<vec3>

transformedClearcoatNormalView

TSL object that represents the transformed clearcoat vertex normal of the current rendered object in view space.

Type

Node<vec3>

objectDirection

TSL function for creating an object 3D node that represents the object’s direction in world space.

ParameterTypeDefault Value
object3d?Object3D

Returns

Object3DNode<vec3>

objectWorldMatrix

TSL function for creating an object 3D node that represents the object’s world matrix.

ParameterTypeDefault Value
object3d?Object3D

Returns

Object3DNode<mat4>

objectPosition

TSL function for creating an object 3D node that represents the object’s position in world space.

ParameterTypeDefault Value
object3d?Object3D

Returns

Object3DNode<vec3>

objectScale

TSL function for creating an object 3D node that represents the object’s scale in world space.

ParameterTypeDefault Value
object3d?Object3D

Returns

Object3DNode<vec3>

objectViewPosition

TSL function for creating an object 3D node that represents the object’s position in view/camera space.

ParameterTypeDefault Value
object3d?Object3D

Returns

Object3DNode<vec3>

objectRadius

TSL function for creating an object 3D node that represents the object’s radius.

ParameterTypeDefault Value
object3d?Object3D

Returns

Object3DNode<float>

pointUV

TSL object that represents the uv coordinates of points.

Type

PointUVNode

clipSpace

TSL object that represents the clip space position of the current rendered object.

Type

VaryingNode<vec4>

positionGeometry

TSL object that represents the position attribute of the current rendered object.

Type

AttributeNode<vec3>

positionLocal

TSL object that represents the vertex position in local space of the current rendered object.

Type

AttributeNode<vec3>

positionPrevious

TSL object that represents the previous vertex position in local space of the current rendered object. Used in context of VelocityNode for rendering motion vectors.

Type

AttributeNode<vec3>

positionWorld

TSL object that represents the vertex position in world space of the current rendered object.

Type

VaryingNode<vec3>

positionWorldDirection

TSL object that represents the position world direction of the current rendered object.

Type

Node<vec3>

positionView

TSL object that represents the vertex position in view space of the current rendered object.

Type

VaryingNode<vec3>

positionViewDirection

TSL object that represents the position view direction of the current rendered object.

Type

VaryingNode<vec3>

reference

TSL function for creating a reference node.

ParameterTypeDefault Value
namestring
typestring
object?null | Object

Returns

ReferenceNode

referenceBuffer

TSL function for creating a reference node. Use this function if you want need a reference to an array-like property that should be represented as a uniform buffer.

ParameterTypeDefault Value
namestring
typestring
countnumber
objectObject

Returns

ReferenceNode

reflectView

The reflect vector in view space.

Type

Node<vec3>

refractView

The refract vector in view space.

Type

Node<vec3>

reflectVector

Used for sampling cube maps when using cube reflection mapping.

Type

Node<vec3>

refractVector

Used for sampling cube maps when using cube refraction mapping.

Type

Node<vec3>

rendererReference

TSL function for creating a renderer reference node.

ParameterTypeDefault Value
namestring
typestring
renderer?anynull

Returns

RendererReferenceNode

backgroundBlurriness

TSL object that represents the scene’s background blurriness.

Type

Node<float>

backgroundIntensity

TSL object that represents the scene’s background intensity.

Type

Node<float>

backgroundRotation

TSL object that represents the scene’s background rotation.

Type

Node<mat4>

skinning

TSL function for creating a skinning node.

ParameterTypeDefault Value
skinnedMeshSkinnedMesh

Returns

SkinningNode

computeSkinning

TSL function for computing skinning.

ParameterTypeDefault Value
skinnedMeshSkinnedMesh
toPosition?Node<vec3>null

Returns

SkinningNode

storage

TSL function for creating a storage buffer node.

ParameterTypeDefault Value
valueany
type?anynull
count?number0

Returns

StorageBufferNode

storageTexture

TSL function for creating a storage texture node.

ParameterTypeDefault Value
valueStorageTexture
uvNodeNode<vec2|vec3>
storeNode?Node

Returns

StorageTextureNode

textureStore

TODO: Explain difference to storageTexture().

ParameterTypeDefault Value
valueStorageTexture
uvNodeNode<vec2|vec3>
storeNode?null | Nodenull

Returns

StorageTextureNode

tangentGeometry

TSL object that represents the tangent attribute of the current rendered object.

Type

Node<vec4>

tangentLocal

TSL object that represents the vertex tangent in local space of the current rendered object.

Type

Node<vec3>

tangentView

TSL object that represents the vertex tangent in view space of the current rendered object.

Type

Node<vec3>

tangentWorld

TSL object that represents the vertex tangent in world space of the current rendered object.

Type

Node<vec3>

texture3D

TSL function for creating a 3D texture node.

ParameterTypeDefault Value
valueData3DTexture
uvNode?Node<vec3>
levelNode?Node<int>

Returns

Texture3DNode

texture3DLoad

TSL function for creating a texture node that fetches/loads texels without interpolation.

ParameterTypeDefault Value
params...Array<any>

Returns

TextureNode

texture3DLevel

TSL function for creating a texture node that fetches/loads texels without interpolation.

ParameterTypeDefault Value
value?anyEmptyTexture
uvNode?anynull
levelNode?anynull

Returns

TextureNode

textureBicubicLevel

Applies mipped bicubic texture filtering to the given texture node.

ParameterTypeDefault Value
textureNodeTextureNode
lodNodeNode<float>

Returns

Node

textureBicubic

Applies mipped bicubic texture filtering to the given texture node.

ParameterTypeDefault Value
textureNodeTextureNode
strength?Node<float>

Returns

Node

texture

TSL function for creating a texture node or sample a texture node already existing.

ParameterTypeDefault Value
value?null | TextureNode | TextureEmptyTexture
uvNode?anynull
levelNode?anynull
biasNode?anynull

Returns

TextureNode

uniformTexture

TSL function for creating a uniform texture node.

ParameterTypeDefault Value
value?null | TextureEmptyTexture

Returns

TextureNode

textureLoad

TSL function for creating a texture node that fetches/loads texels without interpolation.

ParameterTypeDefault Value
params...Array<any>

Returns

TextureNode

textureLevel

ParameterTypeDefault Value
valueany
uvany
levelany

Returns

TextureNode

sampler

Converts a texture or texture node to a sampler.

ParameterTypeDefault Value
valueTextureNode | Texture

Returns

Node

samplerComparison

Converts a texture or texture node to a sampler comparison.

ParameterTypeDefault Value
valueTextureNode | Texture

Returns

Node

textureSize

TSL function for creating a texture size node.

ParameterTypeDefault Value
textureNodeTextureNode
levelNode?Node<int>

Returns

TextureSizeNode

uniformArray

TSL function for creating an uniform array node.

ParameterTypeDefault Value
valuesArray<any>
nodeType?null | string

Returns

UniformArrayNode

userData

TSL function for creating a user data node.

ParameterTypeDefault Value
namestring
inputTypestring
userDatanull | Object

Returns

UserDataNode

uv

TSL function for creating an uv attribute node with the given index.

ParameterTypeDefault Value
index?number

Returns

AttributeNode<vec2>

velocity

TSL object that represents the velocity of a render pass.

Type

VelocityNode

vertexColor

TSL function for creating a reference node.

ParameterTypeDefault Value
index?number0

Returns

VertexColorNode

code

TSL function for creating a code node.

ParameterTypeDefault Value
code?string
includes?Array<Node>
language?"js" | "wgsl" | "glsl"

Returns

CodeNode

js

TSL function for creating a JS code node.

ParameterTypeDefault Value
srcstring
includesArray<Node>

Returns

CodeNode

wgsl

TSL function for creating a WGSL code node.

ParameterTypeDefault Value
srcstring
includesArray<Node>

Returns

CodeNode

glsl

TSL function for creating a GLSL code node.

ParameterTypeDefault Value
srcstring
includesArray<Node>

Returns

CodeNode

expression

TSL function for creating an expression node.

ParameterTypeDefault Value
snippet?string
nodeType?string

Returns

ExpressionNode

call

ParameterTypeDefault Value
funcany
params...Array<any>

Returns

FunctionCallNode

glslFn

ParameterTypeDefault Value
codeany
includesany

Returns

{ (...params: Array<any>): any; functionNode: FunctionNode; }

wgslFn

ParameterTypeDefault Value
codeany
includesany

Returns

{ (...params: Array<any>): any; functionNode: FunctionNode; }

array

TSL function for creating an array node.

ParameterTypeDefault Value
params...Array<any>

Returns

ArrayNode

assign

TSL function for creating an assign node.

ParameterTypeDefault Value
targetNodeNode
sourceNodeNode

Returns

AssignNode

attribute

TSL function for creating an attribute node.

ParameterTypeDefault Value
namestring
nodeType?null | stringnull

Returns

AttributeNode

bypass

TSL function for creating a bypass node.

ParameterTypeDefault Value
outputNodeNode
callNodeNode

Returns

BypassNode

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>

context

TSL function for creating a context node.

ParameterTypeDefault Value
nodeOrValue?Object | Nodenull
value?Object{}

Returns

ContextNode

uniformFlow

TSL function for defining a uniformFlow context value for a given node.

ParameterTypeDefault Value
nodeNode

Returns

ContextNode

setName

TSL function for defining a name for the context value for a given node.

ParameterTypeDefault Value
nodeNode
namestring

Returns

ContextNode

builtinShadowContext

TSL function for defining a built-in shadow context for a given node.

ParameterTypeDefault Value
shadowNodeShadowNode
lightLight
node?Nodenull

Returns

ContextNode

builtinAOContext

TSL function for defining a built-in ambient occlusion context for a given node.

ParameterTypeDefault Value
aoNodeNode
node?Nodenull

Returns

ContextNode

label

TSL function for defining a label context value for a given node.

ParameterTypeDefault Value
nodeNode
namestring

Returns

ContextNode

vertexIndex

TSL object that represents the index of a vertex within a mesh.

Type

IndexNode

instanceIndex

TSL object that represents the index of either a mesh instance or an invocation of a compute shader.

Type

IndexNode

subgroupIndex

TSL object that represents the index of the subgroup the current compute invocation belongs to.

Type

IndexNode

invocationSubgroupIndex

TSL object that represents the index of a compute invocation within the scope of a subgroup.

Type

IndexNode

invocationLocalIndex

TSL object that represents the index of a compute invocation within the scope of a workgroup load.

Type

IndexNode

drawIndex

TSL object that represents the index of a draw call.

Type

IndexNode

inspector

Creates an inspector node to wrap around a given node for inspection purposes.

ParameterTypeDefault Value
nodeNode
name?string
callback?null | Functionnull

Returns

Node

isolate

TSL function for creating a cache node.

ParameterTypeDefault Value
nodeNode

Returns

IsolateNode

cache

TSL function for creating a cache node.

ParameterTypeDefault Value
nodeNode
parent?booleantrue

Returns

IsolateNode

getTextureIndex

Returns the MRT texture index for the given name.

ParameterTypeDefault Value
texturesArray<Texture>
namestring

Returns

number

mrt

TSL function for creating a MRT node.

ParameterTypeDefault Value
outputNodesObject<string, Node>

Returns

MRTNode

outputStruct

TSL function for creating an output struct node.

ParameterTypeDefault Value
members...Node

Returns

OutputStructNode

parameter

TSL function for creating a parameter node.

ParameterTypeDefault Value
typestring
namenull | string

Returns

ParameterNode

property

TSL function for creating a property node.

ParameterTypeDefault Value
typestring
name?null | stringnull

Returns

PropertyNode

varyingProperty

TSL function for creating a varying property node.

ParameterTypeDefault Value
typestring
name?null | stringnull

Returns

PropertyNode

diffuseColor

TSL object that represents the shader variable DiffuseColor.

Type

PropertyNode<vec4>

diffuseContribution

TSL object that represents the shader variable DiffuseContribution.

Type

PropertyNode<vec3>

emissive

TSL object that represents the shader variable EmissiveColor.

Type

PropertyNode<vec3>

roughness

TSL object that represents the shader variable Roughness.

Type

PropertyNode<float>

metalness

TSL object that represents the shader variable Metalness.

Type

PropertyNode<float>

clearcoat

TSL object that represents the shader variable Clearcoat.

Type

PropertyNode<float>

clearcoatRoughness

TSL object that represents the shader variable ClearcoatRoughness.

Type

PropertyNode<float>

sheen

TSL object that represents the shader variable Sheen.

Type

PropertyNode<vec3>

sheenRoughness

TSL object that represents the shader variable SheenRoughness.

Type

PropertyNode<float>

iridescence

TSL object that represents the shader variable Iridescence.

Type

PropertyNode<float>

iridescenceIOR

TSL object that represents the shader variable IridescenceIOR.

Type

PropertyNode<float>

iridescenceThickness

TSL object that represents the shader variable IridescenceThickness.

Type

PropertyNode<float>

alphaT

TSL object that represents the shader variable AlphaT.

Type

PropertyNode<float>

anisotropy

TSL object that represents the shader variable Anisotropy.

Type

PropertyNode<float>

anisotropyT

TSL object that represents the shader variable AnisotropyT.

Type

PropertyNode<vec3>

anisotropyB

TSL object that represents the shader variable AnisotropyB.

Type

PropertyNode<vec3>

specularColor

TSL object that represents the shader variable SpecularColor.

Type

PropertyNode<color>

specularColorBlended

TSL object that represents the shader variable SpecularColorBlended.

Type

PropertyNode<color>

specularF90

TSL object that represents the shader variable SpecularF90.

Type

PropertyNode<float>

shininess

TSL object that represents the shader variable Shininess.

Type

PropertyNode<float>

output

TSL object that represents the shader variable Output.

Type

PropertyNode<vec4>

dashSize

TSL object that represents the shader variable dashSize.

Type

PropertyNode<float>

gapSize

TSL object that represents the shader variable gapSize.

Type

PropertyNode<float>

pointWidth

TSL object that represents the shader variable pointWidth.

Type

PropertyNode<float>

ior

TSL object that represents the shader variable IOR.

Type

PropertyNode<float>

transmission

TSL object that represents the shader variable Transmission.

Type

PropertyNode<float>

thickness

TSL object that represents the shader variable Thickness.

Type

PropertyNode<float>

attenuationDistance

TSL object that represents the shader variable AttenuationDistance.

Type

PropertyNode<float>

attenuationColor

TSL object that represents the shader variable AttenuationColor.

Type

PropertyNode<color>

dispersion

TSL object that represents the shader variable Dispersion.

Type

PropertyNode<float>

stack

TSL function for creating a stack node.

ParameterTypeDefault Value
parent?StackNode

Returns

StackNode

struct

TSL function for creating a struct node.

ParameterTypeDefault Value
membersLayoutObject
name?null | stringnull

Returns

Function

subBuild

Creates a new sub-build node.

ParameterTypeDefault Value
nodeNode
namestring
type?null | stringnull

Returns

Node

uniformGroup

TSL function for creating a uniform group node with the given name.

ParameterTypeDefault Value
namestring
order?number1
updateType?nullnull

Returns

UniformGroupNode

sharedUniformGroup

TSL function for creating a shared uniform group node with the given name and order.

ParameterTypeDefault Value
namestring
order?number0
updateType?nullnull

Returns

UniformGroupNode

frameGroup

TSL object that represents a shared uniform group node which is updated once per frame.

Type

UniformGroupNode

renderGroup

TSL object that represents a shared uniform group node which is updated once per render.

Type

UniformGroupNode

objectGroup

TSL object that represents a uniform group node which is updated once per object.

Type

UniformGroupNode

uniform

TSL function for creating a uniform node.

ParameterTypeDefault Value
valueany
type?string

Returns

UniformNode

Var

TSL function for creating a var node.

ParameterTypeDefault Value
nodeNode
name?null | stringnull

Returns

VarNode

Const

TSL function for creating a const node.

ParameterTypeDefault Value
nodeNode
name?null | stringnull

Returns

VarNode

VarIntent

TSL function for creating a var intent node.

Properties

Node

Returns

VarNode

varying

TSL function for creating a varying node.

ParameterTypeDefault Value
nodeNode
namestring

Returns

VaryingNode

vertexStage

Computes a node in the vertex stage.

ParameterTypeDefault Value
nodeNode

Returns

VaryingNode

blendBurn

Represents a “Color Burn” blend mode.

It’s designed to darken the base layer’s colors based on the color of the blend layer. It significantly increases the contrast of the base layer, making the colors more vibrant and saturated. The darker the color in the blend layer, the stronger the darkening and contrast effect on the base layer.

ParameterTypeDefault Value
baseNode<vec3>
blendNode<vec3>

Returns

Node<vec3>

blendDodge

Represents a “Color Dodge” blend mode.

It’s designed to lighten the base layer’s colors based on the color of the blend layer. It significantly increases the brightness of the base layer, making the colors lighter and more vibrant. The brighter the color in the blend layer, the stronger the lightening and contrast effect on the base layer.

ParameterTypeDefault Value
baseNode<vec3>
blendNode<vec3>

Returns

Node<vec3>

blendScreen

Represents a “Screen” blend mode.

Similar to blendDodge(), this mode also lightens the base layer’s colors based on the color of the blend layer. The “Screen” blend mode is better for general brightening whereas the “Dodge” results in more subtle and nuanced effects.

ParameterTypeDefault Value
baseNode<vec3>
blendNode<vec3>

Returns

Node<vec3>

blendOverlay

Represents a “Overlay” blend mode.

It’s designed to increase the contrast of the base layer based on the color of the blend layer. It amplifies the existing colors and contrast in the base layer, making lighter areas lighter and darker areas darker. The color of the blend layer significantly influences the resulting contrast and color shift in the base layer.

ParameterTypeDefault Value
baseNode<vec3>
blendNode<vec3>

Returns

Node<vec3>

blendColor

This function blends two color based on their alpha values by replicating the behavior of THREE.NormalBlending. It assumes both input colors have non-premultiplied alpha.

ParameterTypeDefault Value
baseNode<vec4>
blendNode<vec4>

Returns

Node<vec4>

premultiplyAlpha

Premultiplies the RGB channels of a color by its alpha channel.

This function is useful for converting a non-premultiplied alpha color into a premultiplied alpha format, where the RGB values are scaled by the alpha value. Premultiplied alpha is often used in graphics rendering for certain operations, such as compositing and image processing.

ParameterTypeDefault Value
colorNode<vec4>

Returns

Node<vec4>

unpremultiplyAlpha

Unpremultiplies the RGB channels of a color by its alpha channel.

This function is useful for converting a premultiplied alpha color back into a non-premultiplied alpha format, where the RGB values are divided by the alpha value. Unpremultiplied alpha is often used in graphics rendering for certain operations, such as compositing and image processing.

ParameterTypeDefault Value
colorNode<vec4>

Returns

Node<vec4>

bumpMap

TSL function for creating a bump map node.

ParameterTypeDefault Value
textureNodeNode<float>
scaleNode?Node<float>

Returns

BumpMapNode

grayscale

Computes a grayscale value for the given RGB color value.

ParameterTypeDefault Value
colorNode<vec3>

Returns

Node<vec3>

saturation

Super-saturates or desaturates the given RGB color.

ParameterTypeDefault Value
colorNode<vec3>
adjustment?Node<float>

Returns

Node<vec3>

vibrance

Selectively enhance the intensity of less saturated RGB colors. Can result in a more natural and visually appealing image with enhanced color depth compared to ColorAdjustment#saturation.

ParameterTypeDefault Value
colorNode<vec3>
adjustment?Node<float>

Returns

Node<vec3>

hue

Updates the hue component of the given RGB color while preserving its luminance and saturation.

ParameterTypeDefault Value
colorNode<vec3>
adjustment?Node<float>

Returns

Node<vec3>

luminance

Computes the luminance for the given RGB color value.

ParameterTypeDefault Value
colorNode<vec3>
luminanceCoefficientsNode<vec3>

Returns

Node<float>

cdl

Color Decision List (CDL) v1.2

Compact representation of color grading information, defined by slope, offset, power, and saturation. The CDL should be typically be given input in a log space (such as LogC, ACEScc, or AgX Log), and will return output in the same space. Output may require clamping >=0.

ParameterTypeDefault Value
colorNode<vec4>
slopeNode<vec3>
offsetNode<vec3>
powerNode<vec3>
saturationNode<float>
luminanceCoefficientsNode<vec3>

Returns

Node<vec4>

posterize

TSL function for creating a posterize effect which reduces the number of colors in an image, resulting in a more blocky and stylized appearance.

ParameterTypeDefault Value
sourceNodeNode
stepsNodeNode

Returns

Node

sRGBTransferEOTF

Converts the given color value from sRGB to linear-sRGB color space.

ParameterTypeDefault Value
colorNode<vec3>

Returns

Node<vec3>

sRGBTransferOETF

Converts the given color value from linear-sRGB to sRGB color space.

ParameterTypeDefault Value
colorNode<vec3>

Returns

Node<vec3>

workingToColorSpace

TSL function for converting a given color node from the current working color space to the given color space.

ParameterTypeDefault Value
nodeNode
targetColorSpacestring

Returns

ColorSpaceNode

colorSpaceToWorking

TSL function for converting a given color node from the given color space to the current working color space.

ParameterTypeDefault Value
nodeNode
sourceColorSpacestring

Returns

ColorSpaceNode

convertColorSpace

TSL function for converting a given color node from one color space to another one.

ParameterTypeDefault Value
nodeNode
sourceColorSpacestring
targetColorSpacestring

Returns

ColorSpaceNode

frontFacing

TSL object that represents whether a primitive is front or back facing

Type

FrontFacingNode<bool>

faceDirection

TSL object that represents the front facing status as a number instead of a bool. 1 means front facing, -1 means back facing.

Type

Node<float>

directionToFaceDirection

Converts a direction vector to a face direction vector based on the material’s side.

If the material is set to BackSide, the direction is inverted. If the material is set to DoubleSide, the direction is multiplied by faceDirection.

ParameterTypeDefault Value
directionNode<vec3>

Returns

Node<vec3>

normalMap

TSL function for creating a normal map node.

ParameterTypeDefault Value
nodeNode<vec3>
scaleNode?Node<vec2>

Returns

NormalMapNode

pass

TSL function for creating a pass node.

ParameterTypeDefault Value
sceneScene
cameraCamera
optionsObject

Returns

PassNode

passTexture

TSL function for creating a pass texture node.

ParameterTypeDefault Value
passPassNode
textureTexture

Returns

PassTextureNode

depthPass

TSL function for creating a depth pass node.

ParameterTypeDefault Value
sceneScene
cameraCamera
optionsObject

Returns

PassNode

renderOutput

TSL function for creating a render output node.

ParameterTypeDefault Value
colorNode
toneMapping?null | numbernull
outputColorSpace?null | stringnull

Returns

RenderOutputNode

screenDPR

TSL object that represents the current DPR.

Type

ScreenNode<float>

screenUV

TSL object that represents normalized screen coordinates, unitless in [0, 1].

Type

ScreenNode<vec2>

screenSize

TSL object that represents the screen resolution in physical pixel units.

Type

ScreenNode<vec2>

screenCoordinate

TSL object that represents the current x/y pixel position on the screen in physical pixel units.

Type

ScreenNode<vec2>

viewport

TSL object that represents the viewport rectangle as x, y, width and height in physical pixel units.

Type

ScreenNode<vec4>

viewportSize

TSL object that represents the viewport resolution in physical pixel units.

Type

ScreenNode<vec2>

viewportCoordinate

TSL object that represents the current x/y pixel position on the viewport in physical pixel units.

Type

ScreenNode<vec2>

viewportUV

TSL object that represents normalized viewport coordinates, unitless in [0, 1].

Type

ScreenNode<vec2>

viewportResolution

Type

any

linearToneMapping

Linear tone mapping, exposure only.

ParameterTypeDefault Value
colorNode<vec3>
exposureNode<float>

Returns

Node<vec3>

reinhardToneMapping

ParameterTypeDefault Value
colorNode<vec3>
exposureNode<float>

Returns

Node<vec3>

cineonToneMapping

ParameterTypeDefault Value
colorNode<vec3>
exposureNode<float>

Returns

Node<vec3>

acesFilmicToneMapping

ParameterTypeDefault Value
colorNode<vec3>
exposureNode<float>

Returns

Node<vec3>

agxToneMapping

AgX tone mapping.

ParameterTypeDefault Value
colorNode<vec3>
exposureNode<float>

Returns

Node<vec3>

neutralToneMapping

Neutral tone mapping.

Reference: {@link https://modelviewer.dev/examples/tone-mapping}

ParameterTypeDefault Value
colorNode<vec3>
exposureNode<float>

Returns

Node<vec3>

toneMapping

TSL function for creating a tone mapping node.

ParameterTypeDefault Value
mappingnumber
exposureany
colorany

Returns

ToneMappingNode<vec3>

toneMappingExposure

TSL object that represents the global tone mapping exposure of the renderer.

Type

RendererReferenceNode<vec3>

toonOutlinePass

TSL function for creating a toon outline pass node.

ParameterTypeDefault Value
sceneScene
cameraCamera
color?Colornew Color( 0, 0, 0 )
thickness?number0.003
alpha?number1

Returns

ToonOutlinePassNode

viewZToOrthographicDepth

TSL function for converting a viewZ value to an orthographic depth value.

ParameterTypeDefault Value
viewZNode<float>
nearNode<float>
farNode<float>

Returns

Node<float>
N E W

viewZToReversedOrthographicDepth

TSL function for converting a viewZ value to a reversed orthographic depth value.

ParameterTypeDefault Value
viewZNode<float>
nearNode<float>
farNode<float>

Returns

Node<float>

orthographicDepthToViewZ

TSL function for converting an orthographic depth value to a viewZ value.

ParameterTypeDefault Value
depthNode<float>
nearNode<float>
farNode<float>

Returns

Node<float>

viewZToPerspectiveDepth

TSL function for converting a viewZ value to a perspective depth value.

Note: {link https://twitter.com/gonnavis/status/1377183786949959682}.

ParameterTypeDefault Value
viewZNode<float>
nearNode<float>
farNode<float>

Returns

Node<float>
N E W

viewZToReversedPerspectiveDepth

TSL function for converting a viewZ value to a reversed perspective depth value.

ParameterTypeDefault Value
viewZNode<float>
nearNode<float>
farNode<float>

Returns

Node<float>

perspectiveDepthToViewZ

TSL function for converting a perspective depth value to a viewZ value.

ParameterTypeDefault Value
depthNode<float>
nearNode<float>
farNode<float>

Returns

Node<float>

viewZToLogarithmicDepth

TSL function for converting a viewZ value to a logarithmic depth value.

ParameterTypeDefault Value
viewZNode<float>
nearNode<float>
farNode<float>

Returns

Node<float>

logarithmicDepthToViewZ

TSL function for converting a logarithmic depth value to a viewZ value.

ParameterTypeDefault Value
depthNode<float>
nearNode<float>
farNode<float>

Returns

Node<float>

depth

TSL object that represents the depth value for the current fragment.

Type

ViewportDepthNode

linearDepth

TSL function for converting a perspective depth value to linear depth.

ParameterTypeDefault Value
value?Node<float>

Returns

ViewportDepthNode<float>

viewportLinearDepth

TSL object that represents the linear (orthographic) depth value of the current fragment

Type

ViewportDepthNode

viewportDepthTexture

TSL function for a viewport depth texture node.

ParameterTypeDefault Value
uvNode?Node
levelNode?Node
depthTexture?DepthTexture

Returns

ViewportDepthTextureNode

viewportSharedTexture

TSL function for creating a shared viewport texture node.

ParameterTypeDefault Value
uvNode?Node
levelNode?Node

Returns

ViewportSharedTextureNode

viewportTexture

TSL function for creating a viewport texture node.

ParameterTypeDefault Value
uvNode?Node
levelNode?Node
framebufferTexture?Texture

Returns

ViewportTextureNode

viewportMipTexture

TSL function for creating a viewport texture node with enabled mipmap generation.

ParameterTypeDefault Value
uvNode?Node
levelNode?Node
framebufferTexture?Texture

Returns

ViewportTextureNode

viewportOpaqueMipTexture

TSL function for creating a viewport texture node with enabled mipmap generation. The texture should only contain the opaque rendering objects.

This should be used just in transparent or transmissive materials.

ParameterTypeDefault Value
uv?null | NodescreenUV
level?null | Nodenull

Returns

ViewportTextureNode

rangeFogFactor

Constructs a new range factor node.

ParameterTypeDefault Value
nearNode
farNode

Returns

any

densityFogFactor

Represents an exponential squared fog. This type of fog gives a clear view near the camera and a faster than exponentially densening fog farther from the camera.

ParameterTypeDefault Value
densityNode

Returns

any
N E W

exponentialHeightFogFactor

Constructs a new height fog factor node. This fog factor requires a Y-up coordinate system.

ParameterTypeDefault Value
densityNode
heightNode

Returns

any

fog

This class can be used to configure a fog for the scene. Nodes of this type are assigned to Scene.fogNode.

ParameterTypeDefault Value
colorNode
factorNode

Returns

any

BRDF_GGX

Returns

void

BRDF_Lambert

Returns

void

D_GGX

Type

any
N E W

DFGLUT

Returns

void

F_Schlick

Returns

void

Schlick_to_F0

Type

any

V_GGX_SmithCorrelated

Type

any

getGeometryRoughness

Returns

void

getParallaxCorrectNormal

This computes a parallax corrected normal which is used for box-projected cube mapping (BPCEM).

Reference: {@link https://devlog-martinsh.blogspot.com/2011/09/box-projected-cube-environment-mapping.html}

const uvNode = getParallaxCorrectNormal( reflectVector, vec3( 200, 100, 100 ), vec3( 0, - 50, 0 ) );
material.envNode = pmremTexture( renderTarget.texture, uvNode );
export {}
ParameterTypeDefault Value
normalNode<vec3>
cubeSizeNode<vec3>
cubePosNode<vec3>

Returns

Node<vec3>

getRoughness

Returns

void

getShIrradianceAt

Returns

void

range

TSL function for creating a range node.

ParameterTypeDefault Value
minNode?Node<any>
maxNode?Node<any>

Returns

RangeNode

atomicFunc

TSL function for appending an atomic function call into the programmatic flow of a compute shader.

ParameterTypeDefault Value
methodstring
pointerNodeNode
valueNodeNode

Returns

AtomicFunctionNode

atomicLoad

Loads the value stored in the atomic variable.

ParameterTypeDefault Value
pointerNodeNode

Returns

AtomicFunctionNode

atomicStore

Stores a value in the atomic variable.

ParameterTypeDefault Value
pointerNodeNode
valueNodeNode

Returns

AtomicFunctionNode

atomicAdd

Increments the value stored in the atomic variable.

ParameterTypeDefault Value
pointerNodeNode
valueNodeNode

Returns

AtomicFunctionNode

atomicSub

Decrements the value stored in the atomic variable.

ParameterTypeDefault Value
pointerNodeNode
valueNodeNode

Returns

AtomicFunctionNode

atomicMax

Stores in an atomic variable the maximum between its current value and a parameter.

ParameterTypeDefault Value
pointerNodeNode
valueNodeNode

Returns

AtomicFunctionNode

atomicMin

Stores in an atomic variable the minimum between its current value and a parameter.

ParameterTypeDefault Value
pointerNodeNode
valueNodeNode

Returns

AtomicFunctionNode

atomicAnd

Stores in an atomic variable the bitwise AND of its value with a parameter.

ParameterTypeDefault Value
pointerNodeNode
valueNodeNode

Returns

AtomicFunctionNode

atomicOr

Stores in an atomic variable the bitwise OR of its value with a parameter.

ParameterTypeDefault Value
pointerNodeNode
valueNodeNode

Returns

AtomicFunctionNode

atomicXor

Stores in an atomic variable the bitwise XOR of its value with a parameter.

ParameterTypeDefault Value
pointerNodeNode
valueNodeNode

Returns

AtomicFunctionNode

workgroupBarrier

TSL function for creating a workgroup barrier. All compute shader invocations must wait for each invocation within a workgroup to complete before the barrier can be surpassed.

Returns

BarrierNode

storageBarrier

TSL function for creating a storage barrier. All invocations must wait for each access to variables within the ‘storage’ address space to complete before the barrier can be passed.

Returns

BarrierNode

textureBarrier

TSL function for creating a texture barrier. All invocations must wait for each access to variables within the ‘texture’ address space to complete before the barrier can be passed.

Returns

BarrierNode

numWorkgroups

Represents the number of workgroups dispatched by the compute shader.

// Run 512 invocations/threads with a workgroup size of 128.
const computeFn = Fn(() => {
Cannot redeclare block-scoped variable 'computeFn'. (2451)
    // numWorkgroups.x = 4
    storageBuffer.element(0).assign(numWorkgroups.x)

})().compute(512, [128]);

// Run 512 invocations/threads with the default workgroup size of 64.
const computeFn = Fn(() => {
Cannot redeclare block-scoped variable 'computeFn'. (2451)
    // numWorkgroups.x = 8
    storageBuffer.element(0).assign(numWorkgroups.x)

})().compute(512);
export {}

Type

ComputeBuiltinNode<uvec3>

workgroupId

Represents the 3-dimensional index of the workgroup the current compute invocation belongs to.

// Execute 12 compute threads with a workgroup size of 3.
const computeFn = Fn( () => {

	If( workgroupId.x.mod( 2 ).equal( 0 ), () => {

		storageBuffer.element( instanceIndex ).assign( instanceIndex );

	} ).Else( () => {

		storageBuffer.element( instanceIndex ).assign( 0 );

	} );

} )().compute( 12, [ 3 ] );

// workgroupId.x =  [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3];
// Buffer Output =  [0, 1, 2, 0, 0, 0, 6, 7, 8, 0, 0, 0];
export {}

Type

ComputeBuiltinNode<uvec3>

globalId

A non-linearized 3-dimensional representation of the current invocation’s position within a 3D global grid.

Type

ComputeBuiltinNode<uvec3>

localId

A non-linearized 3-dimensional representation of the current invocation’s position within a 3D workgroup grid.

Type

ComputeBuiltinNode<uvec3>

subgroupSize

A device dependent variable that exposes the size of the current invocation’s subgroup.

Type

ComputeBuiltinNode<uint>

computeKernel

TSL function for creating a compute kernel node.

ParameterTypeDefault Value
nodeNode
workgroupSize?Array<number>[64]

Returns

ComputeNode

compute

TSL function for creating a compute node.

ParameterTypeDefault Value
nodeNode
countnumber | Array<number>
workgroupSize?Array<number>[64

Returns

ComputeNode

subgroupElect

Returns true if this invocation has the lowest subgroup_invocation_id among active invocations in the subgroup.

Returns

bool

subgroupBallot

Returns a set of bitfields where the bit corresponding to subgroup_invocation_id is 1 if pred is true for that active invocation and 0 otherwise.

ParameterTypeDefault Value
predbool

Returns

vec4<u32>

subgroupAdd

A reduction that adds e among all active invocations and returns that result.

ParameterTypeDefault Value
enumber

Returns

number

subgroupInclusiveAdd

An inclusive scan returning the sum of e for all active invocations with subgroup_invocation_id less than or equal to this invocation.

ParameterTypeDefault Value
enumber

Returns

number

subgroupExclusiveAdd

An exclusive scan that returns the sum of e for all active invocations with subgroup_invocation_id less than this invocation.

ParameterTypeDefault Value
enumber

Returns

number

subgroupMul

A reduction that multiplies e among all active invocations and returns that result.

ParameterTypeDefault Value
enumber

Returns

number

subgroupInclusiveMul

An inclusive scan returning the product of e for all active invocations with subgroup_invocation_id less than or equal to this invocation.

ParameterTypeDefault Value
enumber

Returns

number

subgroupExclusiveMul

An exclusive scan that returns the product of e for all active invocations with subgroup_invocation_id less than this invocation.

ParameterTypeDefault Value
enumber

Returns

number

subgroupAnd

A reduction that performs a bitwise and of e among all active invocations and returns that result.

ParameterTypeDefault Value
enumber

Returns

number

subgroupOr

A reduction that performs a bitwise or of e among all active invocations and returns that result.

ParameterTypeDefault Value
enumber

Returns

number

subgroupXor

A reduction that performs a bitwise xor of e among all active invocations and returns that result.

ParameterTypeDefault Value
enumber

Returns

number

subgroupMin

A reduction that performs a min of e among all active invocations and returns that result.

ParameterTypeDefault Value
enumber

Returns

number

subgroupMax

A reduction that performs a max of e among all active invocations and returns that result.

ParameterTypeDefault Value
enumber

Returns

number

subgroupAll

Returns true if e is true for all active invocations in the subgroup.

Returns

bool

subgroupAny

Returns true if e is true for any active invocation in the subgroup

Returns

bool

subgroupBroadcastFirst

Broadcasts e from the active invocation with the lowest subgroup_invocation_id in the subgroup to all other active invocations.

ParameterTypeDefault Value
enumber
idnumber

Returns

number

quadSwapX

Swaps e between invocations in the quad in the X direction.

ParameterTypeDefault Value
enumber

Returns

number

quadSwapY

Swaps e between invocations in the quad in the Y direction.

ParameterTypeDefault Value
enumber

Returns

number

quadSwapDiagonal

Swaps e between invocations in the quad diagonally.

ParameterTypeDefault Value
enumber

Returns

number

subgroupBroadcast

Broadcasts e from the invocation whose subgroup_invocation_id matches id, to all active invocations.

ParameterTypeDefault Value
enumber
idnumber

Returns

number

subgroupShuffle

Returns v from the active invocation whose subgroup_invocation_id matches id

ParameterTypeDefault Value
vnumber
idnumber

Returns

number

subgroupShuffleXor

Returns v from the active invocation whose subgroup_invocation_id matches subgroup_invocation_id ^ mask.

ParameterTypeDefault Value
vnumber
masknumber

Returns

number

subgroupShuffleUp

Returns v from the active invocation whose subgroup_invocation_id matches subgroup_invocation_id - delta

ParameterTypeDefault Value
vnumber
deltanumber

Returns

number

subgroupShuffleDown

Returns v from the active invocation whose subgroup_invocation_id matches subgroup_invocation_id + delta

ParameterTypeDefault Value
vnumber
deltanumber

Returns

number

quadBroadcast

Broadcasts e from the quad invocation with id equal to id.

ParameterTypeDefault Value
enumber

Returns

number

workgroupArray

TSL function for creating a workgroup info node. Creates a new ‘workgroup’ scoped array buffer.

ParameterTypeDefault Value
typestring
count?number0

Returns

WorkgroupInfoNode

lightingContext

Type

any

lights

TSL function for creating an instance of LightsNode and configuring it with the given array of lights.

ParameterTypeDefault Value
lights?Array<Light>[]

Returns

LightsNode

getDistanceAttenuation

Represents a discard shader operation in TSL.

ParameterTypeDefault Value
inputsObject
inputs.lightDistanceNode<float>
inputs.cutoffDistanceNode<float>
inputs.decayExponentNode<float>

Returns

Node<float>

directPointLight

ParameterTypeDefault Value
{ color, lightVector, cutoffDistance, decayExponent }{ color: any; lightVector: any; cutoffDistance: any; decayExponent: any; }

Returns

PropertyTypeModifiers
lightDirectionany
lightColorany

BasicPointShadowFilter

Returns

void

PointShadowFilter

A shadow filtering function for point lights using Vogel disk sampling and IGN.

Uses 5 samples distributed via Vogel disk pattern in tangent space around the sample direction, rotated per-pixel using Interleaved Gradient Noise (IGN).

ParameterTypeDefault Value
inputsObject
inputs.depthTextureCubeDepthTexture
inputs.bd3DNode<vec3>
inputs.dpNode<float>
inputs.shadowLightShadow

Returns

Node<float>

pointShadow

TSL function for creating an instance of PointShadowNode.

ParameterTypeDefault Value
lightPointLight
shadow?anynull

Returns

PointShadowNode

shadowPositionWorld

TSL object that represents the vertex position in world space during the shadow pass.

Type

Node<vec3>

BasicShadowFilter

A shadow filtering function performing basic filtering. This is in fact an unfiltered version of the shadow map with a binary [0,1] result.

ParameterTypeDefault Value
inputsObject
inputs.depthTextureDepthTexture
inputs.shadowCoordNode<vec3>

Returns

Node<float>

PCFShadowFilter

A shadow filtering function performing PCF filtering with Vogel disk sampling and IGN.

Uses 5 samples distributed via Vogel disk pattern, rotated per-pixel using Interleaved Gradient Noise (IGN) to break up banding artifacts. Combined with hardware PCF (4-tap filtering per sample), this effectively provides 20 filtered taps with better distribution.

ParameterTypeDefault Value
inputsObject
inputs.depthTextureDepthTexture
inputs.shadowCoordNode<vec3>
inputs.shadowLightShadow

Returns

Node<float>

PCFSoftShadowFilter

A shadow filtering function performing PCF soft filtering.

ParameterTypeDefault Value
inputsObject
inputs.depthTextureDepthTexture
inputs.shadowCoordNode<vec3>
inputs.shadowLightShadow

Returns

Node<float>

VSMShadowFilter

A shadow filtering function performing VSM filtering.

ParameterTypeDefault Value
inputsObject
inputs.depthTextureDepthTexture
inputs.shadowCoordNode<vec3>

Returns

Node<float>

getShadowMaterial

Retrieves or creates a shadow material for the given light source.

This function checks if a shadow material already exists for the provided light. If not, it creates a new NodeMaterial configured for shadow rendering and stores it in the shadowMaterialLib for future use.

ParameterTypeDefault Value
lightLight

Returns

NodeMaterial

disposeShadowMaterial

Disposes the shadow material for the given light source.

ParameterTypeDefault Value
lightLight

Returns

any

getShadowRenderObjectFunction

Creates a function to render shadow objects in a scene.

ParameterTypeDefault Value
rendererRenderer
shadowLightShadow
shadowTypenumber
useVelocityboolean

Returns

shadowRenderObjectFunction

shadow

Shadow Render Object Function.

TSL function for creating an instance of ShadowNode.

ParameterTypeDefault Value
lightLight
shadow?any

Returns

ShadowNode

mx_aastep

ParameterTypeDefault Value
thresholdany
valueany

Returns

any

mx_ramplr

ParameterTypeDefault Value
valuelany
valuerany
texcoord?AttributeNode<vec2>uv()

Returns

any

mx_ramptb

ParameterTypeDefault Value
valuetany
valuebany
texcoord?AttributeNode<vec2>uv()

Returns

any

mx_ramp4

ParameterTypeDefault Value
valuetlany
valuetrany
valueblany
valuebrany
texcoord?AttributeNode<vec2>uv()

Returns

any

mx_splitlr

ParameterTypeDefault Value
valuelany
valuerany
centerany
texcoord?AttributeNode<vec2>uv()

Returns

any

mx_splittb

ParameterTypeDefault Value
valuetany
valuebany
centerany
texcoord?AttributeNode<vec2>uv()

Returns

any

mx_transform_uv

ParameterTypeDefault Value
uv_scale?number1
uv_offset?number0
uv_geo?AttributeNode<vec2>uv()

Returns

any

mx_safepower

ParameterTypeDefault Value
in1any
in2?number1

Returns

any

mx_contrast

ParameterTypeDefault Value
inputany
amount?number1
pivot?number0.5

Returns

any

mx_noise_float

ParameterTypeDefault Value
texcoord?AttributeNode<vec2>uv()
amplitude?number1
pivot?number0

Returns

any

mx_noise_vec3

ParameterTypeDefault Value
texcoord?AttributeNode<vec2>uv()
amplitude?number1
pivot?number0

Returns

any

mx_noise_vec4

ParameterTypeDefault Value
texcoord?AttributeNode<vec2>uv()
amplitude?number1
pivot?number0

Returns

any

mx_unifiednoise2d

ParameterTypeDefault Value
noiseTypeany
texcoord?AttributeNode<vec2>uv()
freq?anyvec2( 1, 1 )
offset?anyvec2( 0, 0 )
jitter?number1
outmin?number0
outmax?number1
clampoutput?booleanfalse
octaves?number1
lacunarity?number2
diminish?number0.5

Returns

any

mx_unifiednoise3d

ParameterTypeDefault Value
noiseTypeany
texcoord?AttributeNode<vec2>uv()
freq?anyvec2( 1, 1 )
offset?anyvec2( 0, 0 )
jitter?number1
outmin?number0
outmax?number1
clampoutput?booleanfalse
octaves?number1
lacunarity?number2
diminish?number0.5

Returns

any

mx_worley_noise_float

ParameterTypeDefault Value
texcoord?AttributeNode<vec2>uv()
jitter?number1

Returns

any

mx_worley_noise_vec2

ParameterTypeDefault Value
texcoord?AttributeNode<vec2>uv()
jitter?number1

Returns

any

mx_worley_noise_vec3

ParameterTypeDefault Value
texcoord?AttributeNode<vec2>uv()
jitter?number1

Returns

any

mx_cell_noise_float

ParameterTypeDefault Value
texcoord?AttributeNode<vec2>uv()

Returns

any

mx_fractal_noise_float

ParameterTypeDefault Value
position?AttributeNode<vec2>uv()
octaves?number3
lacunarity?number2
diminish?number0.5
amplitude?number1

Returns

any

mx_fractal_noise_vec2

ParameterTypeDefault Value
position?AttributeNode<vec2>uv()
octaves?number3
lacunarity?number2
diminish?number0.5
amplitude?number1

Returns

any

mx_fractal_noise_vec3

ParameterTypeDefault Value
position?AttributeNode<vec2>uv()
octaves?number3
lacunarity?number2
diminish?number0.5
amplitude?number1

Returns

any

mx_fractal_noise_vec4

ParameterTypeDefault Value
position?AttributeNode<vec2>uv()
octaves?number3
lacunarity?number2
diminish?number0.5
amplitude?number1

Returns

any

Type

any

Type

any

Type

any

mx_add

ParameterTypeDefault Value
in1any
in2?anyfloat( 0 )

Returns

any

mx_subtract

ParameterTypeDefault Value
in1any
in2?anyfloat( 0 )

Returns

any

mx_multiply

ParameterTypeDefault Value
in1any
in2?anyfloat( 1 )

Returns

any

mx_divide

ParameterTypeDefault Value
in1any
in2?anyfloat( 1 )

Returns

any

mx_modulo

ParameterTypeDefault Value
in1any
in2?anyfloat( 1 )

Returns

any

mx_power

ParameterTypeDefault Value
in1any
in2?anyfloat( 1 )

Returns

any

mx_atan2

ParameterTypeDefault Value
in1?anyfloat( 0 )
in2?anyfloat( 1 )

Returns

any

mx_timer

Returns

UniformNode<float>

mx_frame

Returns

UniformNode<uint>

mx_invert

ParameterTypeDefault Value
in1any
amount?anyfloat( 1 )

Returns

any

mx_ifgreater

ParameterTypeDefault Value
value1any
value2any
in1any
in2any

Returns

any

mx_ifgreatereq

ParameterTypeDefault Value
value1any
value2any
in1any
in2any

Returns

any

mx_ifequal

ParameterTypeDefault Value
value1any
value2any
in1any
in2any

Returns

any

mx_separate

ParameterTypeDefault Value
in1any
channelOrOut?nullnull

Returns

any

mx_place2d

ParameterTypeDefault Value
texcoordany
pivot?anyvec2( 0.5, 0.5 )
scale?anyvec2( 1, 1 )
rotate?anyfloat( 0 )
offset?anyvec2( 0, 0 )

Returns

any

mx_rotate2d

ParameterTypeDefault Value
inputany
amountany

Returns

any

mx_rotate3d

ParameterTypeDefault Value
inputany
amountany
axisany

Returns

any

mx_heighttonormal

ParameterTypeDefault Value
inputany
scaleany

Returns

any

bitcast

Reinterpret the bit representation of a value in one type as a value in another type.

ParameterTypeDefault Value
xNode | number
ystring

Returns

Node

floatBitsToInt

Bitcasts a float or a vector of floats to a corresponding integer type with the same element size.

ParameterTypeDefault Value
valueNode<float>

Returns

BitcastNode

floatBitsToUint

Bitcasts a float or a vector of floats to a corresponding unsigned integer type with the same element size.

ParameterTypeDefault Value
valueNode<float>

Returns

BitcastNode

intBitsToFloat

Bitcasts an integer or a vector of integers to a corresponding float type with the same element size.

ParameterTypeDefault Value
valueNode<int>

Returns

BitcastNode

uintBitsToFloat

Bitcast an unsigned integer or a vector of unsigned integers to a corresponding float type with the same element size.

ParameterTypeDefault Value
valueNode<uint>

Returns

BitcastNode

countTrailingZeros

Finds the number of consecutive 0 bits from the least significant bit of the input value, which is also the index of the least significant bit of the input value.

Can only be used with WebGPURenderer and a WebGPU backend.

ParameterTypeDefault Value
xNode | number

Returns

Node

countLeadingZeros

Finds the number of consecutive 0 bits starting from the most significant bit of the input value.

Can only be used with WebGPURenderer and a WebGPU backend.

ParameterTypeDefault Value
xNode | number

Returns

Node

countOneBits

Finds the number of ’1’ bits set in the input value

Can only be used with WebGPURenderer and a WebGPU backend.

Returns

Node

select

TSL function for creating a conditional node.

ParameterTypeDefault Value
condNodeNode
ifNodeNode
elseNode?Node

Returns

ConditionalNode

hash

Generates a hash value in the range [0, 1] from the given seed.

ParameterTypeDefault Value
seedNode<float>

Returns

Node<float>

EPSILON

A small value used to handle floating-point precision errors.

Type

Node<float>

INFINITY

Represents infinity.

Type

Node<float>

PI

Represents PI.

Type

Node<float>

PI2

Represents PI * 2. Please use the non-deprecated version TWO_PI.

Type

Node<float>

TWO_PI

Represents PI * 2.

Type

Node<float>

HALF_PI

Represents PI / 2.

Type

Node<float>

all

Returns true if all components of x are true.

ParameterTypeDefault Value
xNode | number

Returns

Node<bool>

any

Returns true if any components of x are true.

ParameterTypeDefault Value
xNode | number

Returns

Node<bool>

radians

Converts a quantity in degrees to radians.

ParameterTypeDefault Value
xNode | number

Returns

Node

degrees

Convert a quantity in radians to degrees.

ParameterTypeDefault Value
xNode | number

Returns

Node

exp

Returns the natural exponentiation of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

exp2

Returns 2 raised to the power of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

log

Returns the natural logarithm of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

log2

Returns the base 2 logarithm of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

sqrt

Returns the square root of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

inverseSqrt

Returns the inverse of the square root of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

floor

Finds the nearest integer less than or equal to the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

ceil

Finds the nearest integer that is greater than or equal to the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

normalize

Calculates the unit vector in the same direction as the original vector.

ParameterTypeDefault Value
xNode

Returns

Node

fract

Computes the fractional part of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

sin

Returns the sine of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node
N E W

sinh

Returns the hyperbolic sine of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

cos

Returns the cosine of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node
N E W

cosh

Returns the hyperbolic cosine of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

tan

Returns the tangent of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node
N E W

tanh

Returns the hyperbolic tangent of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

asin

Returns the arcsine of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node
N E W

asinh

Returns the inverse hyperbolic sine of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

acos

Returns the arccosine of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node
N E W

acosh

Returns the inverse hyperbolic cosine of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

atan

Returns the arc-tangent of the parameter. If two parameters are provided, the result is atan2(y/x).

ParameterTypeDefault Value
yNode | number
xNode | number

Returns

Node
N E W

atanh

Returns the inverse hyperbolic tangent of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

abs

Returns the absolute value of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

sign

Extracts the sign of the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

length

Calculates the length of a vector.

ParameterTypeDefault Value
xNode

Returns

Node<float>

negate

Negates the value of the parameter (-x).

ParameterTypeDefault Value
xNode | number

Returns

Node

oneMinus

Return 1 minus the parameter.

ParameterTypeDefault Value
xNode | number

Returns

Node

dFdx

Returns the partial derivative of the parameter with respect to x.

ParameterTypeDefault Value
xNode | number

Returns

Node

dFdy

Returns the partial derivative of the parameter with respect to y.

ParameterTypeDefault Value
xNode | number

Returns

Node

round

Rounds the parameter to the nearest integer.

ParameterTypeDefault Value
xNode | number

Returns

Node

reciprocal

Returns the reciprocal of the parameter (1/x).

ParameterTypeDefault Value
xNode | number

Returns

Node

trunc

Truncates the parameter, removing the fractional part.

ParameterTypeDefault Value
xNode | number

Returns

Node

fwidth

Returns the sum of the absolute derivatives in x and y.

ParameterTypeDefault Value
xNode | number

Returns

Node

transpose

Returns the transpose of a matrix.

ParameterTypeDefault Value
xNode<mat2|mat3|mat4>

Returns

Node

determinant

Returns the determinant of a matrix.

ParameterTypeDefault Value
xNode<mat2|mat3|mat4>

Returns

Node<float>

inverse

Returns the inverse of a matrix.

ParameterTypeDefault Value
xNode<mat2|mat3|mat4>

Returns

Node<mat2|mat3|mat4>

min

Returns the least of the given values.

ParameterTypeDefault Value
values...Node | number

Returns

Node

max

Returns the greatest of the given values.

ParameterTypeDefault Value
values...Node | number

Returns

Node

step

Generate a step function by comparing two values.

ParameterTypeDefault Value
xNode | number
yNode | number

Returns

Node

reflect

Calculates the reflection direction for an incident vector.

ParameterTypeDefault Value
INode<vec2|vec3|vec4>
NNode<vec2|vec3|vec4>

Returns

Node<vec2|vec3|vec4>

distance

Calculates the distance between two points.

ParameterTypeDefault Value
xNode<vec2|vec3|vec4>
yNode<vec2|vec3|vec4>

Returns

Node<float>

difference

Calculates the absolute difference between two values.

ParameterTypeDefault Value
xNode | number
yNode | number

Returns

Node

dot

Calculates the dot product of two vectors.

ParameterTypeDefault Value
xNode<vec2|vec3|vec4>
yNode<vec2|vec3|vec4>

Returns

Node<float>

cross

Calculates the cross product of two vectors.

ParameterTypeDefault Value
xNode<vec2|vec3>
yNode<vec2|vec3>

Returns

Node<float|vec3>

pow

Return the value of the first parameter raised to the power of the second one.

ParameterTypeDefault Value
xNode | number
yNode | number

Returns

Node

pow2

Returns the square of the parameter.

ParameterTypeDefault Value
xnumber | Node

Returns

Node

pow3

Returns the cube of the parameter.

ParameterTypeDefault Value
xnumber | Node

Returns

Node

pow4

Returns the fourth power of the parameter.

ParameterTypeDefault Value
xnumber | Node

Returns

Node

transformDirection

Transforms the direction of a vector by a matrix and then normalizes the result.

ParameterTypeDefault Value
directionNode<vec2|vec3|vec4>
matrixNode<mat2|mat3|mat4>

Returns

Node

cbrt

Returns the cube root of a number.

ParameterTypeDefault Value
anumber | Node

Returns

Node

lengthSq

Calculate the squared length of a vector.

ParameterTypeDefault Value
aNode<vec2|vec3|vec4>

Returns

Node<float>

mix

Linearly interpolates between two values.

ParameterTypeDefault Value
aNode | number
bNode | number
tNode | number

Returns

Node

clamp

Constrains a value to lie between two further values.

ParameterTypeDefault Value
valuenumber | Node
low?number | Node0
high?number | Node1

Returns

Node

saturate

Constrains a value between 0 and 1.

ParameterTypeDefault Value
valuenumber | Node

Returns

Node

refract

Calculates the refraction direction for an incident vector.

ParameterTypeDefault Value
INode<vec2|vec3|vec4>
NNode<vec2|vec3|vec4>
etaNode<float>

Returns

Node<vec2|vec3|vec4>

smoothstep

Performs a Hermite interpolation between two values.

ParameterTypeDefault Value
lowNode | number
highNode | number
xNode | number

Returns

Node

faceForward

Returns a vector pointing in the same direction as another.

ParameterTypeDefault Value
NNode<vec2|vec3|vec4>
INode<vec2|vec3|vec4>
NrefNode<vec2|vec3|vec4>

Returns

Node<vec2|vec3|vec4>

rand

Returns a random value for the given uv.

ParameterTypeDefault Value
uvNode<vec2>

Returns

Node<float>

mixElement

Alias for mix() with a different parameter order.

ParameterTypeDefault Value
tnumber | Node
e1number | Node
e2number | Node

Returns

Node

smoothstepElement

Alias for smoothstep() with a different parameter order.

ParameterTypeDefault Value
xnumber | Node
lownumber | Node
highnumber | Node

Returns

Node

stepElement

Alias for step() with a different parameter order.

ParameterTypeDefault Value
xnumber | Node
edgenumber | Node

Returns

Node

faceforward

Type

any

inversesqrt

Type

any

parabola

A function that remaps the [0,1] interval into the [0,1] interval. The corners are mapped to 0 and the center to 1. Reference: {@link https://iquilezles.org/articles/functions/}.

ParameterTypeDefault Value
xNode<float>
kNode<float>

Returns

Node<float>

gain

A function that remaps the [0,1] interval into the [0,1] interval. Expands the sides and compresses the center, and keeps 0.5 mapped to 0.5. Reference: {@link https://iquilezles.org/articles/functions/}.

ParameterTypeDefault Value
xNode<float>
kNode<float>

Returns

Node<float>

pcurve

A function that remaps the [0,1] interval into the [0,1] interval. A generalization of the parabola(). Keeps the corners mapped to 0 but allows the control of the shape one either side of the curve. Reference: {@link https://iquilezles.org/articles/functions/}.

ParameterTypeDefault Value
xNode<float>
aNode<float>
bNode<float>

Returns

Node<float>

sinc

A phase shifted sinus curve that starts at zero and ends at zero, with bouncing behavior. Reference: {@link https://iquilezles.org/articles/functions/}.

ParameterTypeDefault Value
xNode<float>
kNode<float>

Returns

Node<float>

add

Returns the addition of two or more value.

ParameterTypeDefault Value
aNode
bNode
params...Node

Returns

OperatorNode

sub

Returns the subtraction of two or more value.

ParameterTypeDefault Value
aNode
bNode
params...Node

Returns

OperatorNode

mul

Returns the multiplication of two or more value.

ParameterTypeDefault Value
aNode
bNode
params...Node

Returns

OperatorNode

div

Returns the division of two or more value.

ParameterTypeDefault Value
aNode
bNode
params...Node

Returns

OperatorNode

mod

Computes the remainder of dividing the first node by the second one.

ParameterTypeDefault Value
aNode
bNode

Returns

OperatorNode

equal

Checks if two nodes are equal.

ParameterTypeDefault Value
aNode
bNode

Returns

OperatorNode

notEqual

Checks if two nodes are not equal.

ParameterTypeDefault Value
aNode
bNode

Returns

OperatorNode

lessThan

Checks if the first node is less than the second.

ParameterTypeDefault Value
aNode
bNode

Returns

OperatorNode

greaterThan

Checks if the first node is greater than the second.

ParameterTypeDefault Value
aNode
bNode

Returns

OperatorNode

lessThanEqual

Checks if the first node is less than or equal to the second.

ParameterTypeDefault Value
aNode
bNode

Returns

OperatorNode

greaterThanEqual

Checks if the first node is greater than or equal to the second.

ParameterTypeDefault Value
aNode
bNode

Returns

OperatorNode

and

Performs a logical AND operation on multiple nodes.

ParameterTypeDefault Value
nodes...Node

Returns

OperatorNode

or

Performs a logical OR operation on multiple nodes.

ParameterTypeDefault Value
nodes...Node

Returns

OperatorNode

not

Performs logical NOT on a node.

ParameterTypeDefault Value
valueNode

Returns

OperatorNode

xor

Performs logical XOR on two nodes.

ParameterTypeDefault Value
aNode
bNode

Returns

OperatorNode

bitAnd

Performs bitwise AND on two nodes.

ParameterTypeDefault Value
aNode
bNode

Returns

OperatorNode

bitNot

Performs bitwise NOT on a node.

ParameterTypeDefault Value
aNode
bNode

Returns

OperatorNode

bitOr

Performs bitwise OR on two nodes.

ParameterTypeDefault Value
aNode
bNode

Returns

OperatorNode

bitXor

Performs bitwise XOR on two nodes.

ParameterTypeDefault Value
aNode
bNode

Returns

OperatorNode

shiftLeft

Shifts a node to the left.

ParameterTypeDefault Value
aNode
bNode

Returns

OperatorNode

shiftRight

Shifts a node to the right.

ParameterTypeDefault Value
aNode
bNode

Returns

OperatorNode

incrementBefore

Increments a node by 1.

ParameterTypeDefault Value
aNode

Returns

OperatorNode

decrementBefore

Decrements a node by 1.

ParameterTypeDefault Value
aNode

Returns

OperatorNode

increment

Increments a node by 1 and returns the previous value.

ParameterTypeDefault Value
aNode

Returns

OperatorNode

decrement

Decrements a node by 1 and returns the previous value.

ParameterTypeDefault Value
aNode

Returns

OperatorNode

modInt

ParameterTypeDefault Value
aNode
bNode

Returns

OperatorNode

packSnorm2x16

Converts each component of the normalized float to 16-bit integer values. The results are packed into a single unsigned integer. round(clamp(c, -1, +1) * 32767.0)

ParameterTypeDefault Value
valueNode<vec2>

Returns

Node

packUnorm2x16

Converts each component of the normalized float to 16-bit integer values. The results are packed into a single unsigned integer. round(clamp(c, 0, +1) * 65535.0)

ParameterTypeDefault Value
valueNode<vec2>

Returns

Node

packHalf2x16

Converts each component of the vec2 to 16-bit floating-point values. The results are packed into a single unsigned integer.

ParameterTypeDefault Value
valueNode<vec2>

Returns

Node

triNoise3D

Generates a noise value from the given position, speed and time parameters.

ParameterTypeDefault Value
positionNode<vec3>
speedNode<float>
timeNode<float>

Returns

Node<float>

unpackSnorm2x16

Unpacks a 32-bit unsigned integer into two 16-bit values, interpreted as normalized signed integers. Returns a vec2 with both values.

ParameterTypeDefault Value
valueNode<uint>

Returns

Node

unpackUnorm2x16

Unpacks a 32-bit unsigned integer into two 16-bit values, interpreted as normalized unsigned integers. Returns a vec2 with both values.

ParameterTypeDefault Value
valueNode<uint>

Returns

Node

unpackHalf2x16

Unpacks a 32-bit unsigned integer into two 16-bit values, interpreted as 16-bit floating-point numbers. Returns a vec2 with both values.

ParameterTypeDefault Value
valueNode<uint>

Returns

Node

pmremTexture

TSL function for creating a PMREM node.

ParameterTypeDefault Value
valueTexture
uvNode?Node<vec2>
levelNode?Node<float>

Returns

PMREMNode

getDirection

Type

any

textureCubeUV

Returns

void

blur

Returns

void

ggxConvolution

Returns

void

checker

Creates a 2x2 checkerboard pattern that can be used as procedural texture data.

ParameterTypeDefault Value
coordNode<vec2>

Returns

Node<float>

shapeCircle

Generates a circle based on the uv coordinates.

ParameterTypeDefault Value
coordNode<vec2>

Returns

Node<float>

addNodeElement

ParameterTypeDefault Value
nameany

Returns

void

addMethodChaining

ParameterTypeDefault Value
nameany
nodeElementany

Returns

void

defined

ParameterTypeDefault Value
valueany

Returns

boolean

getConstNodeType

ParameterTypeDefault Value
valueany

Returns

any

ShaderNode

ParameterTypeDefault Value
jsFuncany
nodeTypeany

Returns

ShaderNodeInternal

nodeObject

ParameterTypeDefault Value
valany
altType?nullnull

Returns

any

nodeObjectIntent

ParameterTypeDefault Value
valany
altType?nullnull

Returns

any

nodeObjects

ParameterTypeDefault Value
valany
altType?nullnull

Returns

any

nodeArray

ParameterTypeDefault Value
valany
altType?nullnull

Returns

any

nodeProxy

ParameterTypeDefault Value
NodeClassany
scope?nullnull
factor?nullnull
settings?nullnull

Returns

any

nodeImmutable

ParameterTypeDefault Value
NodeClassany
params...Array<any>

Returns

any

nodeProxyIntent

ParameterTypeDefault Value
NodeClassany
scope?nullnull
factor?nullnull
settings?{}{}

Returns

any

Fn

ParameterTypeDefault Value
jsFuncany
layout?nullnull

Returns

() => void

setCurrentStack

ParameterTypeDefault Value
stackany

Returns

void

getCurrentStack

Returns

any

If

Represent a conditional node using if/else statements.

If( condition, function )
	.ElseIf( condition, function )
	.Else( function )
export {}
ParameterTypeDefault Value
params...any

Returns

StackNode

Switch

Represent a conditional node using switch/case statements.

Switch( value )
	.Case( 1, function )
	.Case( 2, 3, 4, function )
	.Default( function )
export {}
ParameterTypeDefault Value
params...any

Returns

StackNode

Stack

Add the given node to the current stack.

Properties

Node

Returns

Node

color

Type

any

float

Type

any

int

Type

any

uint

Type

any

bool

Type

any

vec2

Type

any

ivec2

Type

any

uvec2

Type

any

bvec2

Type

any

vec3

Type

any

ivec3

Type

any

uvec3

Type

any

bvec3

Type

any

vec4

Type

any

ivec4

Type

any

uvec4

Type

any

bvec4

Type

any

mat2

Type

any

mat3

Type

any

mat4

Type

any

string

ParameterTypeDefault Value
value?string

Returns

ConstNode

arrayBuffer

ParameterTypeDefault Value
valueany

Returns

ConstNode

element

Type

any

convert

ParameterTypeDefault Value
nodeany
typesany

Returns

ConvertNode

split

ParameterTypeDefault Value
nodeany
channelsany

Returns

SplitNode

append

ParameterTypeDefault Value
nodeNode

Returns

Function

debug

TSL function for creating a debug node.

ParameterTypeDefault Value
nodeNode
callback?null | Functionnull

Returns

DebugNode

Discard

Represents a discard shader operation in TSL.

ParameterTypeDefault Value
conditionalany

Returns

Node

Return

Represents a return shader operation in TSL.

Returns

ExpressionNode

equirectUV

TSL function for creating an equirect uv node.

Can be used to compute texture coordinates for projecting an equirectangular texture onto a mesh for using it as the scene’s background.

scene.backgroundNode = texture( equirectTexture, equirectUV() );
export {}
ParameterTypeDefault Value
dirNode?Node<vec3>

Returns

Node<vec2>

OnObjectUpdate

Creates an event that triggers a function every time an object (Mesh|Sprite) is rendered.

The event will be bound to the declared TSL function Fn(); it must be declared within a Fn() or the JS function call must be inherited from one.

Properties

Function

Returns

EventNode

OnMaterialUpdate

Creates an event that triggers a function when the first object that uses the material is rendered.

The event will be bound to the declared TSL function Fn(); it must be declared within a Fn() or the JS function call must be inherited from one.

Properties

Function

Returns

EventNode

OnBeforeObjectUpdate

Creates an event that triggers a function before an object (Mesh|Sprite) is updated.

The event will be bound to the declared TSL function Fn(); it must be declared within a Fn() or the JS function call must be inherited from one.

Properties

Function

Returns

EventNode

OnBeforeMaterialUpdate

Creates an event that triggers a function before the material is updated.

The event will be bound to the declared TSL function Fn(); it must be declared within a Fn() or the JS function call must be inherited from one.

Properties

Function

Returns

EventNode

overloadingFn

TSL function for creating a function overloading node.

ParameterTypeDefault Value
functionNodesArray<Function>

Returns

FunctionOverloadingNode

Loop

TSL function for creating a loop node.

Properties

...Array<any>

Returns

LoopNode

Continue

TSL function for creating a Continue() expression.

Returns

ExpressionNode

Break

TSL function for creating a Break() expression.

Returns

ExpressionNode

matcapUV

TSL function for creating a matcap uv node.

Can be used to compute texture coordinates for projecting a matcap onto a mesh. Used by MeshMatcapNodeMaterial.

Returns

Node<vec2>

maxMipLevel

TSL function for creating a max mip level node.

ParameterTypeDefault Value
textureNodeTextureNode

Returns

MaxMipLevelNode

oscSine

Generates a sine wave oscillation based on a timer.

ParameterTypeDefault Value
tNode<float>

Returns

Node<float>

oscSquare

Generates a square wave oscillation based on a timer.

ParameterTypeDefault Value
tNode<float>

Returns

Node<float>

oscTriangle

Generates a triangle wave oscillation based on a timer.

ParameterTypeDefault Value
tNode<float>

Returns

Node<float>

oscSawtooth

Generates a sawtooth wave oscillation based on a timer.

ParameterTypeDefault Value
tNode<float>

Returns

Node<float>

directionToColor

Packs a direction vector into a color value.

ParameterTypeDefault Value
nodeNode<vec3>

Returns

Node<vec3>

colorToDirection

Unpacks a color value into a direction vector.

ParameterTypeDefault Value
nodeNode<vec3>

Returns

Node<vec3>

unpackNormal

Unpacks a tangent space normal, reconstructing the Z component by projecting the X,Y coordinates onto the hemisphere. The X,Y coordinates are expected to be in the [-1, 1] range.

ParameterTypeDefault Value
xyNode<vec2>

Returns

Node<vec3>

getViewPosition

Computes a position in view space based on a fragment’s screen position expressed as uv coordinates, the fragments depth value and the camera’s inverse projection matrix.

ParameterTypeDefault Value
screenPositionNode<vec2>
depthNode<float>
projectionMatrixInverseNode<mat4>

Returns

Node<vec3>

getScreenPosition

Computes a screen position expressed as uv coordinates based on a fragment’s position in view space and the camera’s projection matrix

ParameterTypeDefault Value
viewPositionNode<vec3>
projectionMatrixNode<mat4>

Returns

Node<vec2>

getNormalFromDepth

Computes a normal vector based on depth data. Can be used as a fallback when no normal render target is available or if flat surface normals are required.

ParameterTypeDefault Value
uvNode<vec2>
depthTextureDepthTexture
projectionMatrixInverseNode<mat4>

Returns

Node<vec3>

interleavedGradientNoise

Interleaved Gradient Noise (IGN) from Jimenez 2014.

IGN has “low discrepancy” resulting in evenly distributed samples. It’s superior compared to default white noise, blue noise or Bayer.

References:

ParameterTypeDefault Value
positionNode<vec2>

Returns

Node<float>

vogelDiskSample

Vogel disk sampling for uniform circular distribution.

This function generates sample points distributed uniformly on a disk using the golden angle, resulting in an efficient low-discrepancy sequence for sampling. The rotation parameter (phi) allows randomizing the pattern per-pixel when combined with IGN.

ParameterTypeDefault Value
sampleIndexNode<int>
samplesCountNode<int>
phiNode<float>

Returns

Node<vec2>

reflector

TSL function for creating a reflector node.

ParameterTypeDefault Value
parameters?{ target?: Object3D | undefined; resolution?: number | undefined; generateMipmaps?: boolean | undefined; bounces?: boolean | undefined; depth?: boolean | undefined; samples?: number | undefined; defaultTexture?: TextureNode | undefined; reflector?: ReflectorBaseNode | undefined; }{}

Returns

ReflectorNode

remap

This node allows to remap a node value from one range into another. E.g a value of 0.4 in the range [ 0.3, 0.5 ] should be remapped into the normalized range [ 0, 1 ]. remap takes care of that and converts the original value of 0.4 to 0.5.

ParameterTypeDefault Value
nodeNode
inLowNodeNode
inHighNodeNode
outLowNode?Node
outHighNode?Node

Returns

Node
N E W

remapClamp

This node allows to remap a node value from one range into another but with enabled clamping. E.g a value of 0.4 in the range [ 0.3, 0.5 ] should be remapped into the normalized range [ 0, 1 ]. remapClamp takes care of that and converts the original value of 0.4 to 0.5.

ParameterTypeDefault Value
nodeNode
inLowNodeNode
inHighNodeNode
outLowNode?null | Nodefloat( 0 )
outHighNode?null | Nodefloat( 1 )

Returns

Node

rotate

TSL function for creating a rotate node.

ParameterTypeDefault Value
positionNodeNode
rotationNodeNode

Returns

RotateNode

rtt

TSL function for creating a RTT node.

ParameterTypeDefault Value
nodeNode
params...Array<any>

Returns

RTTNode

convertToTexture

TSL function for converting nodes to textures nodes.

ParameterTypeDefault Value
nodeNode
params...Array<any>

Returns

RTTNode

sample

Helper function to create a SampleNode wrapped as a node object.

ParameterTypeDefault Value
callbackFunction
uv?anynull

Returns

SampleNode

spritesheetUV

TSL function for computing texture coordinates for animated sprite sheets.

const uvNode = spritesheetUV( vec2( 6, 6 ), uv(), time.mul( animationSpeed ) );

material.colorNode = texture( spriteSheet, uvNode );
export {}
ParameterTypeDefault Value
countNodeNode<vec2>
uvNode?Node<vec2>
frameNode?Node<float>

Returns

Node<vec2>

billboarding

This can be used to achieve a billboarding behavior for flat meshes. That means they are oriented always towards the camera.

material.vertexNode = billboarding();
export {}
ParameterTypeDefault Value
configObject
config.position?Node<vec3> | nullnull
config.horizontal?booleantrue
config.vertical?booleanfalse

Returns

Node<vec3>

time

Represents the elapsed time in seconds.

Type

UniformNode<float>

deltaTime

Represents the delta time in seconds.

Type

UniformNode<float>

frameId

Represents the current frame ID.

Type

UniformNode<uint>

triplanarTextures

TSL function for creating a triplanar textures node.

Can be used for triplanar texture mapping.

material.colorNode = triplanarTexture( texture( diffuseMap ) );
export {}
ParameterTypeDefault Value
textureXNodeNode
textureYNode?Node
textureZNode?Node
scaleNode?Node<float>
positionNode?Node<vec3>
normalNode?Node<vec3>

Returns

Node<vec4>

triplanarTexture

TSL function for creating a triplanar textures node.

ParameterTypeDefault Value
textureXNodeNode
textureYNode?Node
textureZNode?Node
scaleNode?Node<float>
positionNode?Node<vec3>
normalNode?Node<vec3>

Returns

Node<vec4>

replaceDefaultUV

Replaces the default UV coordinates used in texture lookups.

material.contextNode = replaceDefaultUV( ( textureNode ) => {

	// ...
	return customUVCoordinates;

} );
export {}
ParameterTypeDefault Value
callback(arg0: Node) => Node<any> | Node<any>
node?Nodenull

Returns

ContextNode

rotateUV

Rotates the given uv coordinates around a center point

ParameterTypeDefault Value
uvNode<vec2>
rotationNode<float>
centerNode<vec2>

Returns

Node<vec2>

spherizeUV

Applies a spherical warping effect to the given uv coordinates.

ParameterTypeDefault Value
uvNode<vec2>
strengthNode<float>
centerNode<vec2>

Returns

Node<vec2>

viewportSafeUV

A special version of a screen uv function that involves a depth comparison when computing the final uvs. The function mitigates visual errors when using viewport texture nodes for refraction purposes. Without this function objects in front of a refractive surface might appear on the refractive surface which is incorrect.

ParameterTypeDefault Value
uvNode<vec2>

Returns

Node<vec2>