Skip to content

Documentation / scene / ConstantTexture2DNode

Class: ConstantTexture2DNode ​

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:452

2D texture constant node

Remarks ​

Represents a 2D texture resource in the material node graph. This is the most common texture type, used for:

  • Albedo/diffuse maps
  • Normal maps
  • Roughness/metallic maps
  • Emissive maps
  • Any 2D image-based data

The texture can be loaded from various image formats:

  • JPEG (.jpg, .jpeg)
  • PNG (.png)
  • TGA (.tga)
  • HDR/Radiance (.hdr)
  • DDS (.dds)
  • WebP (.webp)

Output:

  • Output 1: Texture sampler (tex2D type)

Example ​

typescript
const albedoTex = new ConstantTexture2DNode();
albedoTex.paramName = 'albedoMap';
albedoTex.addressU = 'repeat';
albedoTex.addressV = 'repeat';
albedoTex.filterMin = 'linear';
albedoTex.filterMag = 'linear';

// Sample the texture
const uv = new VertexUVNode();
const sample = new TextureSampleNode();
sample.connectInput(1, albedoTex, 1);
sample.connectInput(2, uv, 1);

// Use in material
output.connectInput(1, sample, 1); // BaseColor

Extends ​

Constructors ​

Constructor ​

new ConstantTexture2DNode(): ConstantTexture2DNode

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:461

Creates a new 2D texture node

Returns ​

ConstantTexture2DNode

Remarks ​

Initializes with:

  • One output slot for the texture sampler
  • Default 1x1 white texture

Overrides ​

BaseTextureNode.constructor

Properties ​

sRGB ​

sRGB: boolean

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:301

Whether this texture should be loaded in sRGB color space

Inherited from ​

BaseTextureNode.sRGB


addressU ​

addressU: TextureAddressMode

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:303

Horizontal texture coordinate wrapping mode

Inherited from ​

BaseTextureNode.addressU


addressV ​

addressV: TextureAddressMode

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:305

Vertical texture coordinate wrapping mode

Inherited from ​

BaseTextureNode.addressV


filterMin ​

filterMin: TextureFilterMode

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:307

Minification filter mode

Inherited from ​

BaseTextureNode.filterMin


filterMag ​

filterMag: TextureFilterMode

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:309

Magnification filter mode

Inherited from ​

BaseTextureNode.filterMag


filterMip ​

filterMip: TextureFilterMode

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:311

Mipmap filter mode

Inherited from ​

BaseTextureNode.filterMip


textureId ​

textureId: string

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:313

Asset ID for the texture (for serialization)

Inherited from ​

BaseTextureNode.textureId


_inputs ​

protected _inputs: GraphNodeInput[]

Defined in: libs/scene/src/utility/blueprint/node.ts:336

Internal storage for input slot definitions

Inherited from ​

BaseTextureNode._inputs


_outputs ​

protected _outputs: GraphNodeOutput[]

Defined in: libs/scene/src/utility/blueprint/node.ts:338

Internal storage for output slot definitions

Inherited from ​

BaseTextureNode._outputs


_error ​

protected _error: string

Defined in: libs/scene/src/utility/blueprint/node.ts:340

Internal storage for error message

Inherited from ​

BaseTextureNode._error

Accessors ​

paramName ​

Get Signature ​

get paramName(): string

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:342

Gets the shader parameter name

Returns ​

string

The uniform name used in generated shader code

Set Signature ​

set paramName(val): void

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:345

Uniform parameter name

Parameters ​
val ​

string

Returns ​

void

Uniform parameter name

Inherited from ​

BaseTextureNode.paramName


expose ​

Get Signature ​

get expose(): boolean

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:354

Whether this texture parameter should be exposed to material instances.

Returns ​

boolean

Set Signature ​

set expose(val): void

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:357

Parameters ​
val ​

boolean

Returns ​

void

Inherited from ​

BaseTextureNode.expose


isUniform ​

Get Signature ​

get isUniform(): boolean

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:372

Indicates this node represents a shader uniform

Remarks ​

Texture nodes create uniform declarations in the generated shader code.

Returns ​

boolean

Always true for texture nodes

Whether this node has uniform value

Inherited from ​

BaseTextureNode.isUniform


inputs ​

Get Signature ​

get inputs(): GraphNodeInput[]

Defined in: libs/scene/src/utility/blueprint/node.ts:380

Gets the input slot definitions array

Returns ​

GraphNodeInput[]

Array of input slot definitions

Inherited from ​

BaseTextureNode.inputs


outputs ​

Get Signature ​

get outputs(): GraphNodeOutput[]

Defined in: libs/scene/src/utility/blueprint/node.ts:384

Gets the output slot definitions array

Returns ​

GraphNodeOutput[]

Array of output slot definitions

Inherited from ​

BaseTextureNode.outputs


error ​

Get Signature ​

get error(): string

Defined in: libs/scene/src/utility/blueprint/node.ts:388

Gets the current error message

Returns ​

string

Set Signature ​

set error(str): void

Defined in: libs/scene/src/utility/blueprint/node.ts:391

Current error message, empty string if no error

Parameters ​
str ​

string

Returns ​

void

Current error message, empty string if no error

Inherited from ​

BaseTextureNode.error

Methods ​

on() ​

on<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:630

IEventTarget.on

Type Parameters ​

K ​

K extends "changed"

Parameters ​

type ​

K

listener ​

EventListener<{ changed: []; }, K>

context? ​

unknown

Returns ​

void

Inherited from ​

BaseTextureNode.on


once() ​

once<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:634

IEventTarget.once

Type Parameters ​

K ​

K extends "changed"

Parameters ​

type ​

K

listener ​

EventListener<{ changed: []; }, K>

context? ​

unknown

Returns ​

void

Inherited from ​

BaseTextureNode.once


off() ​

off<K>(type, listener?, context?): void

Defined in: libs/base/dist/index.d.ts:638

IEventTarget.off

Type Parameters ​

K ​

K extends "changed"

Parameters ​

type ​

K

listener? ​

EventListener<{ changed: []; }>

context? ​

unknown

Returns ​

void

Inherited from ​

BaseTextureNode.off


dispatchEvent() ​

dispatchEvent<K>(type, ...args): void

Defined in: libs/base/dist/index.d.ts:642

IEventTarget.dispatchEvent

Type Parameters ​

K ​

K extends "changed"

Parameters ​

type ​

K

args ​

...object[K]

Returns ​

void

Inherited from ​

BaseTextureNode.dispatchEvent


toString() ​

toString(): string

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:380

Generates a string representation of this node

Returns ​

string

The parameter name

Inherited from ​

BaseTextureNode.toString


validate() ​

protected validate(): string

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:392

Validates the node state

Returns ​

string

Empty string (always valid)

Remarks ​

Texture nodes are always valid as they have no required inputs and always have a valid texture (default if none assigned).

Inherited from ​

BaseTextureNode.validate


getSerializationCls() ​

static getSerializationCls(): SerializableClass

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:482

Gets the serialization descriptor for this node type

Returns ​

SerializableClass

Serialization class descriptor

Remarks ​

Includes:

  • Texture asset loading with MIME type validation
  • All common texture parameters (addressing, filtering)
  • Error handling for invalid or missing textures

getType() ​

protected getType(): string

Defined in: libs/scene/src/utility/blueprint/material/texture.ts:524

Gets the output type

Returns ​

string

'tex2D'

Overrides ​

BaseTextureNode.getType


getOutputType() ​

getOutputType(id): string

Defined in: libs/scene/src/utility/blueprint/node.ts:376

Gets the output type for a specific output slot

Parameters ​

id ​

number

The output slot ID

Returns ​

string

The type name of the output

Remarks ​

Default implementation delegates to the abstract getType() method. Can be overridden for more complex type logic.

Inherited from ​

BaseTextureNode.getOutputType


check() ​

check(): void

Defined in: libs/scene/src/utility/blueprint/node.ts:413

Validates the node and updates error state

Returns ​

void

Remarks ​

Calls the validate() method and stores the result in _error. Emits a 'changed' event if the error state changes.

Inherited from ​

BaseTextureNode.check


reset() ​

reset(): void

Defined in: libs/scene/src/utility/blueprint/node.ts:422

Clears the error state

Returns ​

void

Remarks ​

Sets _error to an empty string.

Inherited from ​

BaseTextureNode.reset


setInput() ​

setInput(id, node, inputId): void

Defined in: libs/scene/src/utility/blueprint/node.ts:443

Connects an input slot to another node's output

Parameters ​

id ​

number

The input slot ID to connect

node ​

BaseGraphNode

The source node to connect from

inputId ​

number

The output slot ID of the source node

Returns ​

void

Throws ​

Error if the input slot with the given ID doesn't exist

Example ​

typescript
const addNode = new AddNode();
const constantNode = new ConstantNode(5.0);

// Connect constantNode's output 0 to addNode's input 0
addNode.setInput(0, constantNode, 0);

Inherited from ​

BaseTextureNode.setInput

Released under the MIT License.