Skip to content

Documentation / scene / EyeMaterial

Class: EyeMaterial

Defined in: libs/scene/src/material/eye.ts:53

Realtime eye material for realistic and semi-realistic characters.

Remarks

Shades the whole eyeball - sclera, limbus and iris - from a single mesh and a single material. There is no separate cornea layer: the corneal bulge is simulated by refracting the view ray and offsetting the iris lookup, so no transparent second surface, OIT or depth sorting is involved.

The refraction works in tangent space (per-fragment TBN) rather than object space, because the shader cannot reconstruct a fixed object-space gaze axis after skinning. The residual error over the sphere's curvature is small at the depths an iris actually sits.

Regions are derived analytically from the UV distance to the iris centre, so no mask texture is required - which is why the asset must place the iris at a known UV location; see EyeMaterial.irisCenter.

Expected asset setup:

  • A single eyeball mesh (sphere or front dome) carrying normals and tangents; without tangents there is no TBN and refraction degrades to a flat iris.
  • UVs that place the pupil centre at EyeMaterial.irisCenter, with the iris occupying a disc of EyeMaterial.irisRadius around it.
  • An iris texture with the pupil at its centre. The sclera texture is optional; without one the sclera is shaded from EyeMaterial.scleraColor.

Extends

Implements

  • Clonable<EyeMaterial>

Constructors

Constructor

new EyeMaterial(): EyeMaterial

Defined in: libs/scene/src/material/eye.ts:100

Returns

EyeMaterial

Overrides

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).constructor

Properties

normalTexture

normalTexture: Texture2D<unknown>

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).normalTexture


normalTextureSampler

normalTextureSampler: TextureSampler<unknown>

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).normalTextureSampler


normalTexCoordIndex

normalTexCoordIndex: number

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).normalTexCoordIndex


normalTexCoordMatrix

normalTexCoordMatrix: Matrix4x4

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).normalTexCoordMatrix


hasNormalTexture

hasNormalTexture: () => boolean

Returns

boolean

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).hasNormalTexture


getNormalTextureUniform

getNormalTextureUniform: (scope) => PBShaderExp

Parameters

scope

PBInsideFunctionScope

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).getNormalTextureUniform


getNormalTexCoord

getNormalTexCoord: (scope) => PBShaderExp

Parameters

scope

PBInsideFunctionScope

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).getNormalTexCoord


sampleNormalTexture

sampleNormalTexture: (scope, texCoord?) => PBShaderExp

Parameters

scope

PBInsideFunctionScope

texCoord?

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).sampleNormalTexture


albedoTexture

albedoTexture: Texture2D<unknown>

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).albedoTexture


albedoTextureSampler

albedoTextureSampler: TextureSampler<unknown>

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).albedoTextureSampler


albedoTexCoordIndex

albedoTexCoordIndex: number

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).albedoTexCoordIndex


albedoTexCoordMatrix

albedoTexCoordMatrix: Matrix4x4

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).albedoTexCoordMatrix


hasAlbedoTexture

hasAlbedoTexture: () => boolean

Returns

boolean

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).hasAlbedoTexture


getAlbedoTextureUniform

getAlbedoTextureUniform: (scope) => PBShaderExp

Parameters

scope

PBInsideFunctionScope

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).getAlbedoTextureUniform


getAlbedoTexCoord

getAlbedoTexCoord: (scope) => PBShaderExp

Parameters

scope

PBInsideFunctionScope

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).getAlbedoTexCoord


sampleAlbedoTexture

sampleAlbedoTexture: (scope, texCoord?) => PBShaderExp

Parameters

scope

PBInsideFunctionScope

texCoord?

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).sampleAlbedoTexture


irisTexture

irisTexture: Texture2D<unknown>

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).irisTexture


irisTextureSampler

irisTextureSampler: TextureSampler<unknown>

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).irisTextureSampler


irisTexCoordIndex

irisTexCoordIndex: number

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).irisTexCoordIndex


irisTexCoordMatrix

irisTexCoordMatrix: Matrix4x4

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).irisTexCoordMatrix


hasIrisTexture

hasIrisTexture: () => boolean

Returns

boolean

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).hasIrisTexture


getIrisTextureUniform

getIrisTextureUniform: (scope) => PBShaderExp

Parameters

scope

PBInsideFunctionScope

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).getIrisTextureUniform


getIrisTexCoord

getIrisTexCoord: (scope) => PBShaderExp

Parameters

scope

PBInsideFunctionScope

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).getIrisTexCoord


sampleIrisTexture

sampleIrisTexture: (scope, texCoord?) => PBShaderExp

Parameters

scope

PBInsideFunctionScope

texCoord?

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).sampleIrisTexture


scleraTexture

scleraTexture: Texture2D<unknown>

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).scleraTexture


scleraTextureSampler

scleraTextureSampler: TextureSampler<unknown>

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).scleraTextureSampler


scleraTexCoordIndex

scleraTexCoordIndex: number

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).scleraTexCoordIndex


scleraTexCoordMatrix

scleraTexCoordMatrix: Matrix4x4

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).scleraTexCoordMatrix


hasScleraTexture

hasScleraTexture: () => boolean

Returns

boolean

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).hasScleraTexture


getScleraTextureUniform

getScleraTextureUniform: (scope) => PBShaderExp

Parameters

scope

PBInsideFunctionScope

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).getScleraTextureUniform


getScleraTexCoord

getScleraTexCoord: (scope) => PBShaderExp

Parameters

scope

PBInsideFunctionScope

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).getScleraTexCoord


sampleScleraTexture

sampleScleraTexture: (scope, texCoord?) => PBShaderExp

Parameters

scope

PBInsideFunctionScope

texCoord?

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).sampleScleraTexture


albedoColor

albedoColor: Vector4

Defined in: libs/scene/src/material/mixins/albedocolor.ts:16

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).albedoColor


normalScale

normalScale: number

Defined in: libs/scene/src/material/mixins/lit.ts:23

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).normalScale


normalFlipY

normalFlipY: boolean

Defined in: libs/scene/src/material/mixins/lit.ts:24

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).normalFlipY


normalMapMode

normalMapMode: "tangent-space" | "object-space"

Defined in: libs/scene/src/material/mixins/lit.ts:25

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).normalMapMode


doubleSidedLighting

doubleSidedLighting: boolean

Defined in: libs/scene/src/material/mixins/lit.ts:26

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).doubleSidedLighting

Accessors

disposed

Get Signature

get disposed(): boolean

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

Returns

boolean

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).disposed


vertexNormal

Get Signature

get vertexNormal(): boolean

Defined in: libs/scene/src/material/eye.ts:182

true if vertex normal attribute presents

Returns

boolean

Set Signature

set vertexNormal(val): void

Defined in: libs/scene/src/material/eye.ts:185

Parameters
val

boolean

Returns

void


vertexTangent

Get Signature

get vertexTangent(): boolean

Defined in: libs/scene/src/material/eye.ts:193

true if vertex tangent attribute presents. Refraction needs a tangent frame; without one the iris renders flat, with no parallax.

Returns

boolean

Set Signature

set vertexTangent(val): void

Defined in: libs/scene/src/material/eye.ts:196

Parameters
val

boolean

Returns

void


irisCenter

Get Signature

get irisCenter(): Immutable<Vector4>

Defined in: libs/scene/src/material/eye.ts:201

UV coordinate of the pupil centre. Only xy is used.

Returns

Immutable<Vector4>

Set Signature

set irisCenter(val): void

Defined in: libs/scene/src/material/eye.ts:204

Parameters
val

Immutable<Vector4>

Returns

void


irisRadius

Get Signature

get irisRadius(): number

Defined in: libs/scene/src/material/eye.ts:212

Iris disc radius, in UV units.

Returns

number

Set Signature

set irisRadius(val): void

Defined in: libs/scene/src/material/eye.ts:215

Parameters
val

number

Returns

void


irisDepth

Get Signature

get irisDepth(): number

Defined in: libs/scene/src/material/eye.ts:227

Depth of the iris plane below the corneal surface, in UV units - the parallax strength. 0 is flat; 0.05-0.08 reads as a real anterior chamber.

Returns

number

Set Signature

set irisDepth(val): void

Defined in: libs/scene/src/material/eye.ts:230

Parameters
val

number

Returns

void


ior

Get Signature

get ior(): number

Defined in: libs/scene/src/material/eye.ts:239

Index of refraction of the cornea. 1.376 is the physical value.

Returns

number

Set Signature

set ior(val): void

Defined in: libs/scene/src/material/eye.ts:242

Parameters
val

number

Returns

void


pupilRadius

Get Signature

get pupilRadius(): number

Defined in: libs/scene/src/material/eye.ts:251

Pupil radius as a fraction of the iris radius, at zero dilation.

Returns

number

Set Signature

set pupilRadius(val): void

Defined in: libs/scene/src/material/eye.ts:254

Parameters
val

number

Returns

void


pupilDilation

Get Signature

get pupilDilation(): number

Defined in: libs/scene/src/material/eye.ts:263

Pupil dilation, -1 (fully constricted) to 1 (fully dilated). Animatable.

Returns

number

Set Signature

set pupilDilation(val): void

Defined in: libs/scene/src/material/eye.ts:266

Parameters
val

number

Returns

void


irisColor

Get Signature

get irisColor(): Immutable<Vector4>

Defined in: libs/scene/src/material/eye.ts:275

Tint multiplied over the iris texture.

Returns

Immutable<Vector4>

Set Signature

set irisColor(val): void

Defined in: libs/scene/src/material/eye.ts:278

Parameters
val

Immutable<Vector4>

Returns

void


irisBrightness

Get Signature

get irisBrightness(): number

Defined in: libs/scene/src/material/eye.ts:286

Fake internal scattering that keeps the iris from going black in shadow.

Returns

number

Set Signature

set irisBrightness(val): void

Defined in: libs/scene/src/material/eye.ts:289

Parameters
val

number

Returns

void


limbalRingWidth

Get Signature

get limbalRingWidth(): number

Defined in: libs/scene/src/material/eye.ts:302

Width of the dark ring at the iris edge, as a fraction of EyeMaterial.irisRadius - relative, so resizing the iris keeps the ring in proportion.

Returns

number

Set Signature

set limbalRingWidth(val): void

Defined in: libs/scene/src/material/eye.ts:305

Parameters
val

number

Returns

void


limbalRingStrength

Get Signature

get limbalRingStrength(): number

Defined in: libs/scene/src/material/eye.ts:314

How dark the limbal ring gets. 0 disables it.

Returns

number

Set Signature

set limbalRingStrength(val): void

Defined in: libs/scene/src/material/eye.ts:317

Parameters
val

number

Returns

void


scleraColor

Get Signature

get scleraColor(): Immutable<Vector4>

Defined in: libs/scene/src/material/eye.ts:326

Base sclera colour. Pure white reads as plastic; keep it slightly warm.

Returns

Immutable<Vector4>

Set Signature

set scleraColor(val): void

Defined in: libs/scene/src/material/eye.ts:329

Parameters
val

Immutable<Vector4>

Returns

void


scleraWrap

Get Signature

get scleraWrap(): number

Defined in: libs/scene/src/material/eye.ts:337

Diffuse wrap for the sclera, standing in for its subsurface softness.

Returns

number

Set Signature

set scleraWrap(val): void

Defined in: libs/scene/src/material/eye.ts:340

Parameters
val

number

Returns

void


scleraEdgeTint

Get Signature

get scleraEdgeTint(): Immutable<Vector4>

Defined in: libs/scene/src/material/eye.ts:349

Colour bled into the sclera away from the iris, standing in for vasculature.

Returns

Immutable<Vector4>

Set Signature

set scleraEdgeTint(val): void

Defined in: libs/scene/src/material/eye.ts:352

Parameters
val

Immutable<Vector4>

Returns

void


corneaSpecularStrength

Get Signature

get corneaSpecularStrength(): number

Defined in: libs/scene/src/material/eye.ts:360

Strength of the corneal highlight - the main cue that an eye is wet.

Returns

number

Set Signature

set corneaSpecularStrength(val): void

Defined in: libs/scene/src/material/eye.ts:363

Parameters
val

number

Returns

void


corneaRoughness

Get Signature

get corneaRoughness(): number

Defined in: libs/scene/src/material/eye.ts:372

Corneal roughness. Keep it very low; the cornea is close to a mirror.

Returns

number

Set Signature

set corneaRoughness(val): void

Defined in: libs/scene/src/material/eye.ts:375

Parameters
val

number

Returns

void


socketOcclusion

Get Signature

get socketOcclusion(): boolean

Defined in: libs/scene/src/material/eye.ts:397

Enables eye-socket occlusion - the soft shadowing of the eyeball by the eyelids and socket.

Remarks

Analytic: an asymmetric aperture defined by EyeMaterial.upperLidAngle and EyeMaterial.lowerLidAngle around an axis fixed in the eyeball mesh's object space (rotatable via EyeMaterial.socketRotation). Darkens ambient diffuse, ambient specular and direct lights outside the aperture; no mask texture, extra pass or per-frame scripting. Object space means the frame follows skinning and node motion automatically, and vertical gaze drags the occlusion with the eye - approximating how real upper lids follow it.

Returns

boolean

Set Signature

set socketOcclusion(val): void

Defined in: libs/scene/src/material/eye.ts:400

Parameters
val

boolean

Returns

void


socketRotation

Get Signature

get socketRotation(): Immutable<Vector4>

Defined in: libs/scene/src/material/eye.ts:410

Euler rotation (degrees, xyz) applied to the canonical socket frame. At (0, 0, 0) the frame matches the documented asset convention: +Y towards the upper lid, +Z along the gaze. Angles rather than unit vectors because angles are the inspector-editable form.

Returns

Immutable<Vector4>

Set Signature

set socketRotation(val): void

Defined in: libs/scene/src/material/eye.ts:413

Parameters
val

Immutable<Vector4>

Returns

void


upperLidAngle

Get Signature

get upperLidAngle(): number

Defined in: libs/scene/src/material/eye.ts:422

Aperture half-angle towards the upper lid, in degrees from the socket up axis.

Returns

number

Set Signature

set upperLidAngle(val): void

Defined in: libs/scene/src/material/eye.ts:425

Parameters
val

number

Returns

void


lowerLidAngle

Get Signature

get lowerLidAngle(): number

Defined in: libs/scene/src/material/eye.ts:438

Aperture half-angle towards the lower lid, in degrees. Defaults wider than EyeMaterial.upperLidAngle; that asymmetry is what makes the occlusion read as an eye socket.

Returns

number

Set Signature

set lowerLidAngle(val): void

Defined in: libs/scene/src/material/eye.ts:441

Parameters
val

number

Returns

void


socketOcclusionSoftness

Get Signature

get socketOcclusionSoftness(): number

Defined in: libs/scene/src/material/eye.ts:450

Width of the lit-to-shadowed transition, in degrees.

Returns

number

Set Signature

set socketOcclusionSoftness(val): void

Defined in: libs/scene/src/material/eye.ts:453

Parameters
val

number

Returns

void


socketOcclusionStrength

Get Signature

get socketOcclusionStrength(): number

Defined in: libs/scene/src/material/eye.ts:462

Overall socket occlusion strength, 0 to 1.

Returns

number

Set Signature

set socketOcclusionStrength(val): void

Defined in: libs/scene/src/material/eye.ts:465

Parameters
val

number

Returns

void


contactAO

Get Signature

get contactAO(): boolean

Defined in: libs/scene/src/material/eye.ts:488

Enables screen-space contact occlusion of the eyeball by whatever sits in front of it - in practice the eyelid margin and the lashes.

Remarks

Complements EyeMaterial.socketOcclusion: the socket aperture is an analytic model of the lids, while this term reads the depth prepass and so follows the real lid mesh - blinks, asymmetry and all. Dims the ambient terms and the diffuse response of direct lights (whose shadow maps cannot resolve the millimetre lid gap); direct specular is left untouched so the corneal highlight survives.

Requires a depth prepass. Forward+ always runs one; where none is bound the term silently resolves to no occlusion.

Returns

boolean

Set Signature

set contactAO(val): void

Defined in: libs/scene/src/material/eye.ts:491

Parameters
val

boolean

Returns

void


contactAORadius

Get Signature

get contactAORadius(): number

Defined in: libs/scene/src/material/eye.ts:500

Radius of the contact occlusion disc, in world units - how far from the lid the darkening reaches. Rescale for assets not authored at one unit per metre; roughly half the eyeball radius is a good starting point.

Returns

number

Set Signature

set contactAORadius(val): void

Defined in: libs/scene/src/material/eye.ts:503

Parameters
val

number

Returns

void


contactAOMinDistance

Get Signature

get contactAOMinDistance(): number

Defined in: libs/scene/src/material/eye.ts:517

Smallest depth step that counts as an occluder, in world units. Raise it until the eyeball stops shading itself. Compared against the eyeball's own tangent plane rather than raw depth, so only residual curvature - not view-dependent slope - has to clear it.

Returns

number

Set Signature

set contactAOMinDistance(val): void

Defined in: libs/scene/src/material/eye.ts:520

Parameters
val

number

Returns

void


contactAOMaxDistance

Get Signature

get contactAOMaxDistance(): number

Defined in: libs/scene/src/material/eye.ts:535

Largest depth step that counts as an occluder, in world units. Anything further in front is unrelated geometry overlapping the eye on screen and must not paint a shadow onto it - keep it at the order of the lid gap. Forced to at least 4x EyeMaterial.contactAOMinDistance on upload so the two smoothstep ramps cannot cross.

Returns

number

Set Signature

set contactAOMaxDistance(val): void

Defined in: libs/scene/src/material/eye.ts:538

Parameters
val

number

Returns

void


contactAOStrength

Get Signature

get contactAOStrength(): number

Defined in: libs/scene/src/material/eye.ts:550

Overall contact occlusion strength, 0 to 1. Calibrated so that 1 drives the ambient terms to zero right at the contact line.

Returns

number

Set Signature

set contactAOStrength(val): void

Defined in: libs/scene/src/material/eye.ts:553

Parameters
val

number

Returns

void


contactAOTemporalJitter

Get Signature

get contactAOTemporalJitter(): boolean

Defined in: libs/scene/src/material/eye.ts:567

Advances the contact-occlusion noise pattern every frame so TAA can integrate the grain away. Opt-in: without a temporal accumulator the advancing pattern reads as flicker, worse than the static grain it replaces. Enable it if and only if the pipeline resolves temporally.

Returns

boolean

Set Signature

set contactAOTemporalJitter(val): void

Defined in: libs/scene/src/material/eye.ts:570

Parameters
val

boolean

Returns

void


changeTag

Get Signature

get changeTag(): number

Defined in: libs/scene/src/material/material.ts:173

Incremented when the material’s GPU-relevant state changes and render bundles may need to be rebuilt.

Returns

number

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).changeTag


instanceId

Get Signature

get instanceId(): number

Defined in: libs/scene/src/material/material.ts:179

Runtime-unique numeric identifier for the material instance.

Returns

number

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).instanceId


numPasses

Get Signature

get numPasses(): number

Defined in: libs/scene/src/material/material.ts:189

Number of rendering passes this material uses.

Increasing this will expand the per-pass hash cache; make sure to implement createHash(pass), _createProgram(pb, ctx, pass), and updateRenderStates(pass, ...) accordingly for each pass.

Returns

number

Set Signature

set numPasses(val): void

Defined in: libs/scene/src/material/material.ts:192

Parameters
val

number

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).numPasses


coreMaterial

Get Signature

get coreMaterial(): this

Defined in: libs/scene/src/material/material.ts:283

Returns the core material that owns GPU state.

Instances may delegate to a shared core to reuse compiled programs and caches.

Returns

this

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).coreMaterial


drawContext

Get Signature

get drawContext(): DrawContext

Defined in: libs/scene/src/material/meshmaterial.ts:514

Draw context captured during program creation, available inside shader hooks.

Returns

DrawContext

The last DrawContext used to build or apply this material.

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).drawContext


pass

Get Signature

get pass(): number

Defined in: libs/scene/src/material/meshmaterial.ts:523

Current material pass index during program building. Typically used inside shader hooks to select per-pass logic.

Returns

number

The active pass index while building the program, or -1 when idle.

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).pass


alphaCutoff

Get Signature

get alphaCutoff(): number

Defined in: libs/scene/src/material/meshmaterial.ts:532

Alpha test cutoff in [0, 1].

  • 0 disables alpha testing.
  • > 0 discards fragments with alpha < cutoff. Changing this marks uniforms dirty (no shader rebuild).
Returns

number

Set Signature

set alphaCutoff(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:535

Parameters
val

number

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).alphaCutoff


alphaDither

Get Signature

get alphaDither(): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:547

Whether alpha clipping uses frame-varying dither coverage.

  • Effective only when alpha cutoff is enabled.
  • Intended for masked materials (blendMode='none') to emulate soft transparency with TAA.
Returns

boolean

Set Signature

set alphaDither(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:550

Parameters
val

boolean

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).alphaDither


TAADisabled

Get Signature

get TAADisabled(): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:561

Whether TAA is disabled for this material.

  • When true, motion vectors encode a large sentinel to skip TAA accumulation.
  • Managed via an internal feature toggle.
Returns

boolean

Set Signature

set TAADisabled(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:564

Parameters
val

boolean

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).TAADisabled


transparentMotionVector

Get Signature

get transparentMotionVector(): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:581

Whether a blended material contributes motion vectors.

Remarks

Off by default, and only meaningful with blendMode !== 'none': blended geometry is normally absent from the prepass, so it writes no velocity and a temporal filter reprojects it with whatever is behind it. Turning this on adds it to a motion-vector-only pass over the transparent queue.

Right for geometry that is dense enough to own its pixels - hair, foliage cards - where one velocity per pixel is a fair summary. Wrong for genuinely see-through surfaces such as glass, where the background's own velocity is the one that should survive, which is why this is opt-in.

Returns

boolean

Set Signature

set transparentMotionVector(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:584

Parameters
val

boolean

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).transparentMotionVector


TAAStrength

Get Signature

get TAAStrength(): number

Defined in: libs/scene/src/material/meshmaterial.ts:592

TAA strength in [0, 1].

  • Higher values generally imply stronger accumulation.
  • The value is mapped when writing motion-vector outputs during depth pass.
Returns

number

Set Signature

set TAAStrength(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:595

Parameters
val

number

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).TAAStrength


alphaToCoverage

Get Signature

get alphaToCoverage(): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:607

Alpha-to-coverage toggle.

  • Useful to approximate transparency for MSAA targets.
  • Managed as a shader feature; toggling rebuilds variants.
Returns

boolean

Set Signature

set alphaToCoverage(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:610

Parameters
val

boolean

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).alphaToCoverage


blendMode

Get Signature

get blendMode(): BlendMode

Defined in: libs/scene/src/material/meshmaterial.ts:618

Blending mode of this material.

  • 'none' for opaque, 'blend' for standard alpha, 'additive' for emissive FX.
  • Changing the mode toggles an internal feature and rebuilds variants.
Returns

BlendMode

Set Signature

set blendMode(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:621

Parameters
val

BlendMode

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).blendMode


transparentShadowCaster

Get Signature

get transparentShadowCaster(): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:632

Whether transparent visible materials cast shadow through a masked shadow-only path.

  • Visible rendering stays blended.
  • Shadow-map rendering is treated like a cutout material using shadowAlphaCutoff.
Returns

boolean

Set Signature

set transparentShadowCaster(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:635

Parameters
val

boolean

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).transparentShadowCaster


shadowAlphaCutoff

Get Signature

get shadowAlphaCutoff(): number

Defined in: libs/scene/src/material/meshmaterial.ts:644

Alpha cutoff used by the shadow-only masked caster path.

Returns

number

Set Signature

set shadowAlphaCutoff(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:647

Parameters
val

number

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).shadowAlphaCutoff


cullMode

Get Signature

get cullMode(): FaceMode

Defined in: libs/scene/src/material/meshmaterial.ts:658

Face culling mode: 'none' | 'front' | 'back'.

  • Does not force shader rebuild; affects rasterizer state.
Returns

FaceMode

Set Signature

set cullMode(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:661

Parameters
val

FaceMode

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).cullMode


opacity

Get Signature

get opacity(): number

Defined in: libs/scene/src/material/meshmaterial.ts:671

Material opacity in [0, 1].

  • Used in transparent passes. Changing marks uniforms dirty only.
Returns

number

Set Signature

set opacity(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:674

Parameters
val

number

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).opacity


objectColor

Get Signature

get objectColor(): Immutable<Vector4>

Defined in: libs/scene/src/material/meshmaterial.ts:685

Per-object color used for GPU picking/object-ID pass.

  • Changing marks uniforms dirty only.
Returns

Immutable<Vector4>

Set Signature

set objectColor(val): void

Defined in: libs/scene/src/material/meshmaterial.ts:688

Parameters
val

Immutable<Vector4>

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).objectColor

Methods

on()

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

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

IEventTarget.on

Type Parameters

K

K extends "dispose"

Parameters

type

K

listener

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

context?

unknown

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).on


once()

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

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

IEventTarget.once

Type Parameters

K

K extends "dispose"

Parameters

type

K

listener

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

context?

unknown

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).once


off()

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

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

IEventTarget.off

Type Parameters

K

K extends "dispose"

Parameters

type

K

listener?

EventListener<{ dispose: []; }>

context?

unknown

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).off


dispatchEvent()

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

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

IEventTarget.dispatchEvent

Type Parameters

K

K extends "dispose"

Parameters

type

K

args

...object[K]

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).dispatchEvent


dispose()

dispose(): void

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

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).dispose


clone()

clone(): EyeMaterial

Defined in: libs/scene/src/material/eye.ts:142

Create a shallow clone of this material. Subclasses should override to copy custom fields.

Returns

EyeMaterial

Implementation of

Clonable.clone

Overrides

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).clone


copyFrom()

copyFrom(other): void

Defined in: libs/scene/src/material/eye.ts:148

Copy common MeshMaterial properties from another material. Call super.copyFrom(other) first when overriding in subclasses.

Parameters

other

this

Source material.

Returns

void

Overrides

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).copyFrom


vertexShader()

vertexShader(scope): void

Defined in: libs/scene/src/material/eye.ts:593

Vertex shader hook. Prepares common inputs (skin/morph/instancing), varyings, and pass-dependent outputs. Override to implement per-vertex logic; use ShaderHelper as needed.

Parameters

scope

PBFunctionScope

Vertex shader function scope.

Returns

void

void

Overrides

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).vertexShader


fragmentShader()

fragmentShader(scope): void

Defined in: libs/scene/src/material/eye.ts:884

Fragment shader hook. Declares pass-dependent uniforms (e.g., opacity, objectColor, alphaCutoff). Override to implement per-fragment logic, and call outputFragmentColor to finalize writes.

Parameters

scope

PBFunctionScope

Fragment shader function scope.

Returns

void

void

Overrides

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).fragmentShader


applyUniformValues()

applyUniformValues(bindGroup, ctx, pass): void

Defined in: libs/scene/src/material/eye.ts:1127

Submit material uniforms/resources to the material bind group (set 2). Handles alpha cutoff, opacity (non-instanced transparent), OIT, object color, and TAA strength.

Parameters

bindGroup

BindGroup

The material bind group to write into.

ctx

DrawContext

Current draw context.

pass

number

Current material pass index.

Returns

void

void

Overrides

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).applyUniformValues


getNumPassesForRender()

protected getNumPassesForRender(_ctx): number

Defined in: libs/scene/src/material/material.ts:205

Get the number of passes this material will render for the given draw context.

Default returns numPasses. Subclasses may override to skip passes based on context flags.

Parameters

_ctx

DrawContext

Draw context (device, flags, pass hash, instance data, etc.).

Returns

number

Number of passes to render for this context.

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).getNumPassesForRender


supportInstancing()

supportInstancing(): boolean

Defined in: libs/scene/src/material/material.ts:249

Whether this material supports hardware instancing.

Override and return false if per-instance data is not supported in the shader.

Returns

boolean

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).supportInstancing


isBatchable()

isBatchable(): boolean

Defined in: libs/scene/src/material/material.ts:253

Returns true if this is a instance of material

Returns

boolean

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).isBatchable


needSceneColor()

needSceneColor(): boolean

Defined in: libs/scene/src/material/material.ts:260

Whether this material requires the scene color texture (e.g., for refraction).

Returns

boolean

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).needSceneColor


needSceneDepth()

needSceneDepth(): boolean

Defined in: libs/scene/src/material/material.ts:266

Whether this material requires the linear scene depth texture (e.g., for depth-aware effects).

Returns

boolean

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).needSceneDepth


applyUniforms()

applyUniforms(bindGroup, ctx, needUpdate, pass): void

Defined in: libs/scene/src/material/material.ts:450

Conditionally update uniforms/resources into the material bind group.

Delegates to _applyUniforms() when needUpdate is true (based on _optionTag check).

Parameters

bindGroup

BindGroup

Material bind group at index 2 (may be null if program has no layout).

ctx

DrawContext

Draw context.

needUpdate

boolean

Whether uniforms need to be refreshed.

pass

number

Pass index.

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).applyUniforms


clearCache()

clearCache(): void

Defined in: libs/scene/src/material/material.ts:475

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).clearCache


passToHash()

passToHash(pass): string

Defined in: libs/scene/src/material/material.ts:503

Convert a pass index to a hash seed string.

Subclasses may override to encode per-pass role (e.g., "depth", "forward", "shadow").

Parameters

pass

number

Pass number.

Returns

string

String used when building full hash.

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).passToHash


drawPrimitive()

drawPrimitive(pass, primitive, ctx, numInstances): void

Defined in: libs/scene/src/material/material.ts:531

Issue the actual draw call for a pass.

Override for custom per-pass draw behavior if necessary. The default implementation:

  • Draws instanced if numInstances > 0.
  • Else uses ctx.instanceData.numInstances if available.
  • Else issues a non-instanced draw.

Parameters

pass

number

Pass number.

primitive

Primitive

Primitive to draw.

ctx

DrawContext

Draw context.

numInstances

number

Explicit instance count (0 = auto).

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).drawPrimitive


onDispose()

protected onDispose(): void

Defined in: libs/scene/src/material/material.ts:546

Dispose the material and release GPU-side resource references.

  • Unregisters from the global registry.
  • Disposes the per-material bind groups kept in _states.

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).onDispose


apply()

apply(ctx): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:243

Capture the active draw context for both cached and freshly-built program paths.

The shader-building hooks access this.drawContext, but uniform application may also consult it on subsequent frames when the GPU program is reused from cache. Updating it here keeps material mixins in sync even when createProgram() is skipped.

Parameters

ctx

DrawContext

Current draw context.

Returns

boolean

Whether material preparation succeeded.

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).apply


uniformChanged()

uniformChanged(): void

Defined in: libs/scene/src/material/meshmaterial.ts:252

Mark uniform-only changes so uniforms are re-uploaded on next apply, without rebuilding shader programs.

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).uniformChanged


defineFeature()

static defineFeature(): number

Defined in: libs/scene/src/material/meshmaterial.ts:259

Define a new feature bit/index for shader variants. Subclasses may use this to add their own switches.

Returns

number

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).defineFeature


defineInstanceUniform()

static defineInstanceUniform(prop, type, name?): number

Defined in: libs/scene/src/material/meshmaterial.ts:292

Define a per-instance uniform for this class.

Returns a compact index encoding the vector index and component offset, which can be used in shader code via getInstancedUniform(...).

Parameters

prop

string

Property name exposed on instances.

type

InstanceUniformType

Uniform data type.

name?

string = ''

Returns

number

Encoded index for use in getInstancedUniform.

Throws

If the property is already defined or type is invalid.

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).defineInstanceUniform


getInstancedUniform()

getInstancedUniform(scope, uniformIndex): PBShaderExp

Defined in: libs/scene/src/material/meshmaterial.ts:333

Read an encoded per-instance uniform in shader code.

Encoded index packs: vector index, component offset, and component count.

Parameters

scope

PBInsideFunctionScope

Inside-function shader scope.

uniformIndex

number

Encoded index from defineInstanceUniform.

Returns

PBShaderExp

The shader expression reading the selected components.

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).getInstancedUniform


getInstancedUniforms()

getInstancedUniforms(): object[]

Defined in: libs/scene/src/material/meshmaterial.ts:355

Get the list of per-instance uniforms for this material class.

Returns

object[]

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).getInstancedUniforms


createInstance()

createInstance(): this

Defined in: libs/scene/src/material/meshmaterial.ts:370

Create a material instance (preferred for GPU instancing).

  • On WebGL1 (or when instancing unsupported), falls back to cloning.
  • Otherwise, returns a proxy instance that shares GPU programs and stores per-instance uniforms in a compact Float32Array.

The returned instance:

  • Exposes properties defined by defineInstanceUniform with getter/setter that read/write the packed buffer and notify RenderBundleWrapper.
  • Delegates methods to the core material via prototype chain.

Returns

this

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).createInstance


supportLighting()

supportLighting(): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:700

Whether this material responds to scene lighting. Override to return false for unlit materials.

Returns

boolean

True if lighting affects this material; otherwise false.

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).supportLighting


getEffectiveBlendMode()

protected getEffectiveBlendMode(pass, ctx?): BlendMode

Defined in: libs/scene/src/material/meshmaterial.ts:707

Returns the effective blend mode for the current pass. Transparent-shadow-caster materials stay blended in visible passes, but become masked in shadow passes.

Parameters

pass

number

ctx?

DrawContext

Returns

BlendMode

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).getEffectiveBlendMode


getActiveAlphaCutoff()

protected getActiveAlphaCutoff(ctx?, pass?): number

Defined in: libs/scene/src/material/meshmaterial.ts:736

Returns the alpha cutoff that should be used for the current pass.

Parameters

ctx?

DrawContext

pass?

number = ...

Returns

number

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).getActiveAlphaCutoff


useTransparentShadowCaster()

useTransparentShadowCaster(ctx?, _pass?): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:742

Whether the current pass should use the shadow-only masked caster path.

Parameters

ctx?

DrawContext

_pass?

number = ...

Returns

boolean

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).useTransparentShadowCaster


useTransparentShadowCasterForPass()

useTransparentShadowCasterForPass(renderPassType?): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:748

Whether the specified render pass type should reinterpret this transparent material as a masked shadow caster.

Parameters

renderPassType?

number

Returns

boolean

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).useTransparentShadowCasterForPass


usesAlphaCutoff()

protected usesAlphaCutoff(ctx, pass): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:758

Whether this pass needs an alpha-cutoff uniform bound.

Parameters

ctx

DrawContext

pass

number

Returns

boolean

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).usesAlphaCutoff


needFragmentColorInput()

needFragmentColorInput(ctx?): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:766

Whether this pass needs fragment color inputs. This stays aligned with the historical meaning of needFragmentColor, but also allows shadow-only transparent casters to fetch alpha sources.

Parameters

ctx?

DrawContext

Returns

boolean

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).needFragmentColorInput


updateRenderStates()

protected updateRenderStates(pass, stateSet, ctx): void

Defined in: libs/scene/src/material/meshmaterial.ts:779

Update render states per pass and draw context. Sets blending, alpha-to-coverage, depth test/write, cull mode, color mask, and cooperates with OIT.

Parameters

pass

number

Current material pass index.

stateSet

RenderStateSet

Render state set to update.

ctx

DrawContext

Current draw context.

Returns

void

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).updateRenderStates


getQueueType()

getQueueType(): number

Defined in: libs/scene/src/material/meshmaterial.ts:893

Determine the render queue for this material. Transparent materials are queued as QUEUE_TRANSPARENT, otherwise QUEUE_OPAQUE.

Returns

number

The queue type constant.

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).getQueueType


isTransparentPass()

isTransparentPass(pass, ctx?): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:903

Whether the given pass is transparent. Default returns true when blendMode !== 'none'.

Parameters

pass

number

Material pass index.

ctx?

DrawContext

Returns

boolean

True if the pass is transparent; otherwise false.

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).isTransparentPass


featureUsed()

featureUsed<T>(feature): T

Defined in: libs/scene/src/material/meshmaterial.ts:930

Query a feature flag’s current value.

Type Parameters

T

T = unknown

Expected value type.

Parameters

feature

number

The feature index.

Returns

T

The current value for the feature, typed as T.

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).featureUsed


useFeature()

useFeature(feature, use): void

Defined in: libs/scene/src/material/meshmaterial.ts:941

Enable or disable a feature and trigger variant rebuild when changed. Calls optionChanged(true) internally on change.

Parameters

feature

number

The feature index to set.

use

unknown

The new feature value (typed by convention).

Returns

void

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).useFeature


isMaterialTextureEnabled()

protected isMaterialTextureEnabled(_name): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:972

Parameters

_name

string

Returns

boolean

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).isMaterialTextureEnabled


needFragmentColor()

needFragmentColor(ctx?): boolean

Defined in: libs/scene/src/material/meshmaterial.ts:983

Whether the fragment shader needs to compute color. Returns true for LIGHT pass, or when alpha test or alpha-to-coverage is enabled. Override if the material writes color in other passes.

Parameters

ctx?

DrawContext

Optional draw context; defaults to the last captured drawContext.

Returns

boolean

True if fragment color computation is needed; otherwise false.

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).needFragmentColor


outputFragmentColor()

outputFragmentColor(scope, worldPos, color, ssrRoughness?, ssrNormal?, sssProfile?, sssParams?, sssDiffuse?, sssTransmission?, sssProfileEnabled?, skinSSS?): void

Defined in: libs/scene/src/material/meshmaterial.ts:1139

Centralized final color write and per-pass output composition.

Behavior by pass:

  • LIGHT: clipping, alpha handling, optional OIT integration, fog application, color output encoding.
  • DEPTH: encoded depth; optional motion vectors (TAA enabled/disabled handling).
  • OBJECT_COLOR: object color and distance output (linear depth or world-pos + distance).
  • SHADOWMAP: writes shadow depth via light’s shadow implementation.

Also writes SSR roughness/normal buffers when requested via material flags.

Parameters

scope

PBInsideFunctionScope

Inside-function shader scope.

worldPos

PBShaderExp

Fragment world-space position expression.

color

PBShaderExp

Lit fragment color expression; may be undefined for depth-only paths.

ssrRoughness?

PBShaderExp

Optional SSR roughness output expression.

ssrNormal?

PBShaderExp

Optional SSR normal output expression.

sssProfile?

PBShaderExp

Optional SSS profile output expression.

sssParams?

PBShaderExp

Optional SSS packed params output expression.

sssDiffuse?

PBShaderExp

Optional diffuse-only lighting color for SSS composition.

sssTransmission?

PBShaderExp

Optional thin-shell transmission lighting color for SSS composition.

sssProfileEnabled?

boolean = false

True only when this material should write SSS profile data.

skinSSS?

PBShaderExp

Returns

void

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).outputFragmentColor


calculateAlbedoColor()

calculateAlbedoColor(scope, uv?): PBShaderExp

Defined in: libs/scene/src/material/mixins/albedocolor.ts:17

Parameters

scope

PBInsideFunctionScope

uv?

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).calculateAlbedoColor


receivesWaterCaustics()

receivesWaterCaustics(): boolean

Defined in: libs/scene/src/material/mixins/lit.ts:27

Returns

boolean

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).receivesWaterCaustics


needCalculateEnvLight()

needCalculateEnvLight(): boolean

Defined in: libs/scene/src/material/mixins/lit.ts:28

Returns

boolean

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).needCalculateEnvLight


getUniformNormalScale()

getUniformNormalScale(scope): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:29

Parameters

scope

PBInsideFunctionScope

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).getUniformNormalScale


getEnvLightIrradiance()

getEnvLightIrradiance(scope, normal): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:30

Parameters

scope

PBInsideFunctionScope

normal

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).getEnvLightIrradiance


getEnvLightRadiance()

getEnvLightRadiance(scope, reflectVec, roughness): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:31

Parameters

scope

PBInsideFunctionScope

reflectVec

PBShaderExp

roughness

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).getEnvLightRadiance


calculateViewVector()

calculateViewVector(scope, worldPos): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:36

Parameters

scope

PBInsideFunctionScope

worldPos

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).calculateViewVector


calculateReflectionVector()

calculateReflectionVector(scope, normal, viewVec): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:37

Parameters

scope

PBInsideFunctionScope

normal

PBShaderExp

viewVec

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).calculateReflectionVector


calculateTBN()

calculateTBN(scope, worldPos, worldNormal?, worldTangent?, worldBinormal?): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:42

Parameters

scope

PBInsideFunctionScope

worldPos

PBShaderExp

worldNormal?

PBShaderExp

worldTangent?

PBShaderExp

worldBinormal?

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).calculateTBN


calculateNormal()

calculateNormal(scope, worldPos, worldNormal?, worldTangent?, worldBinormal?): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:49

Parameters

scope

PBInsideFunctionScope

worldPos

PBShaderExp

worldNormal?

PBShaderExp

worldTangent?

PBShaderExp

worldBinormal?

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).calculateNormal


calculateNormalAndTBN()

calculateNormalAndTBN(scope, worldPos, worldNormal?, worldTangent?, worldBinormal?): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:56

Parameters

scope

PBInsideFunctionScope

worldPos

PBShaderExp

worldNormal?

PBShaderExp

worldTangent?

PBShaderExp

worldBinormal?

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).calculateNormalAndTBN


calculateLightAttenuation()

calculateLightAttenuation(scope, type, worldPos, posRange, dirCutoff, extra?): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:63

Parameters

scope

PBInsideFunctionScope

type

PBShaderExp

worldPos

PBShaderExp

posRange

PBShaderExp

dirCutoff

PBShaderExp

extra?

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).calculateLightAttenuation


calculateLightDirection()

calculateLightDirection(scope, type, worldPos, posRange, dirCutoff): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:71

Parameters

scope

PBInsideFunctionScope

type

PBShaderExp

worldPos

PBShaderExp

posRange

PBShaderExp

dirCutoff

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).calculateLightDirection


calculateShadow()

calculateShadow(scope, worldPos, worldNormal, NoL): PBShaderExp

Defined in: libs/scene/src/material/mixins/lit.ts:78

Parameters

scope

PBInsideFunctionScope

worldPos

PBShaderExp

worldNormal

PBShaderExp

NoL

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).calculateShadow


forEachLight()

forEachLight(scope, callback): void

Defined in: libs/scene/src/material/mixins/lit.ts:84

Parameters

scope

PBInsideFunctionScope

callback

(this, type, posRange, dirCutoff, colorIntensity, extra, shadow) => void

Returns

void

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).forEachLight


fresnelSchlick()

fresnelSchlick(scope, cosTheta, F0, F90): PBShaderExp

Defined in: libs/scene/src/material/mixins/pbr/brdf.ts:14

Parameters

scope

PBInsideFunctionScope

cosTheta

PBShaderExp

F0

PBShaderExp

F90

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).fresnelSchlick


distributionGGX()

distributionGGX(scope, NdotH, alphaRoughness): PBShaderExp

Defined in: libs/scene/src/material/mixins/pbr/brdf.ts:20

Parameters

scope

PBInsideFunctionScope

NdotH

PBShaderExp

alphaRoughness

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).distributionGGX


visGGX()

visGGX(scope, NdotV, NdotL, alphaRoughness): PBShaderExp

Defined in: libs/scene/src/material/mixins/pbr/brdf.ts:21

Parameters

scope

PBInsideFunctionScope

NdotV

PBShaderExp

NdotL

PBShaderExp

alphaRoughness

PBShaderExp

Returns

PBShaderExp

Inherited from

applyMaterialMixins( MeshMaterial, mixinLight, mixinPBRBRDF, mixinTextureProps('iris'), mixinTextureProps('sclera') ).visGGX

Released under the MIT License.