A small value used to handle floating-point precision errors.
Represents PI / 2.
Represents infinity.
Represents PI.
Represents PI * 2. Please use the non-deprecated version TWO_PI.
Deprecated: Yes
TSL object that represents the TBN matrix in view space.
Represents PI * 2.
TSL object that represents the shader variable AlphaT.
TSL object that represents the shader variable Anisotropy.
TSL object that represents the shader variable AnisotropyB.
TSL object that represents the shader variable AnisotropyT.
TSL object that represents the shader variable AttenuationColor.
TSL object that represents the shader variable AttenuationDistance.
TSL object that represents the scene's background blurriness.
TSL object that represents the scene's background intensity.
TSL object that represents the scene's background rotation.
TSL object that represents the bitangent attribute of the current rendered object.
TSL object that represents the vertex bitangent in local space of the current rendered object.
TSL object that represents the vertex bitangent in view space of the current rendered object.
Bitangent vector in view space, computed dynamically from geometry and UV derivatives. Complements the tangentViewFrame for constructing the tangent space basis.
Reference: http://www.thetenthplanet.de/archives/1180
TSL object that represents the vertex bitangent in world space of the current rendered object.
TSL object that represents the far value of the camera used for the current render.
TSL object that represents the current index value of the camera if used ArrayCamera.
TSL object that represents the near value of the camera used for the current render.
TSL object that represents the normal matrix of the camera used for the current render.
TSL object that represents the position in world space of the camera used for the current render.
TSL object that represents the projection matrix of the camera used for the current render.
TSL object that represents the inverse projection matrix of the camera used for the current render.
TSL object that represents the view matrix of the camera used for the current render.
TSL object that represents the viewport of the camera used for the current render.
TSL object that represents the world matrix of the camera used for the current render.
TSL object that represents the shader variable Clearcoat.
TSL object that represents the clearcoat vertex normal of the current rendered object in view space.
TSL object that represents the shader variable ClearcoatRoughness.
TSL object that represents the clip space position of the current rendered object.
TSL object that represents the shader variable dashSize.
Represents the delta time in seconds.
TSL object that represents the depth value for the current fragment.
TSL object that represents the shader variable DiffuseColor.
TSL object that represents the shader variable DiffuseContribution.
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.
TSL object that represents the shader variable Dispersion.
TSL object that represents the index of a draw call.
TSL object that represents the shader variable EmissiveColor.
TSL object that represents the front facing status as a number instead of a bool. 1 means front facing, -1 means back facing.
TSL object that represents a shared uniform group node which is updated once per frame.
Represents the current frame ID.
TSL object that represents whether a primitive is front or back facing
TSL object that represents the shader variable gapSize.
A non-linearized 3-dimensional representation of the current invocation's position within a 3D global grid.
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.
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.
TSL object that represents the index of either a mesh instance or an invocation of a compute shader.
TSL object that represents the index of a compute invocation within the scope of a workgroup load.
TSL object that represents the index of a compute invocation within the scope of a subgroup.
TSL object that represents the shader variable IOR.
TSL object that represents the shader variable Iridescence.
TSL object that represents the shader variable IridescenceIOR.
TSL object that represents the shader variable IridescenceThickness.
A non-linearized 3-dimensional representation of the current invocation's position within a 3D workgroup grid.
TSL object that represents the ambient occlusion map of the current material. The value is composed via aoMap.r - 1 * aoMapIntensity + 1.
TSL object that represents alpha test of the current material.
TSL object that represents the anisotropy of the current material.
TSL object that represents the anisotropy vector of the current material.
TSL object that represents the attenuation color of the current material.
TSL object that represents the attenuation distance of the current material.
TSL object that represents the clearcoat of the current material. The value is composed via clearcoat * clearcoatMap.r
TSL object that represents the clearcoat normal of the current material. The value will be either clearcoatNormalMap or normalView.
TSL object that represents the clearcoat roughness of the current material. The value is composed via clearcoatRoughness * clearcoatRoughnessMap.r.
TSL object that represents the diffuse color of the current material. The value is composed via color * map.
TSL object that represents the dispersion of the current material.
TSL object that represents the emissive color of the current material. The value is composed via emissive * emissiveIntensity * emissiveMap.
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.
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.
TSL object that represents the IOR of the current material.
TSL object that represents the iridescence of the current material.
TSL object that represents the iridescence IOR of the current material.
TSL object that represents the iridescence thickness of the current material.
TSL object that represents the light map of the current material. The value is composed via lightMapIntensity * lightMap.rgb.
TSL object that represents the dash offset of the current line material.
TSL object that represents the dash size of the current dashed line material.
TSL object that represents the gap size of the current dashed line material.
TSL object that represents the scale of the current dashed line material.
TSL object that represents the line width of the current line material.
TSL object that represents the metalness of the current material. The value is composed via metalness * metalnessMap.b.
TSL object that represents the normal of the current material. The value will be either normalMap * normalScale, bumpMap * bumpScale or normalView.
TSL object that represents the opacity of the current material. The value is composed via opacity * alphaMap.
TSL object that represents the point size of the current points material.
TSL object that represents the reflectivity of the current material.
TSL object that represents the refraction ratio of the material used for rendering the current object.
TSL object that represents the rotation of the current sprite material.
TSL object that represents the roughness of the current material. The value is composed via roughness * roughnessMap.g.
TSL object that represents the sheen color of the current material. The value is composed via sheen * sheenColor * sheenColorMap.
TSL object that represents the sheen roughness of the current material. The value is composed via sheenRoughness * sheenRoughnessMap.a.
TSL object that represents the shininess of the current material.
TSL object that represents the specular of the current material.
TSL object that represents the specular color of the current material. The value is composed via specularColor * specularMap.rgb.
TSL object that represents the specular intensity of the current material. The value is composed via specularIntensity * specularMap.a.
TSL object that represents the specular strength of the current material. The value is composed via specularMap.r.
TSL object that represents the thickness of the current material. The value is composed via thickness * thicknessMap.g.
TSL object that represents the transmission of the current material. The value is composed via transmission * transmissionMap.r.
TSL object that represents the object's model view in mediump precision.
TSL object that represents the shader variable Metalness.
TSL object that represents the object's direction in world space.
TSL object that represents the object's normal matrix.
TSL object that represents the object's position in world space.
TSL object that represents the object's radius.
TSL object that represents the object's scale in world space.
TSL object that represents the object's model view matrix.
TSL object that represents the object's position in view/camera space.
TSL object that represents the position in clip space after the model-view-projection transform of the current rendered object.
TSL object that represents the object's world matrix.
TSL object that represents the object's inverse world matrix.
TSL object that represents the flat vertex normal of the current rendered object in view space.
TSL object that represents the normal attribute of the current rendered object in local space.
TSL object that represents the vertex normal of the current rendered object in local space.
TSL object that represents the vertex normal of the current rendered object in view space.
TSL object that represents the vertex normal of the current rendered object in view space.
TSL object that represents the vertex normal of the current rendered object in world space.
TSL object that represents the vertex normal of the current rendered object in world space.
Represents the number of workgroups dispatched by the compute shader.
// Run 512 invocations/threads with a workgroup size of 128.
const computeFn = Fn(() => {
// 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(() => {
// numWorkgroups.x = 8
storageBuffer.element(0).assign(numWorkgroups.x)
})().compute(512);
TSL object that represents a uniform group node which is updated once per object.
TSL object that represents the shader variable Output.
TSL object that represents the parallax direction.
TSL object that represents the uv coordinates of points.
TSL object that represents the shader variable pointWidth.
TSL object that represents the position attribute of the current rendered object.
TSL object that represents the vertex position in local space of the current rendered object.
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.
TSL object that represents the vertex position in view space of the current rendered object.
TSL object that represents the position view direction of the current rendered object.
TSL object that represents the vertex position in world space of the current rendered object.
TSL object that represents the position world direction of the current rendered object.
Used for sampling cube maps when using cube reflection mapping.
The reflect vector in view space.
Used for sampling cube maps when using cube refraction mapping.
The refract vector in view space.
TSL object that represents a shared uniform group node which is updated once per render.
TSL object that represents the shader variable Roughness.
TSL object that represents the current x/y pixel position on the screen in physical pixel units.
TSL object that represents the current DPR.
TSL object that represents the screen resolution in physical pixel units.
TSL object that represents normalized screen coordinates, unitless in [0, 1].
TSL object that represents the vertex position in world space during the shadow pass.
TSL object that represents the shader variable Sheen.
TSL object that represents the shader variable SheenRoughness.
TSL object that represents the shader variable Shininess.
TSL object that represents the shader variable SpecularColor.
TSL object that represents the shader variable SpecularColorBlended.
TSL object that represents the shader variable SpecularF90.
TSL object that represents the index of the subgroup the current compute invocation belongs to.
A device dependent variable that exposes the size of the current invocation's subgroup.
TSL object that represents the tangent attribute of the current rendered object.
TSL object that represents the vertex tangent in local space of the current rendered object.
TSL object that represents the vertex tangent in view space of the current rendered object.
Tangent vector in view space, computed dynamically from geometry and UV derivatives. Useful for normal mapping without precomputed tangents.
Reference: http://www.thetenthplanet.de/archives/1180
TSL object that represents the vertex tangent in world space of the current rendered object.
TSL object that represents the shader variable Thickness.
Represents the elapsed time in seconds.
TSL object that represents the global tone mapping exposure of the renderer.
TSL object that represents the transformed clearcoat vertex normal of the current rendered object in view space.
Deprecated: since r178. Use `clearcoatNormalView` instead.
TSL object that represents the transformed vertex normal of the current rendered object in view space.
Deprecated: since r178. Use `normalView` instead.
TSL object that represents the transformed vertex normal of the current rendered object in world space.
Deprecated: since r178. Use `normalWorld` instead.
TSL object that represents the shader variable Transmission.
TSL object that represents the velocity of a render pass.
TSL object that represents the index of a vertex within a mesh.
TSL object that represents the viewport rectangle as x, y, width and height in physical pixel units.
TSL object that represents the current x/y pixel position on the viewport in physical pixel units.
TSL object that represents the linear (orthographic) depth value of the current fragment
TSL object that represents the viewport resolution in physical pixel units.
TSL object that represents normalized viewport coordinates, unitless in [0, 1].
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];
TSL function for creating a Break() expression.
TSL function for creating a const node.
node
The node for which a constant should be created.
name
The name of the constant in the shader.
TSL function for creating a Continue() expression.
Represents a discard shader operation in TSL.
conditional
An optional conditional node. It allows to decide whether the discard should be executed or not.
Returns: The discard expression.
Represent a conditional node using if/else statements.
If( condition, function )
.ElseIf( condition, function )
.Else( function )
params
The parameters for the conditional node.
Returns: The conditional node.
TSL function for creating a loop node.
params
A list of parameters.
Represents a return shader operation in TSL.
Returns: The return expression.
Represent a conditional node using switch/case statements.
Switch( value )
.Case( 1, function )
.Case( 2, 3, 4, function )
.Default( function )
params
The parameters for the conditional node.
Returns: The conditional node.
TSL function for creating a var node.
node
The node for which a variable should be created.
name
The name of the variable in the shader.
TSL function for creating a var intent node.
node
The node for which a variable should be created.
name
The name of the variable in the shader.
Returns the absolute value of the parameter.
x
The parameter.
ACESFilmic tone mapping.
Reference: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs
color
The color that should be tone mapped.
exposure
The exposure.
Returns: The tone mapped color.
Returns the arccosine of the parameter.
x
The parameter.
Returns the addition of two or more value.
a
The first input.
b
The second input.
params
Additional input parameters.
TSL function for creating an after image node for post processing.
node
The node that represents the input of the effect.
damp
The damping intensity. A higher value means a stronger after image effect.
Default is 0.96.
AgX tone mapping.
color
The color that should be tone mapped.
exposure
The exposure.
Returns: The tone mapped color.
Returns true if all components of x are true.
x
The parameter.
TSL function for creating an anaglyph pass node.
scene
The scene to render.
camera
The camera to render the scene with.
TSL function for creating an anamorphic flare effect.
node
The node that represents the input of the effect.
threshold
The threshold is one option to control the intensity and size of the effect.
Default is 0.9.
scale
Defines the vertical scale of the flares.
Default is 3.
samples
More samples result in larger flares and a more expensive runtime behavior.
Default is 32.
Performs a logical AND operation on multiple nodes.
nodes
The input nodes to be combined using AND.
Returns true if any components of x are true.
x
The parameter.
TSL function for creating a Ground Truth Ambient Occlusion (GTAO) effect.
depthNode
A node that represents the scene's depth.
normalNode
A node that represents the scene's normals.
camera
The camera the scene is rendered with.
node
The node to add.
Deprecated: since r176. Use Stack instead.
TSL function for creating an array node.
nodeTypeOrValues
A string representing the element type (e.g., 'vec3') or an array containing the default values (e.g., [ vec3() ]).
count
Size of the array.
Returns the arcsine of the parameter.
x
The parameter.
TSL function for creating an assign node.
targetNode
The target node.
sourceNode
The source type.
Returns the arc-tangent of the parameter. If two parameters are provided, the result is atan2(y/x).
y
The y parameter.
x
The x parameter.
Increments the value stored in the atomic variable.
pointerNode
An atomic variable or element of an atomic buffer.
valueNode
The value that mutates the atomic variable.
Stores in an atomic variable the bitwise AND of its value with a parameter.
pointerNode
An atomic variable or element of an atomic buffer.
valueNode
The value that mutates the atomic variable.
TSL function for appending an atomic function call into the programmatic flow of a compute shader.
method
The signature of the atomic function to construct.
pointerNode
An atomic variable or element of an atomic buffer.
valueNode
The value that mutates the atomic variable.
Loads the value stored in the atomic variable.
pointerNode
An atomic variable or element of an atomic buffer.
Stores in an atomic variable the maximum between its current value and a parameter.
pointerNode
An atomic variable or element of an atomic buffer.
valueNode
The value that mutates the atomic variable.
Stores in an atomic variable the minimum between its current value and a parameter.
pointerNode
An atomic variable or element of an atomic buffer.
valueNode
The value that mutates the atomic variable.
TSL function for creating an atomic function node.
method
The signature of the atomic function to construct.
pointerNode
An atomic variable or element of an atomic buffer.
valueNode
The value that mutates the atomic variable.
Stores in an atomic variable the bitwise OR of its value with a parameter.
pointerNode
An atomic variable or element of an atomic buffer.
valueNode
The value that mutates the atomic variable.
Stores a value in the atomic variable.
pointerNode
An atomic variable or element of an atomic buffer.
valueNode
The value that mutates the atomic variable.
Decrements the value stored in the atomic variable.
pointerNode
An atomic variable or element of an atomic buffer.
valueNode
The value that mutates the atomic variable.
Stores in an atomic variable the bitwise XOR of its value with a parameter.
pointerNode
An atomic variable or element of an atomic buffer.
valueNode
The value that mutates the atomic variable.
TSL function for creating an attribute node.
name
The name of the attribute.
nodeType
The node type.
Default is null.
TSL function for creating a storage buffer node with a configured StorageBufferAttribute.
count
The data count. It is also valid to pass a typed array as an argument.
type
The data type.
Default is 'float'.
Checks if UV coordinates are inside the valid 0-1 range. Useful for masking areas inside the distorted screen.
coord
The UV coordinates to check.
Returns: 1.0 if inside bounds, 0.0 if outside.
Creates barrel-distorted UV coordinates. The center of the screen appears to bulge outward (convex distortion).
curvature
The amount of curvature (0 = flat, 0.5 = very curved).
Default is 0.1.
coord
The input UV coordinates.
Default is uv().
Returns: The distorted UV coordinates.
TSL function for creating a barrier node.
scope
The scope defines the behavior of the node..
TSL function for creating a batch node.
batchMesh
A reference to batched mesh.
TSL function for computing bent normals.
Returns: Bent normals.
TSL function for creating a bilateral blur node for post processing.
Bilateral blur smooths an image while preserving sharp edges by considering both spatial distance and color/intensity differences between pixels.
node
The node that represents the input of the effect.
directionNode
Defines the direction and radius of the blur.
sigma
Controls the spatial kernel of the blur filter. Higher values mean a wider blur radius.
sigmaColor
Controls the intensity kernel. Higher values allow more color difference to be blurred together.
This can be used to achieve a billboarding behavior for flat meshes. That means they are oriented always towards the camera.
material.vertexNode = billboarding();
config
The configuration object.
position
Can be used to define the vertex positions in world space.
Default is null.
horizontal
Whether to follow the camera rotation horizontally or not.
Default is true.
vertical
Whether to follow the camera rotation vertically or not.
Default is false.
Returns: The updated vertex position in clip space.
Performs bitwise AND on two nodes.
a
The first input.
b
The second input.
Performs bitwise NOT on a node.
a
The first input.
b
The second input.
Performs bitwise OR on two nodes.
a
The first input.
b
The second input.
Performs bitwise XOR on two nodes.
a
The first input.
b
The second input.
Reinterpret the bit representation of a value in one type as a value in another type.
x
The parameter.
y
The new type.
Applies a bleach bypass effect to the given color node.
color
The color node to apply the sepia for.
opacity
Influences how strong the effect is blended with the original color.
Default is 1.
Returns: The updated color node.
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.
base
The base color.
blend
The blend color. A white (#ffffff) blend color does not alter the base color.
Returns: The result.
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.
base
The base color.
blend
The blend color
Returns: The result.
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.
base
The base color.
blend
The blend color. A black (#000000) blend color does not alter the base color.
Returns: The result.
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.
base
The base color.
blend
The blend color
Returns: The result.
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.
base
The base color.
blend
The blend color. A black (#000000) blend color does not alter the base color.
Returns: The result.
TSL function for creating a bloom effect.
node
The node that represents the input of the effect.
strength
The strength of the bloom.
Default is 1.
radius
The radius of the bloom.
Default is 0.
threshold
The luminance threshold limits which bright areas contribute to the bloom effect.
Default is 0.
Applies a box blur effect to the given texture node.
Compared to Gaussian blur, box blur produces a more blocky result but with better performance when correctly configured. It is intended for mobile devices or performance restricted use cases where Gaussian is too heavy.
The (kernel) size parameter should be small (1, 2 or 3) since it determines the number of samples based on (size * 2 + 1)^2. This implementation uses a single pass approach so the kernel is not applied as a separable filter. That means larger kernels won't perform well. Use Gaussian instead if you need a more high-quality blur.
To produce wider blurs, increase the separation parameter instead which has no influence on the performance.
textureNode
The texture node that should be blurred.
options
Additional options for the hash blur effect.
Default is {}.
size
Controls the blur's kernel. For performant results, the range should within [1, 3].
Default is int(1).
separation
Spreads out the blur without having to sample additional fragments. Ranges from [1, Infinity].
Default is int(1).
premultipliedAlpha
Whether to use premultiplied alpha for the blur effect.
Default is false.
Returns: The blurred texture node.
TSL function for creating a buffer node.
value
Array-like buffer data.
type
The data type of a buffer element.
count
The count of buffer elements.
TSL function for creating a buffer attribute node.
array
The attribute data.
type
The buffer type (e.g. 'vec3').
Default is null.
stride
The buffer stride.
Default is 0.
offset
The buffer offset.
Default is 0.
TSL function for creating a builtin node.
name
The name of the built-in shader variable.
TSL function for defining a built-in ambient occlusion context for a given node.
aoNode
The ambient occlusion value node to apply.
node
The node whose context should be modified.
Default is null.
TSL function for defining a built-in shadow context for a given node.
shadowNode
The shadow node representing the light's shadow.
light
The light associated with the shadow.
node
The node whose context should be modified.
Default is null.
TSL function for creating a bump map node.
textureNode
Represents the bump map data.
scaleNode
Controls the intensity of the bump effect.
Default is null.
TSL function for creating a bypass node.
outputNode
The output node.
callNode
The call node.
TSL function for creating a cache node.
node
The node that should be cached.
parent
Whether this node refers to a shared parent cache or not.
Default is true.
Deprecated: Yes
Returns the cube root of a number.
a
The first parameter.
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.
color
Input (-Infinity < input < +Infinity)
slope
Slope (0 ≤ slope < +Infinity)
offset
Offset (-Infinity < offset < +Infinity; typically -1 < offset < 1)
power
Power (0 < power < +Infinity)
saturation
Saturation (0 ≤ saturation < +Infinity; typically 0 ≤ saturation < 4)
luminanceCoefficients
Luminance coefficients for saturation term, typically Rec. 709
Returns:
Output, -Infinity < output < +Infinity
References:
Finds the nearest integer that is greater than or equal to the parameter.
x
The parameter.
Creates a 2x2 checkerboard pattern that can be used as procedural texture data.
coord
The uv coordinates.
Returns: The result data.
TSL function for creating a chromatic aberration node for post processing.
node
The node that represents the input of the effect.
strength
The strength of the chromatic aberration effect as a node or value.
Default is 1.0.
center
The center point of the effect as a node or value. If null, uses screen center (0.5, 0.5).
Default is null.
scale
The scale factor for stepped scaling from center as a node or value.
Default is 1.1.
Cineon tone mapping.
Reference: http://filmicworlds.com/blog/filmic-tonemapping-operators/
color
The color that should be tone mapped.
exposure
The exposure.
Returns: The tone mapped color.
Returns a radial gradient from center (white) to edges (black). Useful for masking effects based on distance from center.
scale
Controls the size of the gradient (0 = all black, 1 = full circle).
Default is 1.0.
softness
Controls the edge softness (0 = hard edge, 1 = soft gradient).
Default is 0.5.
coord
The input UV coordinates.
Default is uv().
Returns: 1.0 at center, 0.0 at edges.
TSL function that checks if a circle intersects with an axis-aligned bounding box (AABB).
circleCenter
The center of the circle.
radius
The radius of the circle.
minBounds
The minimum bounds of the AABB.
maxBounds
The maximum bounds of the AABB.
Returns: True if the circle intersects the AABB.
Constrains a value to lie between two further values.
value
The value to constrain.
low
The lower bound.
Default is 0.
high
The upper bound.
Default is 1.
TSL function for setting up the default clipping logic.
TSL function for setting up alpha to coverage.
TSL function for creating a code node.
code
The native code.
includes
An array of includes.
Default is [].
language
The used language.
Default is ''.
Applies color bleeding effect to simulate horizontal color smearing. Simulates the analog signal bleeding in CRT displays where colors "leak" into adjacent pixels horizontally.
color
The input texture node.
amount
The amount of color bleeding (0-0.01).
Default is 0.002.
Returns: The color with bleeding effect applied.
TSL function for converting a given color node from the given color space to the current working color space.
node
Represents the node to convert.
sourceColorSpace
The source color space.
Unpacks a color value into a direction vector.
node
The color to unpack.
Returns: The direction.
TSL function for creating a compute node.
node
TODO
count
TODO.
workgroupSize
TODO.
Default is [64].
TSL function for creating a compute builtin node.
name
The built-in name.
nodeType
The node type.
TSL function for creating a compute kernel node.
node
TODO
workgroupSize
TODO.
Default is [64].
TSL function for computing skinning.
skinnedMesh
The skinned mesh.
toPosition
The target position.
Default is null.
TSL function for creating a context node.
nodeOrValue
The node whose context should be modified or the modified context data.
Default is {}.
value
The modified context data.
Default is {}.
TSL function for converting a given color node from one color space to another one.
node
Represents the node to convert.
sourceColorSpace
The source color space.
targetColorSpace
The target color space.
TSL function for converting nodes to textures nodes.
node
The node to render a texture with.
width
The width of the internal render target. If not width is applied, the render target is automatically resized.
Default is null.
height
The height of the internal render target.
Default is null.
options
The options for the internal render target.
Default is {type:HalfFloatType}.
Returns the cosine of the parameter.
x
The parameter.
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.
x
The input value.
Finds the number of '1' bits set in the input value
Can only be used with WebGPURenderer and a WebGPU backend.
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.
x
The input value.
TSL function for creating a var node.
node
The node for which a variable should be created.
name
The name of the variable in the shader.
Calculates the cross product of two vectors.
x
The first vector.
y
The second vector.
TSL function for creating a cube map node.
envNode
The node representing the environment map.
TSL function for creating a cube texture uniform node.
value
The cube texture.
Default is EmptyTexture.
uvNode
The uv node.
Default is null.
levelNode
The level node.
Default is null.
biasNode
The bias node.
Default is null.
TSL function for creating a cube texture node.
value
The cube texture.
uvNode
The uv node.
Default is null.
levelNode
The level node.
Default is null.
biasNode
The bias node.
Default is null.
Returns the partial derivative of the parameter with respect to x.
x
The parameter.
Returns the partial derivative of the parameter with respect to y.
x
The parameter.
TSL function for creating a debug node.
node
The node to debug.
callback
Optional callback function to handle the debug output.
Default is null.
Decrements a node by 1 and returns the previous value.
a
The node to decrement.
Decrements a node by 1.
a
The node to decrement.
Convert a quantity in radians to degrees.
x
The input in radians.
TSL function for creating a denoise effect.
node
The node that represents the input of the effect (e.g. AO).
depthNode
A node that represents the scene's depth.
normalNode
A node that represents the scene's normals.
camera
The camera the scene is rendered with.
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.
density
Defines the fog density.
TSL function for defining a value for the current fragment's depth.
value
The depth value to set.
TSL function for creating a depth pass node.
scene
A reference to the scene.
camera
A reference to the camera.
options
Options for the internal render target.
Returns the determinant of a matrix.
x
The parameter.
Calculates the absolute difference between two values.
x
The first parameter.
y
The second parameter.
Packs a direction vector into a color value.
node
The direction to pack.
Returns: The color.
Calculates the distance between two points.
x
The first point.
y
The second point.
Returns the division of two or more value.
a
The first input.
b
The second input.
params
Additional input parameters.
TSL function for creating a depth-of-field effect (DOF) for post processing.
node
The node that represents the input of the effect.
viewZNode
Represents the viewZ depth values of the scene.
focusDistance
Defines the effect's focus which is the distance along the camera's look direction in world units.
focalLength
How far an object can be from the focal plane before it goes completely out-of-focus in world units.
bokehScale
A unitless value for artistic purposes to adjust the size of the bokeh.
Calculates the dot product of two vectors.
x
The first vector.
y
The second vector.
TSL function for creating a dot-screen node for post processing.
node
The node that represents the input of the effect.
angle
The rotation of the effect in radians.
Default is 1.57.
scale
The scale of the effect. A higher value means smaller dots.
Default is 1.
TSL function for creating a buffer attribute node but with dynamic draw usage. Use this function if attribute data are updated per frame.
array
The attribute data.
type
The buffer type (e.g. 'vec3').
Default is null.
stride
The buffer stride.
Default is 0.
offset
The buffer offset.
Default is 0.
Checks if two nodes are equal.
a
The first input.
b
The second input.
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() );
dirNode
A direction vector for sampling which is by default positionWorldDirection.
Default is positionWorldDirection.
Returns the natural exponentiation of the parameter.
x
The parameter.
Returns 2 raised to the power of the parameter.
x
The parameter.
Constructs a new height fog factor node. This fog factor requires a Y-up coordinate system.
density
Defines the fog density.
height
The height threshold in world space. Everything below this y-coordinate is affected by fog.
TSL function for creating an expression node.
snippet
The native code snippet.
nodeType
The node type.
Default is 'void'.
Returns a vector pointing in the same direction as another.
N
The vector to orient.
I
The incident vector.
Nref
The reference vector.
TSL function for creating a film node for post processing.
inputNode
The node that represents the input of the effect.
intensityNode
A node that represents the effect's intensity.
Default is null.
uvNode
A node that allows to pass custom (e.g. animated) uv data.
Default is null.
Bitcasts a float or a vector of floats to a corresponding integer type with the same element size.
value
The float or vector of floats to bitcast.
Bitcasts a float or a vector of floats to a corresponding unsigned integer type with the same element size.
value
The float or vector of floats to bitcast.
Finds the nearest integer less than or equal to the parameter.
x
The parameter.
This class can be used to configure a fog for the scene. Nodes of this type are assigned to Scene.fogNode.
color
Defines the color of the fog.
factor
Defines how the fog is factored in the scene.
Computes the fractional part of the parameter.
x
The parameter.
Returns the sum of the absolute derivatives in x and y.
x
The parameter.
TSL function for creating a FXAA node for anti-aliasing via post processing.
node
The node that represents the input of the effect.
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: https://iquilezles.org/articles/functions/.
x
The value to remap.
k
k=1 is the identity curve,k<1 produces the classic gain() shape, and k>1 produces "s" shaped curves.
Returns: The remapped value.
TSL function for creating a gaussian blur node for post processing.
node
The node that represents the input of the effect.
directionNode
Defines the direction and radius of the blur.
sigma
Controls the kernel of the blur filter. Higher values mean a wider blur radius.
options
Additional options for the gaussian blur effect.
Default is {}.
premultipliedAlpha
Whether to use premultiplied alpha for the blur effect.
Default is false.
resolutionScale
The resolution of the effect. 0.5 means half the resolution of the texture node.
Default is 1.
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.
uv
The texture coordinate.
depthTexture
The depth texture.
projectionMatrixInverse
The camera's inverse projection matrix.
Returns: The computed normal vector.
This computes a parallax corrected normal which is used for box-projected cube mapping (BPCEM).
Reference: 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 );
normal
The normal to correct.
cubeSize
The cube size should reflect the size of the environment (BPCEM is usually applied in closed environments like rooms).
cubePos
The cube position.
Returns: The parallax corrected normal.
Computes a screen position expressed as uv coordinates based on a fragment's position in view space and the camera's projection matrix
viewPosition
The fragments position in view space.
projectionMatrix
The camera's projection matrix.
Returns: The fragment's screen position expressed as uv coordinates.
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.
light
The light source for which the shadow material is needed. If the light is a point light, a depth node is calculated using the linear shadow distance.
Returns: The shadow material associated with the given light.
Creates a function to render shadow objects in a scene.
renderer
The renderer.
shadow
The light shadow object containing shadow properties.
shadowType
The type of shadow map (e.g., BasicShadowMap).
useVelocity
Whether to use velocity data for rendering.
Returns: A function that renders shadow objects.
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.
screenPosition
The fragment's screen position expressed as uv coordinates.
depth
The fragment's depth value.
projectionMatrixInverse
The camera's inverse projection matrix.
Returns: The fragments position in view space.
TSL function for creating a GLSL code node.
src
The native code.
includes
An array of includes.
TSL function for creating a Godrays effect.
depthNode
A texture node that represents the scene's depth.
camera
The camera the scene is rendered with.
light
The light the godrays are rendered for.
Computes a grayscale value for the given RGB color value.
color
The color value to compute the grayscale for.
Returns: The grayscale color.
Checks if the first node is greater than the second.
a
The first input.
b
The second input.
Checks if the first node is greater than or equal to the second.
a
The first input.
b
The second input.
TSL function for setting up hardware-based clipping.
Generates a hash value in the range [0, 1] from the given seed.
seed
The seed.
Returns: The hash value.
Applies a hash blur effect to the given texture node.
The approach of this blur is different compared to Gaussian and box blur since it does not rely on a kernel to apply a convolution. Instead, it reads the base texture multiple times in a random pattern and then averages the samples. A typical artifact of this technique is a slightly noisy appearance of the blur which can be mitigated by increasing the number of iterations (see repeats parameter). Compared to Gaussian blur, hash blur requires just a single pass.
Reference: https://www.shadertoy.com/view/4lXXWn.
textureNode
The texture node that should be blurred.
bluramount
This node determines the amount of blur.
Default is float(0.1).
options
Additional options for the hash blur effect.
Default is {}.
repeats
The number of iterations for the blur effect.
Default is float(45).
premultipliedAlpha
Whether to use premultiplied alpha for the blur effect.
Default is false.
Returns: The blurred texture node.
Updates the hue component of the given RGB color while preserving its luminance and saturation.
color
The input color.
adjustment
Defines the degree of hue rotation in radians. A positive value rotates the hue clockwise, while a negative value rotates it counterclockwise.
Default is 1.
Returns: The updated color.
Increments a node by 1 and returns the previous value.
a
The node to increment.
Increments a node by 1.
a
The node to increment.
Creates an inspector node to wrap around a given node for inspection purposes.
node
The node to inspect.
name
Optional name for the inspector node.
Default is ''.
callback
Optional callback to modify the node during setup.
Default is null.
Returns: The inspector node.
TSL function for creating an instance node.
count
The number of instances.
instanceMatrix
Instanced buffer attribute representing the instance transformations.
instanceColor
Instanced buffer attribute representing the instance colors.
TSL function for creating a storage buffer node with a configured StorageInstancedBufferAttribute.
count
The data count. It is also valid to pass a typed array as an argument.
type
The data type.
Default is 'float'.
TSL function for creating a buffer attribute node but with enabled instancing
array
The attribute data.
type
The buffer type (e.g. 'vec3').
Default is null.
stride
The buffer stride.
Default is 0.
offset
The buffer offset.
Default is 0.
TSL function for creating a buffer attribute node but with dynamic draw usage and enabled instancing
array
The attribute data.
type
The buffer type (e.g. 'vec3').
Default is null.
stride
The buffer stride.
Default is 0.
offset
The buffer offset.
Default is 0.
TSL function for creating an instanced mesh node.
instancedMesh
The instancedMesh.
Bitcasts an integer or a vector of integers to a corresponding float type with the same element size.
value
The integer or vector of integers to bitcast.
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:
position
The input position, usually screen coordinates.
Returns: The noise value.
Returns the inverse of a matrix.
x
The parameter.
Returns the inverse of the square root of the parameter.
x
The parameter.
TSL function for creating a cache node.
node
The node that should be cached.
TSL function for creating a JS code node.
src
The native code.
includes
An array of includes.
TSL function for defining a label context value for a given node.
node
The node whose context should be modified.
name
The name/label to set.
Deprecated: Yes
Calculates the length of a vector.
x
The parameter.
Calculate the squared length of a vector.
a
The vector.
TSL function for creating a bloom-based lens flare effect.
node
The node that represents the scene's bloom.
params
The parameter object for configuring the effect.
ghostTint
Defines the tint of the flare/ghosts.
Default is vec3(1, 1, 1).
threshold
Controls the size and strength of the effect. A higher threshold results in smaller flares.
Default is float(0.5).
ghostSamples
Represents the number of flares/ghosts per bright spot which pivot around the center.
Default is float(4).
ghostSpacing
Defines the spacing of the flares/ghosts.
Default is float(0.25).
ghostAttenuationFactor
Defines the attenuation factor of flares/ghosts.
Default is float(25).
downSampleRatio
Defines how downsampling since the effect is usually not rendered at full resolution.
Default is 4.
Checks if the first node is less than the second.
a
The first input.
b
The second input.
Checks if the first node is less than or equal to the second.
a
The first input.
b
The second input.
TSL function for getting the position in world space for the given light.
light
The light source.
Returns: The light's position in world space.
TSL function for getting projected uv coordinates for the given light. Relevant when using maps with spot lights.
light
The light source.
position
The position to project.
Default is positionWorld.
Returns: The projected uvs.
TSL function for getting a shadow matrix uniform node for the given light.
light
The light source.
Returns: The shadow matrix uniform node.
TSL function for getting the light target direction for the given light.
light
The light source.
Returns: The light's target direction.
TSL function for getting the light target position in world space for the given light.
light
The light source.
Returns: The light target position in world space.
TSL function for getting the position in view space for the given light.
light
The light source.
Returns: The light's position in view space.
TSL function for creating an instance of LightsNode and configuring it with the given array of lights.
lights
An array of lights.
Returns: The created lights node.
TSL function for converting a perspective depth value to linear depth.
value
The perspective depth. If null is provided, the current fragment's depth is used.
Default is null.
Linear tone mapping, exposure only.
color
The color that should be tone mapped.
exposure
The exposure.
Returns: The tone mapped color.
Returns the natural logarithm of the parameter.
x
The parameter.
Returns the base 2 logarithm of the parameter.
x
The parameter.
TSL function for converting a logarithmic depth value to a viewZ value.
depth
The logarithmic depth.
near
The camera's near value.
far
The camera's far value.
Computes the luminance for the given RGB color value.
color
The color value to compute the luminance for.
luminanceCoefficients
The luminance coefficients. By default predefined values of the current working color space are used.
Returns: The luminance.
TSL function for creating a LUT node for color grading via post processing.
node
The node that represents the input of the effect.
lut
A texture node that represents the lookup table.
size
The size of the lookup table.
intensity
Controls the intensity of the effect.
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: The matcap UV coordinates.
TSL function for creating a material reference node.
name
The name of the property the node refers to.
type
The uniform type that should be used to represent the property value.
material
The material the property belongs to. When no material is set, the node refers to the material of the current rendered object.
Default is null.
Returns the greatest of the given values.
values
The values to compare.
TSL function for creating a max mip level node.
textureNode
The texture node to compute the max mip level for.
Returns the least of the given values.
values
The values to compare.
Linearly interpolates between two values.
a
The first parameter.
b
The second parameter.
t
The interpolation value.
Alias for mix() with a different parameter order.
t
The interpolation value.
e1
The first parameter.
e2
The second parameter.
Computes the remainder of dividing the first node by the second one.
a
The first input.
b
The second input.
a
The first input.
b
The second input.
Deprecated: since r175. Use mod instead.
TSL function for creating a morph node.
mesh
The mesh holding the morph targets.
Applies a motion blur effect to the given input node.
inputNode
The input node to apply the motion blur for.
velocity
The motion vectors of the beauty pass.
numSamples
How many samples the effect should use. A higher value results in better quality but is also more expensive.
Default is int(16).
Returns: The input node with the motion blur effect applied.
TSL function for creating a MRT node.
outputNodes
The MRT outputs.
Returns the multiplication of two or more value.
a
The first input.
b
The second input.
params
Additional input parameters.
Negates the value of the parameter (-x).
x
The parameter.
Neutral tone mapping.
Reference: https://modelviewer.dev/examples/tone-mapping
color
The color that should be tone mapped.
exposure
The exposure.
Returns: The tone mapped color.
TSL function for creating a normal map node.
node
Represents the normal map data.
scaleNode
Controls the intensity of the effect.
Default is null.
Calculates the unit vector in the same direction as the original vector.
x
The input vector.
Performs logical NOT on a node.
value
The value.
Checks if two nodes are not equal.
a
The first input.
b
The second input.
TSL function for creating an object 3D node that represents the object's direction in world space.
object3d
The 3D object.
TSL function for creating an object 3D node that represents the object's position in world space.
object3d
The 3D object.
TSL function for creating an object 3D node that represents the object's radius.
object3d
The 3D object.
TSL function for creating an object 3D node that represents the object's scale in world space.
object3d
The 3D object.
TSL function for creating an object 3D node that represents the object's position in view/camera space.
object3d
The 3D object.
TSL function for creating an object 3D node that represents the object's world matrix.
object3d
The 3D object.
Return 1 minus the parameter.
x
The parameter.
Performs a logical OR operation on multiple nodes.
nodes
The input nodes to be combined using OR.
TSL function for converting an orthographic depth value to a viewZ value.
depth
The orthographic depth.
near
The camera's near value.
far
The camera's far value.
Generates a sawtooth wave oscillation based on a timer.
t
The timer to generate the oscillation with.
Returns: The oscillation node.
Generates a sine wave oscillation based on a timer.
t
The timer to generate the oscillation with.
Returns: The oscillation node.
Generates a square wave oscillation based on a timer.
t
The timer to generate the oscillation with.
Returns: The oscillation node.
Generates a triangle wave oscillation based on a timer.
t
The timer to generate the oscillation with.
Returns: The oscillation node.
TSL function for creating an outline effect around selected objects.
scene
A reference to the scene.
camera
The camera the scene is rendered with.
params
The configuration parameters.
selectedObjects
An array of selected objects.
edgeThickness
The thickness of the edges.
Default is float(1).
edgeGlow
Can be used for animated glow/pulse effects.
Default is float(0).
downSampleRatio
The downsample ratio.
Default is 2.
TSL function for creating an output struct node.
members
A parameter list of nodes.
TSL function for creating a function overloading node.
functionNodes
Array of Fn function definitions.
Converts each component of the vec2 to 16-bit floating-point values. The results are packed into a single unsigned integer.
value
The 2-component vector to be packed
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)
value
The 2-component vector to be packed
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)
value
The 2-component vector to be packed
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: https://iquilezles.org/articles/functions/.
x
The value to remap.
k
Allows to control the remapping functions shape by rising the parabola to a power k.
Returns: The remapped value.
TSL function for creating an parallax barrier pass node.
scene
The scene to render.
camera
The camera to render the scene with.
TSL function for computing parallax uv coordinates.
uv
A uv node.
scale
A scale node.
Returns: Parallax uv coordinates.
TSL function for creating a parameter node.
type
The type of the node.
name
The name of the parameter in the shader.
TSL function for creating a pass node.
scene
A reference to the scene.
camera
A reference to the camera.
options
Options for the internal render target.
TSL function for creating a pass texture node.
pass
The pass node.
texture
The output texture.
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: https://iquilezles.org/articles/functions/.
x
The value to remap.
a
First control parameter.
b
Second control parameter.
Returns: The remapped value.
TSL function for converting a perspective depth value to a viewZ value.
depth
The perspective depth.
near
The camera's near value.
far
The camera's far value.
TSL function for creating a pixelation render pass node for post processing.
scene
The scene to render.
camera
The camera to render the scene with.
pixelSize
The pixel size.
Default is 6.
normalEdgeStrength
The normal edge strength.
Default is 0.3.
depthEdgeStrength
The depth edge strength.
Default is 0.4.
TSL function for creating a PMREM node.
value
The input texture.
uvNode
The uv node.
Default is null.
levelNode
The level node.
Default is null.
TSL function for creating an instance of PointShadowNode.
light
The shadow casting point light.
shadow
An optional point light shadow.
Default is null.
Returns: The created point shadow node.
TSL function for creating a posterize effect which reduces the number of colors in an image, resulting in a more blocky and stylized appearance.
sourceNode
The input color.
stepsNode
Controls the intensity of the posterization effect. A lower number results in a more blocky appearance.
Returns: The posterized color.
Return the value of the first parameter raised to the power of the second one.
x
The first parameter.
y
The second parameter.
Returns the square of the parameter.
x
The first parameter.
Returns the cube of the parameter.
x
The first parameter.
Returns the fourth power of the parameter.
x
The first parameter.
TSL function for creating a gaussian blur node for post processing with enabled premultiplied alpha.
node
The node that represents the input of the effect.
directionNode
Defines the direction and radius of the blur.
sigma
Controls the kernel of the blur filter. Higher values mean a wider blur radius.
Deprecated: since r180. Use `gaussianBlur()` with `premultipliedAlpha: true` option instead.
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.
color
The input color with non-premultiplied alpha.
Returns: The color with premultiplied alpha.
TSL function for creating a property node.
type
The type of the node.
name
The name of the property in the shader.
Default is null.
Broadcasts e from the quad invocation with id equal to id.
e
The value to broadcast.
Returns: The broadcast value.
Swaps e between invocations in the quad diagonally.
e
The value to swap from the current invocation.
Returns: The value received from the swap operation.
Swaps e between invocations in the quad in the X direction.
e
The value to swap from the current invocation.
Returns: The value received from the swap operation.
Swaps e between invocations in the quad in the Y direction.
e
The value to swap from the current invocation.
Returns: The value received from the swap operation.
This TSL function blurs an image in a circular pattern, radiating from a configurable center point in screen space.
Radial blurs can be used for different kind of effects like producing simple faked lighting effects also known as "light shafts". The major limitation of this specific usage is the center point can only be defined in 2D so the effect does not honor the depth of 3D objects. Consequently, it is not intended for physically correct lit scenes.
textureNode
The texture node that should be blurred.
options
Additional options for the radial blur effect.
Default is {}.
center
The center of the light in screen uvs.
Default is vec2(0.5, 0.5).
weight
Base weight factor for each sample in the range [0,1].
Default is float(0.9).
decay
Decreases the weight factor so each iteration adds less to the sum. Must be in the range [0,1]. If you increase the sample count, you have to increase this option as well to avoid a darking effect.
Default is float(0.95).
count
The number if iterations. Should be in the range [16,64].
Default is int(32).
exposure
Exposure control of the blur.
Default is float(5).
Returns: The blurred texture node.
Converts a quantity in degrees to radians.
x
The input in degrees.
Returns a random value for the given uv.
uv
The uv node.
TSL function for creating a range node.
minNode
A node defining the lower bound of the range.
Default is float().
maxNode
A node defining the upper bound of the range.
Default is float().
Constructs a new range factor node.
near
Defines the near value.
far
Defines the far value.
Returns the reciprocal of the parameter (1/x).
x
The parameter.
TSL function for creating a reference base node.
name
The name of the property the node refers to.
type
The uniform type that should be used to represent the property value.
object
The object the property belongs to.
TSL function for creating a reference node.
name
The name of the property the node refers to.
type
The uniform type that should be used to represent the property value.
object
The object the property belongs to.
TSL function for creating a reference base node. Use this function if you want need a reference to an array-like property that should be represented as a uniform buffer.
name
The name of the property the node refers to.
type
The uniform type that should be used to represent the property value.
count
The number of value inside the array-like object.
object
An array-like object the property belongs to.
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.
name
The name of the property the node refers to.
type
The uniform type that should be used to represent the property value.
count
The number of value inside the array-like object.
object
An array-like object the property belongs to.
Calculates the reflection direction for an incident vector.
I
The incident vector.
N
The normal vector.
TSL function for creating a reflector node.
parameters
An object holding configuration parameters.
Default is {}.
target
The 3D object the reflector is linked to.
Default is new Object3D().
resolution
The resolution scale.
Default is 1.
generateMipmaps
Whether mipmaps should be generated or not.
Default is false.
bounces
Whether reflectors can render other reflector nodes or not.
Default is true.
depth
Whether depth data should be generated or not.
Default is false.
samples
Anti-Aliasing samples of the internal render-target.
defaultTexture
The default texture node.
reflector
The reflector base node.
Calculates the refraction direction for an incident vector.
I
The incident vector.
N
The normal vector.
eta
The ratio of indices of refraction.
Reinhard tone mapping.
Reference: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf
color
The color that should be tone mapped.
exposure
The exposure.
Returns: The tone mapped color.
TSL function for creating a remap node.
node
The node that should be remapped.
inLowNode
The source or current lower bound of the range.
inHighNode
The source or current upper bound of the range.
outLowNode
The target lower bound of the range.
Default is float(0).
outHighNode
The target upper bound of the range.
Default is float(1).
TSL function for creating a remap node, but with enabled clamping.
node
The node that should be remapped.
inLowNode
The source or current lower bound of the range.
inHighNode
The source or current upper bound of the range.
outLowNode
The target lower bound of the range.
Default is float(0).
outHighNode
The target upper bound of the range.
Default is float(1).
TSL function for creating a posterize node.
color
The color node to process.
toneMapping
The tone mapping type.
Default is null.
outputColorSpace
The output color space.
Default is null.
TSL function for creating a renderer reference node.
name
The name of the property the node refers to.
type
The uniform type that should be used to represent the property value.
renderer
The renderer the property belongs to. When no renderer is set, the node refers to the renderer of the current state.
Default is null.
Replaces the default UV coordinates used in texture lookups.
material.contextNode = replaceDefaultUV( ( textureNode ) => {
// ...
return customUVCoordinates;
} );
callback
A callback that receives the texture node and must return the new uv coordinates.
node
An optional node to which the context will be applied.
Default is null.
Returns: A context node that replaces the default UV coordinates.
Creates a new RetroPassNode instance for PS1-style rendering.
The retro pass applies vertex snapping, affine texture mapping, and low-resolution rendering to achieve an authentic PlayStation 1 aesthetic. Combine with other post-processing effects like dithering, posterization, and scanlines for full retro look.
// Combined with other effects
let pipeline = retroPass( scene, camera );
pipeline = bayerDither( pipeline, 32 );
pipeline = posterize( pipeline, 32 );
renderPipeline.outputNode = pipeline;
scene
The scene to render.
camera
The camera to render from.
options
Additional options for the retro pass.
Default is {}.
affineDistortion
An optional node to apply affine distortion to UVs.
Default is null.
Returns: A new RetroPassNode instance.
TSL function for creating a RGB shift or split effect for post processing.
node
The node that represents the input of the effect.
amount
The amount of the RGB shift.
Default is 0.005.
angle
Defines in which direction colors are shifted.
Default is 0.
TSL function for creating a rotate node.
positionNode
The position node.
rotationNode
Represents the rotation that is applied to the position node. Depending on whether the position data are 2D or 3D, the rotation is expressed a single float value or an Euler value.
Rotates the given uv coordinates around a center point
uv
The uv coordinates.
rotation
The rotation defined in radians.
center
The center of rotation
Returns: The rotated uv coordinates.
Rounds the parameter to the nearest integer.
x
The parameter.
TSL function for creating a RTT node.
node
The node to render a texture with.
width
The width of the internal render target. If not width is applied, the render target is automatically resized.
Default is null.
height
The height of the internal render target.
Default is null.
options
The options for the internal render target.
Default is {type:HalfFloatType}.
Converts the given color value from sRGB to linear-sRGB color space.
color
The sRGB color.
Returns: The linear-sRGB color.
Converts the given color value from linear-sRGB to sRGB color space.
color
The linear-sRGB color.
Returns: The sRGB color.
Converts a texture or texture node to a sampler.
value
The texture or texture node to convert.
Converts a texture or texture node to a sampler comparison.
value
The texture or texture node to convert.
Constrains a value between 0 and 1.
value
The value to constrain.
Super-saturates or desaturates the given RGB color.
color
The input color.
adjustment
Specifies the amount of the conversion. A value under 1 desaturates the color, a value over 1 super-saturates it.
Default is 1.
Returns: The saturated color.
Applies scanline effect to simulate CRT monitor horizontal lines with animation.
color
The input color.
intensity
The intensity of the scanlines (0-1).
Default is 0.3.
count
The number of scanlines (typically matches vertical resolution).
Default is 240.
speed
The scroll speed of scanlines (0 = static, 1 = normal CRT roll).
Default is 0.0.
coord
The UV coordinates to use for scanlines.
Default is uv().
Returns: The color with scanlines applied.
TSL function for creating a conditional node.
condNode
The node that defines the condition.
ifNode
The node that is evaluate when the condition ends up true.
elseNode
The node that is evaluate when the condition ends up false.
Default is null.
Applies a sepia effect to the given color node.
color
The color node to apply the sepia for.
Returns: The updated color node.
TSL function for defining a name for the context value for a given node.
node
The node whose context should be modified.
name
The name to set.
TSL function for creating an instance of ShadowNode.
light
The shadow casting light.
shadow
The light shadow.
Returns: The created shadow node.
Generates a circle based on the uv coordinates.
coord
The uv to generate the circle.
Returns: The circle shape.
TSL function for creating a shared uniform group node with the given name and order.
name
The name of the uniform group node.
order
Influences the internal sorting.
Default is 0.
Shifts a node to the left.
a
The node to shift.
b
The value to shift.
Shifts a node to the right.
a
The node to shift.
b
The value to shift.
Extracts the sign of the parameter.
x
The parameter.
Returns the sine of the parameter.
x
The parameter.
A phase shifted sinus curve that starts at zero and ends at zero, with bouncing behavior. Reference: https://iquilezles.org/articles/functions/.
x
The value to compute the sin for.
k
Controls the amount of bounces.
Returns: The result value.
TSL function for creating a skinning node.
skinnedMesh
The skinned mesh.
TSL function for creating a SMAA node for anti-aliasing via post processing.
node
The node that represents the input of the effect.
Performs a Hermite interpolation between two values.
low
The value of the lower edge of the Hermite function.
high
The value of the upper edge of the Hermite function.
x
The source value for interpolation.
Alias for smoothstep() with a different parameter order.
x
The source value for interpolation.
low
The value of the lower edge of the Hermite function.
high
The value of the upper edge of the Hermite function.
TSL function for creating a sobel operator node which performs edge detection with a sobel filter.
node
The node that represents the input of the effect.
Applies a spherical warping effect to the given uv coordinates.
uv
The uv coordinates.
strength
The strength of the effect.
center
The center point
Returns: The updated uv coordinates.
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 );
countNode
The node that defines the number of sprites in the x and y direction (e.g 6x6).
uvNode
The uv node.
Default is uv().
frameNode
The node that defines the current frame/sprite.
Default is float(0).
Returns the square root of the parameter.
x
The parameter.
TSL function for creating a SSAA pass node for Supersampling Anti-Aliasing.
scene
The scene to render.
camera
The camera to render the scene with.
TSL function for creating a SSGI effect.
beautyNode
The texture node that represents the input of the effect.
depthNode
A texture node that represents the scene's depth.
normalNode
A texture node that represents the scene's normals.
camera
The camera the scene is rendered with.
TSL function for creating screen space reflections (SSR).
colorNode
The node that represents the beauty pass.
depthNode
A node that represents the beauty pass's depth.
normalNode
A node that represents the beauty pass's normals.
metalnessNode
A node that represents the beauty pass's metalness.
roughnessNode
A node that represents the beauty pass's roughness.
Default is null.
camera
The camera the scene is rendered with.
Default is null.
TSL function for creating a SSS effect.
depthNode
A texture node that represents the scene's depth.
camera
The camera the scene is rendered with.
mainLight
The main directional light of the scene.
TSL function for creating a stack node.
parent
The parent stack node.
Default is null.
Generate a step function by comparing two values.
x
The y parameter.
y
The x parameter.
Alias for step() with a different parameter order.
x
The source value for interpolation.
edge
The edge value.
TSL function for creating a stereo pass node for stereoscopic rendering.
scene
The scene to render.
camera
The camera to render the scene with.
TSL function for creating a storage buffer node.
value
The buffer data.
type
The buffer type (e.g. 'vec3').
Default is null.
count
The buffer count.
Default is 0.
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.
TSL function for creating a storage element node.
storageBufferNode
The storage buffer node.
indexNode
The index node that defines the element access.
TSL function for creating a storage texture node.
value
The storage texture.
uvNode
The uv node.
storeNode
The value node that should be stored in the texture.
Default is null.
TSL function for creating a struct node.
membersLayout
The layout of the struct members.
name
The name of the struct.
Default is null.
Returns: The struct function.
Returns the subtraction of two or more value.
a
The first input.
b
The second input.
params
Additional input parameters.
Creates a new sub-build node.
node
The node to be built in the sub-build.
name
The name of the sub-build.
type
The type of the node, if known.
Default is null.
Returns: A node object wrapping the SubBuildNode instance.
A reduction that adds e among all active invocations and returns that result.
e
The value provided to the reduction by the current invocation.
Returns: The accumulated result of the reduction operation.
Returns true if e is true for all active invocations in the subgroup.
Returns: The result of the computation.
A reduction that performs a bitwise and of e among all active invocations and returns that result.
e
The value provided to the reduction by the current invocation.
Returns: The result of the reduction operation.
Returns true if e is true for any active invocation in the subgroup
Returns: The result of the computation.
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.
pred
A boolean that sets the bit corresponding to the invocations subgroup invocation id.
Returns:
Broadcasts e from the invocation whose subgroup_invocation_id matches id, to all active invocations.
e
The value to broadcast from subgroup invocation 'id'.
id
The subgroup invocation to broadcast from.
Returns: The broadcast value.
Broadcasts e from the active invocation with the lowest subgroup_invocation_id in the subgroup to all other active invocations.
e
The value to broadcast from the lowest subgroup invocation.
id
The subgroup invocation to broadcast from.
Returns: The broadcast value.
Returns true if this invocation has the lowest subgroup_invocation_id among active invocations in the subgroup.
Returns: The result of the computation.
An exclusive scan that returns the sum of e for all active invocations with subgroup_invocation_id less than this invocation.
e
The value provided to the exclusive scan by the current invocation.
Returns: The accumulated result of the exclusive scan operation.
An exclusive scan that returns the product of e for all active invocations with subgroup_invocation_id less than this invocation.
e
The value provided to the exclusive scan by the current invocation.
Returns: The accumulated result of the exclusive scan operation.
An inclusive scan returning the sum of e for all active invocations with subgroup_invocation_id less than or equal to this invocation.
e
The value provided to the inclusive scan by the current invocation.
Returns: The accumulated result of the inclusive scan operation.
An inclusive scan returning the product of e for all active invocations with subgroup_invocation_id less than or equal to this invocation.
e
The value provided to the inclusive scan by the current invocation.
Returns: The accumulated result of the inclusive scan operation.
A reduction that performs a max of e among all active invocations and returns that result.
e
The value provided to the reduction by the current invocation.
Returns: The result of the reduction operation.
A reduction that performs a min of e among all active invocations and returns that result.
e
The value provided to the reduction by the current invocation.
Returns: The result of the reduction operation.
A reduction that multiplies e among all active invocations and returns that result.
e
The value provided to the reduction by the current invocation.
Returns: The accumulated result of the reduction operation.
A reduction that performs a bitwise or of e among all active invocations and returns that result.
e
The value provided to the reduction by the current invocation.
Returns: The result of the reduction operation.
Returns v from the active invocation whose subgroup_invocation_id matches id
v
The value to return from subgroup invocation id^mask.
id
The subgroup invocation which returns the value v.
Returns: The broadcast value.
Returns v from the active invocation whose subgroup_invocation_id matches subgroup_invocation_id + delta
v
The value to return from subgroup invocation id^mask.
delta
A value that offsets the current subgroup invocation.
Returns: The broadcast value.
Returns v from the active invocation whose subgroup_invocation_id matches subgroup_invocation_id - delta
v
The value to return from subgroup invocation id^mask.
delta
A value that offsets the current in.
Returns: The broadcast value.
Returns v from the active invocation whose subgroup_invocation_id matches subgroup_invocation_id ^ mask.
v
The value to return from subgroup invocation id^mask.
mask
A bitmask that determines the target invocation via a XOR operation.
Returns: The broadcast value.
A reduction that performs a bitwise xor of e among all active invocations and returns that result.
e
The value provided to the reduction by the current invocation.
Returns: The result of the reduction operation.
Returns the tangent of the parameter.
x
The parameter.
TSL function for creating a texture node or sample a texture node already existing.
value
The texture.
Default is EmptyTexture.
uvNode
The uv node.
Default is null.
levelNode
The level node.
Default is null.
biasNode
The bias node.
Default is null.
TSL function for creating a 3D texture node.
value
The 3D texture.
uvNode
The uv node.
Default is null.
levelNode
The level node.
Default is null.
TSL function for creating a texture node that fetches/loads texels without interpolation.
value
The texture.
Default is EmptyTexture.
uvNode
The uv node.
Default is null.
levelNode
The level node.
Default is null.
TSL function for creating a texture node that fetches/loads texels without interpolation.
value
The texture.
Default is EmptyTexture.
uvNode
The uv node.
Default is null.
levelNode
The level node.
Default is null.
biasNode
The bias node.
Default is null.
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.
TSL function for creating a texture node.
value
The texture.
uvNode
The uv node.
Default is null.
levelNode
The level node.
Default is null.
biasNode
The bias node.
Default is null.
Applies mipped bicubic texture filtering to the given texture node.
textureNode
The texture node that should be filtered.
strength
Defines the strength of the bicubic filtering.
Returns: The filtered texture sample.
Applies mipped bicubic texture filtering to the given texture node.
textureNode
The texture node that should be filtered.
lodNode
Defines the LOD to sample from.
Returns: The filtered texture sample.
TSL function for creating a texture node that fetches/loads texels without interpolation.
value
The texture.
Default is EmptyTexture.
uvNode
The uv node.
Default is null.
levelNode
The level node.
Default is null.
biasNode
The bias node.
Default is null.
TSL function for creating a texture size node.
textureNode
A texture node which size should be retrieved.
levelNode
A level node which defines the requested mip.
Default is null.
TODO: Explain difference to storageTexture().
value
The storage texture.
uvNode
The uv node.
storeNode
The value node that should be stored in the texture.
Default is null.
TSL function that creates a tiled lights node.
maxLights
The maximum number of lights.
Default is 1024.
tileSize
The tile size.
Default is 32.
Returns: The tiled lights node.
TSL function for creating a tone mapping node.
mapping
The tone mapping type.
exposure
The tone mapping exposure.
color
The color node to process.
TSL function for creating a toon outline pass node.
scene
A reference to the scene.
camera
A reference to the camera.
color
Defines the outline's color.
thickness
Defines the outline's thickness.
Default is 0.003.
alpha
Defines the outline's alpha.
Default is 1.
TSL function for creating a TRAA node for Temporal Reprojection Anti-Aliasing.
beautyNode
The texture node that represents the input of the effect.
depthNode
A node that represents the scene's depth.
velocityNode
A node that represents the scene's velocity.
camera
The camera the scene is rendered with.
Transforms the direction of a vector by a matrix and then normalizes the result.
direction
The direction vector.
matrix
The transformation matrix.
Transforms the normal with the given matrix.
normal
The normal.
matrix
The matrix.
Default is modelWorldMatrix.
Returns: The transformed normal.
Transforms the given normal from local to view space.
normal
The normal.
builder
The current node builder.
Returns: The transformed normal.
TSL function for creating a transition node for post processing.
nodeA
A texture node that represents the beauty pass of the first scene.
nodeB
A texture node that represents the beauty pass of the second scene.
mixTextureNode
A texture that defines how the transition effect should look like.
mixRatio
The interpolation factor that controls the mix.
threshold
Can be used to tweak the linear interpolation.
useTexture
Whether mixTextureNode should influence the transition or not.
Returns the transpose of a matrix.
x
The parameter.
Generates a noise value from the given position, speed and time parameters.
position
The position.
speed
The speed.
time
The time.
Returns: The generated noise.
TSL function for creating a triplanar textures node.
textureXNode
First texture node.
textureYNode
Second texture node. When not set, the shader will sample from textureXNode instead.
Default is null.
textureZNode
Third texture node. When not set, the shader will sample from textureXNode instead.
Default is null.
scaleNode
The scale node.
Default is float(1).
positionNode
Vertex positions in local space.
Default is positionLocal.
normalNode
Normals in local space.
Default is normalLocal.
TSL function for creating a triplanar textures node.
Can be used for triplanar texture mapping.
material.colorNode = triplanarTexture( texture( diffuseMap ) );
textureXNode
First texture node.
textureYNode
Second texture node. When not set, the shader will sample from textureXNode instead.
Default is null.
textureZNode
Third texture node. When not set, the shader will sample from textureXNode instead.
Default is null.
scaleNode
The scale node.
Default is float(1).
positionNode
Vertex positions in local space.
Default is positionLocal.
normalNode
Normals in local space.
Default is normalLocal.
Truncates the parameter, removing the fractional part.
x
The parameter.
Bitcast an unsigned integer or a vector of unsigned integers to a corresponding float type with the same element size.
value
The unsigned integer or vector of unsigned integers to bitcast.
TSL function for creating a uniform node.
value
The value of this uniform or your type. Usually a JS primitive or three.js object (vector, matrix, color, texture).
type
The node type. If no explicit type is defined, the node tries to derive the type from its value.
TSL function for creating an uniform array node.
values
Array-like data.
nodeType
The data type of the array elements.
TSL function for creating a uniform cube texture node.
value
The cube texture.
Default is EmptyTexture.
TSL function for defining a uniformFlow context value for a given node.
node
The node whose dependencies should all execute within a uniform control-flow path.
TSL function for creating a uniform group node with the given name.
name
The name of the uniform group node.
TSL function for creating a uniform texture node.
value
The texture.
Unpacks a 32-bit unsigned integer into two 16-bit values, interpreted as 16-bit floating-point numbers. Returns a vec2 with both values.
value
The unsigned integer to be unpacked
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.
xy
The X,Y coordinates of the normal.
Returns: The resulting normal.
Unpacks a 32-bit unsigned integer into two 16-bit values, interpreted as normalized signed integers. Returns a vec2 with both values.
value
The unsigned integer to be unpacked
Unpacks a 32-bit unsigned integer into two 16-bit values, interpreted as normalized unsigned integers. Returns a vec2 with both values.
value
The unsigned integer to be unpacked
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.
color
The input color with premultiplied alpha.
Returns: The color with non-premultiplied alpha.
TSL function for creating a user data node.
name
The property name that should be referenced by the node.
inputType
The node data type of the reference.
userData
A reference to the userData object. If not provided, the userData property of the 3D object that uses the node material is evaluated.
TSL function for creating an uv attribute node with the given index.
index
The uv index.
Default is 0.
Returns: The uv attribute node.
TSL function for creating a varying node.
node
The node for which a varying should be created.
name
The name of the varying in the shader.
TSL function for creating a varying property node.
type
The type of the node.
name
The name of the varying in the shader.
Default is null.
TSL function for creating a reference node.
index
The attribute index.
Default is 0.
Computes a node in the vertex stage.
node
The node which should be executed in the vertex stage.
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.
color
The input color.
adjustment
Controls the intensity of the vibrance effect.
Default is 1.
Returns: The updated color.
TSL function for converting a viewZ value to a logarithmic depth value.
viewZ
The viewZ node.
near
The camera's near value.
far
The camera's far value.
TSL function for converting a viewZ value to an orthographic depth value.
viewZ
The viewZ node.
near
The camera's near value.
far
The camera's far value.
TSL function for converting a viewZ value to a perspective depth value.
Note: {link https://twitter.com/gonnavis/status/1377183786949959682}.
viewZ
The viewZ node.
near
The camera's near value.
far
The camera's far value.
TSL function for converting a viewZ value to a reversed orthographic depth value.
viewZ
The viewZ node.
near
The camera's near value.
far
The camera's far value.
TSL function for converting a viewZ value to a reversed perspective depth value.
viewZ
The viewZ node.
near
The camera's near value.
far
The camera's far value.
TSL function for a viewport depth texture node.
uvNode
The uv node.
Default is screenUV.
levelNode
The level node.
Default is null.
TSL function for creating a viewport texture node with enabled mipmap generation.
uvNode
The uv node.
Default is screenUV.
levelNode
The level node.
Default is null.
framebufferTexture
A framebuffer texture holding the viewport data. If not provided, a framebuffer texture is created automatically.
Default is null.
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.
uv
The uv node.
Default is screenUV.
level
The level node.
Default is null.
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.
uv
Optional uv coordinates. By default screenUV is used.
Returns: The update uv coordinates.
TSL function for creating a shared viewport texture node.
uvNode
The uv node.
Default is screenUV.
levelNode
The level node.
Default is null.
TSL function for creating a viewport texture node.
uvNode
The uv node.
Default is screenUV.
levelNode
The level node.
Default is null.
framebufferTexture
A framebuffer texture holding the viewport data. If not provided, a framebuffer texture is created automatically.
Default is null.
Applies vignette effect to darken the edges of the screen.
color
The input color.
intensity
The intensity of the vignette (0-1).
Default is 0.4.
smoothness
The smoothness of the vignette falloff.
Default is 0.5.
coord
The UV coordinates to use for vignette calculation.
Default is uv().
Returns: The color with vignette applied.
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.
sampleIndex
The index of the current sample (0-based).
samplesCount
The total number of samples.
phi
Rotation angle in radians (typically from IGN * 2π).
Returns: A 2D point on the unit disk.
TSL function for creating a WGSL code node.
src
The native code.
includes
An array of includes.
TSL function for creating a workgroup info node. Creates a new 'workgroup' scoped array buffer.
type
The data type of a 'workgroup' scoped buffer element.
count
The number of elements in the buffer.
Default is 0.
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.
TSL function for converting a given color node from the current working color space to the given color space.
node
Represents the node to convert.
targetColorSpace
The target color space.
Performs logical XOR on two nodes.
a
The first input.
b
The second input.
Represents the different interpolation sampling modes.
NORMAL
string
Normal sampling mode.
CENTROID
string
Centroid sampling mode.
SAMPLE
string
Sample-specific sampling mode.
FIRST
string
Flat interpolation using the first vertex.
EITHER
string
Flat interpolation using either vertex.
Represents the different interpolation sampling types.
PERSPECTIVE
string
Perspective-correct interpolation.
LINEAR
string
Linear interpolation.
FLAT
string
Flat interpolation.
This type represents mouse buttons and interaction types in context of controls.
MIDDLE
number
The left mouse button.
LEFT
number
The middle mouse button.
RIGHT
number
The right mouse button.
ROTATE
number
A rotate interaction.
DOLLY
number
A dolly interaction.
PAN
number
A pan interaction.
This type represents the different timestamp query types.
COMPUTE
string
A compute timestamp query.
RENDER
string
A render timestamp query.
This type represents touch interaction types in context of controls.
ROTATE
number
A rotate interaction.
PAN
number
A pan interaction.
DOLLY_PAN
number
The dolly-pan interaction.
DOLLY_ROTATE
number
A dolly-rotate interaction.
Debug configuration.
checkShaderErrors
boolean
Whether shader errors should be checked or not.
onShaderError
function
A callback function that is executed when a shader error happens. Only supported with WebGL 2 right now.
getShaderAsync
function
Allows the get the raw shader code for the given scene, camera and 3D object.
Shadow map configuration
enabled
boolean
Whether to globally enable shadows or not.
transmitted
boolean
Whether to enable light transmission through non-opaque materials.
type
number
The shadow map type.
XR configuration.
enabled
boolean
Whether to globally enable XR or not.
Animation loop parameter of renderer.setAnimationLoop().
time
A timestamp indicating the end time of the previous frame's rendering.
frame
A reference to the current XR frame. Only relevant when using XR rendering.
Callback for onError in loaders.
error
The error which occurred during the loading process.
Callback for onProgress in loaders.
event
An instance of ProgressEvent that represents the current loading status.
Callback for Renderer#setRenderObjectFunction.
object
The 3D object.
scene
The scene the 3D object belongs to.
camera
The camera the object should be rendered with.
geometry
The object's geometry.
material
The object's material.
group
Only relevant for objects using multiple materials. This represents a group entry from the respective BufferGeometry.
lightsNode
The current lights node.
clippingContext
The clipping context.
passId
An optional ID for identifying the pass.
Default is null.
Callback for Node#traverse.
node
The current node.