mrdoob/three.js · error

THREE.NodeBuilder: Uniform "${ type }" not implemented.

Error message

THREE.NodeBuilder: Uniform "${ type }" not implemented.

What it means

Thrown by NodeBuilder.getNodeUniform() when a uniform's type is not one of the supported scalar/vector/matrix/color types (float/int/uint, vec/ivec/uvec 2-4, color, mat2/3/4). Any other type (bool, struct, array, sampler-as-uniform, custom) cannot be turned into a NodeUniform.

Source

Thrown at src/nodes/core/NodeBuilder.js:3334

	getNodeUniform( uniformNode, type ) {

		const nodeData = this.getSharedDataFromNode( uniformNode );

		let node = nodeData.cache;

		if ( node === undefined ) {

			if ( type === 'float' || type === 'int' || type === 'uint' ) node = new NumberNodeUniform( uniformNode );
			else if ( type === 'vec2' || type === 'ivec2' || type === 'uvec2' ) node = new Vector2NodeUniform( uniformNode );
			else if ( type === 'vec3' || type === 'ivec3' || type === 'uvec3' ) node = new Vector3NodeUniform( uniformNode );
			else if ( type === 'vec4' || type === 'ivec4' || type === 'uvec4' ) node = new Vector4NodeUniform( uniformNode );
			else if ( type === 'color' ) node = new ColorNodeUniform( uniformNode );
			else if ( type === 'mat2' ) node = new Matrix2NodeUniform( uniformNode );
			else if ( type === 'mat3' ) node = new Matrix3NodeUniform( uniformNode );
			else if ( type === 'mat4' ) node = new Matrix4NodeUniform( uniformNode );
			else {

				throw new Error( `THREE.NodeBuilder: Uniform "${ type }" not implemented.` );

			}

			nodeData.cache = node;

		}

		return node;

	}

	/**
	 * Formats the given shader snippet from a given type into another one. E.g.
	 * this method might be used to convert a simple float string `"1.0"` into a
	 * `vec3` representation: `"vec3<f32>( 1.0 )"`.
	 *
	 * @param {string} snippet - The shader snippet.
	 * @param {string} fromType - The source type.

View on GitHub (pinned to da05705fa3)

Solutions

  1. Use a supported primitive type for the uniform (float/int/uint, vec2-4, ivec2-4, uvec2-4, color, mat2-4).
  2. Represent booleans as uint/int and convert in the shader body.
  3. For array/struct data, use a buffer/instanced attribute or multiple scalar uniforms instead of a single typed uniform.

Example fix

// before
const flag = uniform( 'bool' ).onBeforeRender( ... );

// after
const flag = uniform( 'uint' );
// convert in tsl: flag.equal( 1 )
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_UNIFORM_TYPES = new Set( [ 'float','int','uint','vec2','vec3','vec4','ivec2','ivec3','ivec4','uvec2','uvec3','uvec4','color','mat2','mat3','mat4' ] );
function assertUniformType( type ) {
  if ( ! SUPPORTED_UNIFORM_TYPES.has( type ) ) throw new TypeError( `Unsupported uniform type: ${ type }` );
}

Type guard

const isSupportedUniformType = ( t ) => SUPPORTED_UNIFORM_TYPES.has( t );

Prevention

When it happens

Trigger: Declaring a uniform with `uniform('bool')` or an unregistered/custom type; passing a uniform whose inferred type is an array or struct; using a texture/_sampler where a value uniform is expected; a node reporting a type string the uniform factory does not handle.

Common situations: Authoring a custom node that exposes a uniform of an unsupported type; mis-typing a uniform declaration; version mismatch where a type was not yet wired into the uniform factory.

Related errors


AI-assisted analysis of mrdoob/three.js@da05705fa3 (2026-08-12). Data as JSON: /api/errors/652157f1b02f9fb9. Report an issue: GitHub.