Skip to main content

Class: OccluderMaterial

@geenee/bodyrenderers-babylon.OccluderMaterial

Occluder material

Occluders are elements of a scene that are not rendered by themselves but still participate in occlusion queries. Usually, occluder is a base mesh (average approximation) of a body representing its real counterpart in a scene. Occluders are used to mask visible virtual objects behind them (like geometries of a 3D scene behind user's body). Applying OccluderMaterial to a mesh makes it an occluder.

Hierarchy

  • ShaderMaterial

    OccluderMaterial

Constructors

constructor

new OccluderMaterial(name, scene)

Constructor

Parameters

NameTypeDescription
namestringName of the material in the scene
sceneSceneScene the material belongs to

Overrides

ShaderMaterial.constructor

Properties

_activeEffect

Protected Optional _activeEffect: Effect

Inherited from

ShaderMaterial._activeEffect


_alpha

Protected _alpha: number

The alpha value of the material

Inherited from

ShaderMaterial._alpha


_backFaceCulling

Protected _backFaceCulling: boolean

Specifies if back face culling is enabled

Inherited from

ShaderMaterial._backFaceCulling


_callbackPluginEventBindForSubMesh

_callbackPluginEventBindForSubMesh: (eventData: MaterialPluginBindForSubMesh) => void

Type declaration

▸ (eventData): void

Parameters
NameType
eventDataMaterialPluginBindForSubMesh
Returns

void

Inherited from

ShaderMaterial._callbackPluginEventBindForSubMesh


_callbackPluginEventFillRenderTargetTextures

_callbackPluginEventFillRenderTargetTextures: (eventData: MaterialPluginFillRenderTargetTextures) => void

Type declaration

▸ (eventData): void

Parameters
NameType
eventDataMaterialPluginFillRenderTargetTextures
Returns

void

Inherited from

ShaderMaterial._callbackPluginEventFillRenderTargetTextures


_callbackPluginEventGeneric

_callbackPluginEventGeneric: (id: number, info: MaterialPluginDisposed | MaterialPluginHasTexture | MaterialPluginGetDefineNames | MaterialPluginPrepareEffect | MaterialPluginPrepareUniformBuffer | MaterialPluginGetAnimatables | MaterialPluginGetActiveTextures) => void

Type declaration

▸ (id, info): void

Parameters
NameType
idnumber
infoMaterialPluginDisposed | MaterialPluginHasTexture | MaterialPluginGetDefineNames | MaterialPluginPrepareEffect | MaterialPluginPrepareUniformBuffer | MaterialPluginGetAnimatables | MaterialPluginGetActiveTextures
Returns

void

Inherited from

ShaderMaterial._callbackPluginEventGeneric


_callbackPluginEventHardBindForSubMesh

_callbackPluginEventHardBindForSubMesh: (eventData: MaterialPluginHardBindForSubMesh) => void

Type declaration

▸ (eventData): void

Parameters
NameType
eventDataMaterialPluginHardBindForSubMesh
Returns

void

Inherited from

ShaderMaterial._callbackPluginEventHardBindForSubMesh


_callbackPluginEventHasRenderTargetTextures

_callbackPluginEventHasRenderTargetTextures: (eventData: MaterialPluginHasRenderTargetTextures) => void

Type declaration

▸ (eventData): void

Parameters
NameType
eventDataMaterialPluginHasRenderTargetTextures
Returns

void

Inherited from

ShaderMaterial._callbackPluginEventHasRenderTargetTextures


_callbackPluginEventIsReadyForSubMesh

_callbackPluginEventIsReadyForSubMesh: (eventData: MaterialPluginIsReadyForSubMesh) => void

Type declaration

▸ (eventData): void

Parameters
NameType
eventDataMaterialPluginIsReadyForSubMesh
Returns

void

Inherited from

ShaderMaterial._callbackPluginEventIsReadyForSubMesh


_callbackPluginEventPrepareDefines

_callbackPluginEventPrepareDefines: (eventData: MaterialPluginPrepareDefines) => void

Type declaration

▸ (eventData): void

Parameters
NameType
eventDataMaterialPluginPrepareDefines
Returns

void

Inherited from

ShaderMaterial._callbackPluginEventPrepareDefines


_callbackPluginEventPrepareDefinesBeforeAttributes

_callbackPluginEventPrepareDefinesBeforeAttributes: (eventData: MaterialPluginPrepareDefines) => void

Type declaration

▸ (eventData): void

Parameters
NameType
eventDataMaterialPluginPrepareDefines
Returns

void

Inherited from

ShaderMaterial._callbackPluginEventPrepareDefinesBeforeAttributes


_cullBackFaces

Protected _cullBackFaces: boolean

Specifies if back or front faces should be culled (when culling is enabled)

Inherited from

ShaderMaterial._cullBackFaces


_dirtyCallbacks

_dirtyCallbacks: Object

Index signature

▪ [code: number]: () => void

Inherited from

ShaderMaterial._dirtyCallbacks


_drawWrapper

Protected _drawWrapper: DrawWrapper

Inherited from

ShaderMaterial._drawWrapper


_eventInfo

Protected _eventInfo: MaterialPluginDisposed & MaterialPluginHasTexture & MaterialPluginIsReadyForSubMesh & MaterialPluginGetDefineNames & MaterialPluginPrepareEffect & MaterialPluginPrepareDefines & MaterialPluginPrepareUniformBuffer & MaterialPluginBindForSubMesh & MaterialPluginGetAnimatables & MaterialPluginGetActiveTextures & MaterialPluginFillRenderTargetTextures & MaterialPluginHasRenderTargetTextures & MaterialPluginHardBindForSubMesh

Inherited from

ShaderMaterial._eventInfo


_forceAlphaTest

Protected _forceAlphaTest: boolean

Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.

Inherited from

ShaderMaterial._forceAlphaTest


_indexInSceneMaterialArray

_indexInSceneMaterialArray: number

Inherited from

ShaderMaterial._indexInSceneMaterialArray


_internalMetadata

_internalMetadata: any

Inherited from

ShaderMaterial._internalMetadata


_loadedUniqueId

_loadedUniqueId: string

Inherited from

ShaderMaterial._loadedUniqueId


_materialContext

_materialContext: undefined | IMaterialContext

Stores the effects for the material

Inherited from

ShaderMaterial._materialContext


_materialHelperNeedsPreviousMatrices

_materialHelperNeedsPreviousMatrices: boolean

Inherited from

ShaderMaterial._materialHelperNeedsPreviousMatrices


_needToBindSceneUbo

Protected _needToBindSceneUbo: boolean

Inherited from

ShaderMaterial._needToBindSceneUbo


_normalMatrix

Protected _normalMatrix: Matrix

Inherited from

ShaderMaterial._normalMatrix


_onEffectCreatedObservable

Protected _onEffectCreatedObservable: Nullable<Observable<{ effect: Effect ; subMesh: Nullable<SubMesh> }>>

Inherited from

ShaderMaterial._onEffectCreatedObservable


_parentContainer

_parentContainer: Nullable<AbstractScene>

Inherited from

ShaderMaterial._parentContainer


_storeEffectOnSubMeshes

_storeEffectOnSubMeshes: boolean

Inherited from

ShaderMaterial._storeEffectOnSubMeshes


_transparencyMode

Protected _transparencyMode: Nullable<number>

The transparency mode of the material.

Inherited from

ShaderMaterial._transparencyMode


_uniformBuffer

_uniformBuffer: UniformBuffer

Stores the uniform buffer

Inherited from

ShaderMaterial._uniformBuffer


_uniformBufferLayoutBuilt

_uniformBufferLayoutBuilt: boolean

Inherited from

ShaderMaterial._uniformBufferLayoutBuilt


_useLogarithmicDepth

Protected _useLogarithmicDepth: boolean

Inherited from

ShaderMaterial._useLogarithmicDepth


allowShaderHotSwapping

allowShaderHotSwapping: boolean

Gets or sets a boolean indicating that the material is allowed (if supported) to do shader hot swapping. This means that the material can keep using a previous shader while a new one is being compiled. This is mostly used when shader parallel compilation is supported (true by default)

Inherited from

ShaderMaterial.allowShaderHotSwapping


animations

animations: Nullable<Animation[]>

Stores the animations for the material

Inherited from

ShaderMaterial.animations


checkReadyOnEveryCall

checkReadyOnEveryCall: boolean

Specifies if the ready state should be checked on each call

Inherited from

ShaderMaterial.checkReadyOnEveryCall


checkReadyOnlyOnce

checkReadyOnlyOnce: boolean

Specifies if the ready state should be checked once

Inherited from

ShaderMaterial.checkReadyOnlyOnce


clipPlane

clipPlane: Nullable<Plane>

Gets or sets the active clipplane 1

Inherited from

ShaderMaterial.clipPlane


clipPlane2

clipPlane2: Nullable<Plane>

Gets or sets the active clipplane 2

Inherited from

ShaderMaterial.clipPlane2


clipPlane3

clipPlane3: Nullable<Plane>

Gets or sets the active clipplane 3

Inherited from

ShaderMaterial.clipPlane3


clipPlane4

clipPlane4: Nullable<Plane>

Gets or sets the active clipplane 4

Inherited from

ShaderMaterial.clipPlane4


clipPlane5

clipPlane5: Nullable<Plane>

Gets or sets the active clipplane 5

Inherited from

ShaderMaterial.clipPlane5


clipPlane6

clipPlane6: Nullable<Plane>

Gets or sets the active clipplane 6

Inherited from

ShaderMaterial.clipPlane6


customShaderNameResolve

customShaderNameResolve: (shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: string[] | MaterialDefines, attributes?: string[], options?: ICustomShaderNameResolveOptions) => string

Type declaration

▸ (shaderName, uniforms, uniformBuffers, samplers, defines, attributes?, options?): string

Custom callback helping to override the default shader used in the material.

Parameters
NameType
shaderNamestring
uniformsstring[]
uniformBuffersstring[]
samplersstring[]
definesstring[] | MaterialDefines
attributes?string[]
options?ICustomShaderNameResolveOptions
Returns

string

Inherited from

ShaderMaterial.customShaderNameResolve


depthFunction

depthFunction: number

Specifies the depth function that should be used. 0 means the default engine function

Inherited from

ShaderMaterial.depthFunction


disableColorWrite

disableColorWrite: boolean

Specifies if color writing should be disabled

Inherited from

ShaderMaterial.disableColorWrite


disableDepthWrite

disableDepthWrite: boolean

Specifies if depth writing should be disabled

Inherited from

ShaderMaterial.disableDepthWrite


doNotSerialize

doNotSerialize: boolean

Specifies if the material should be serialized

Inherited from

ShaderMaterial.doNotSerialize


forceDepthWrite

forceDepthWrite: boolean

Specifies if depth writing should be forced

Inherited from

ShaderMaterial.forceDepthWrite


getRenderTargetTextures

getRenderTargetTextures: Nullable<() => SmartArray<RenderTargetTexture>>

Callback triggered to get the render target textures

Inherited from

ShaderMaterial.getRenderTargetTextures


id

id: string

The ID of the material

Inherited from

ShaderMaterial.id


inspectableCustomProperties

inspectableCustomProperties: IInspectable[]

List of inspectable custom properties (used by the Inspector)

See

https://doc.babylonjs.com/toolsAndResources/inspector#extensibility

Inherited from

ShaderMaterial.inspectableCustomProperties


meshMap

meshMap: Nullable<{ [id: string]: AbstractMesh | undefined; }>

Inherited from

ShaderMaterial.meshMap


metadata

metadata: any

Gets or sets user defined metadata

Inherited from

ShaderMaterial.metadata


name

name: string

The name of the material

Inherited from

ShaderMaterial.name


onCompiled

onCompiled: Nullable<(effect: Effect) => void>

Callback triggered when the material is compiled

Inherited from

ShaderMaterial.onCompiled


onDisposeObservable

onDisposeObservable: Observable<Material>

An event triggered when the material is disposed

Inherited from

ShaderMaterial.onDisposeObservable


onError

onError: Nullable<(effect: Effect, errors: string) => void>

Callback triggered when an error occurs

Inherited from

ShaderMaterial.onError


pointSize

pointSize: number

Stores the size of points

Inherited from

ShaderMaterial.pointSize


reservedDataStore

reservedDataStore: any

For internal use only. Please do not use.

Inherited from

ShaderMaterial.reservedDataStore


separateCullingPass

separateCullingPass: boolean

Specifies if there should be a separate pass for culling

Inherited from

ShaderMaterial.separateCullingPass


shadowDepthWrapper

shadowDepthWrapper: Nullable<ShadowDepthWrapper>

Custom shadow depth material to use for shadow rendering instead of the in-built one

Inherited from

ShaderMaterial.shadowDepthWrapper


sideOrientation

sideOrientation: number

Stores the value for side orientation

Inherited from

ShaderMaterial.sideOrientation


snippetId

snippetId: string

Snippet ID if the material was created from the snippet server

Inherited from

ShaderMaterial.snippetId


state

state: string

The state of the material

Inherited from

ShaderMaterial.state


stencil

Readonly stencil: MaterialStencilState

Gives access to the stencil properties of the material

Inherited from

ShaderMaterial.stencil


uniqueId

uniqueId: number

Gets or sets the unique id of the material

Inherited from

ShaderMaterial.uniqueId


zOffset

zOffset: number

Stores the z offset Factor value

Inherited from

ShaderMaterial.zOffset


zOffsetUnits

zOffsetUnits: number

Stores the z offset Units value

Inherited from

ShaderMaterial.zOffsetUnits


AllDirtyFlag

Static Readonly AllDirtyFlag: 63

The all dirty flag value

Inherited from

ShaderMaterial.AllDirtyFlag


AttributesDirtyFlag

Static Readonly AttributesDirtyFlag: 8

The dirty attribute flag value

Inherited from

ShaderMaterial.AttributesDirtyFlag


ClockWiseSideOrientation

Static Readonly ClockWiseSideOrientation: 0

Stores the clock-wise side orientation

Inherited from

ShaderMaterial.ClockWiseSideOrientation


CounterClockWiseSideOrientation

Static Readonly CounterClockWiseSideOrientation: 1

Stores the counter clock-wise side orientation

Inherited from

ShaderMaterial.CounterClockWiseSideOrientation


CreateFromSnippetAsync

Static CreateFromSnippetAsync: (snippetId: string, scene: Scene, rootUrl?: string) => Promise<ShaderMaterial>

Type declaration

▸ (snippetId, scene, rootUrl?): Promise<ShaderMaterial>

Creates a ShaderMaterial from a snippet saved by the Inspector

Parameters
NameTypeDescription
snippetIdstringdefines the snippet to load
sceneScenedefines the hosting scene
rootUrl?stringdefines the root URL to use to load textures and relative dependencies
Returns

Promise<ShaderMaterial>

a promise that will resolve to the new ShaderMaterial

Deprecated

Please use ParseFromSnippetAsync instead

Inherited from

ShaderMaterial.CreateFromSnippetAsync


FresnelDirtyFlag

Static Readonly FresnelDirtyFlag: 4

The dirty fresnel flag value

Inherited from

ShaderMaterial.FresnelDirtyFlag


LightDirtyFlag

Static Readonly LightDirtyFlag: 2

The dirty light flag value

Inherited from

ShaderMaterial.LightDirtyFlag


LineListDrawMode

Static Readonly LineListDrawMode: 4

Returns the line list draw mode

Inherited from

ShaderMaterial.LineListDrawMode


LineLoopDrawMode

Static Readonly LineLoopDrawMode: 5

Returns the line loop draw mode

Inherited from

ShaderMaterial.LineLoopDrawMode


LineStripDrawMode

Static Readonly LineStripDrawMode: 6

Returns the line strip draw mode

Inherited from

ShaderMaterial.LineStripDrawMode


MATERIAL_ALPHABLEND

Static Readonly MATERIAL_ALPHABLEND: 2

MaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.

Inherited from

ShaderMaterial.MATERIAL_ALPHABLEND


MATERIAL_ALPHATEST

Static Readonly MATERIAL_ALPHATEST: 1

MaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.

Inherited from

ShaderMaterial.MATERIAL_ALPHATEST


MATERIAL_ALPHATESTANDBLEND

Static Readonly MATERIAL_ALPHATESTANDBLEND: 3

MaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer. They are also discarded below the alpha cutoff threshold to improve performances.

Inherited from

ShaderMaterial.MATERIAL_ALPHATESTANDBLEND


MATERIAL_NORMALBLENDMETHOD_RNM

Static Readonly MATERIAL_NORMALBLENDMETHOD_RNM: 1

The Reoriented Normal Mapping method is used to blend normals. Details of the algorithm can be found here: https://blog.selfshadow.com/publications/blending-in-detail/

Inherited from

ShaderMaterial.MATERIAL_NORMALBLENDMETHOD_RNM


MATERIAL_NORMALBLENDMETHOD_WHITEOUT

Static Readonly MATERIAL_NORMALBLENDMETHOD_WHITEOUT: 0

The Whiteout method is used to blend normals. Details of the algorithm can be found here: https://blog.selfshadow.com/publications/blending-in-detail/

Inherited from

ShaderMaterial.MATERIAL_NORMALBLENDMETHOD_WHITEOUT


MATERIAL_OPAQUE

Static Readonly MATERIAL_OPAQUE: 0

MaterialTransparencyMode: No transparency mode, Alpha channel is not use.

Inherited from

ShaderMaterial.MATERIAL_OPAQUE


MiscDirtyFlag

Static Readonly MiscDirtyFlag: 16

The dirty misc flag value

Inherited from

ShaderMaterial.MiscDirtyFlag


OnEventObservable

Static OnEventObservable: Observable<Material>

Event observable which raises global events common to all materials (like MaterialPluginEvent.Created)

Inherited from

ShaderMaterial.OnEventObservable


PointFillMode

Static Readonly PointFillMode: 2

Returns the point fill mode

Inherited from

ShaderMaterial.PointFillMode


PointListDrawMode

Static Readonly PointListDrawMode: 3

Returns the point list draw mode

Inherited from

ShaderMaterial.PointListDrawMode


PrePassDirtyFlag

Static Readonly PrePassDirtyFlag: 32

The dirty prepass flag value

Inherited from

ShaderMaterial.PrePassDirtyFlag


SnippetUrl

Static SnippetUrl: string

Define the Url to load snippets

Inherited from

ShaderMaterial.SnippetUrl


TextureDirtyFlag

Static Readonly TextureDirtyFlag: 1

The dirty texture flag value

Inherited from

ShaderMaterial.TextureDirtyFlag


TriangleFanDrawMode

Static Readonly TriangleFanDrawMode: 8

Returns the triangle fan draw mode

Inherited from

ShaderMaterial.TriangleFanDrawMode


TriangleFillMode

Static Readonly TriangleFillMode: 0

Returns the triangle fill mode

Inherited from

ShaderMaterial.TriangleFillMode


TriangleStripDrawMode

Static Readonly TriangleStripDrawMode: 7

Returns the triangle strip draw mode

Inherited from

ShaderMaterial.TriangleStripDrawMode


WireFrameFillMode

Static Readonly WireFrameFillMode: 1

Returns the wireframe mode

Inherited from

ShaderMaterial.WireFrameFillMode

Accessors

_disableAlphaBlending

Protected get _disableAlphaBlending(): boolean

Returns true if alpha blending should be disabled.

Returns

boolean

Inherited from

ShaderMaterial._disableAlphaBlending


_isMaterial

get _isMaterial(): boolean

Returns

boolean

Inherited from

ShaderMaterial._isMaterial


alpha

get alpha(): number

Gets the alpha value of the material

Returns

number

Inherited from

ShaderMaterial.alpha

set alpha(value): void

Sets the alpha value of the material

Parameters

NameType
valuenumber

Returns

void

Inherited from

ShaderMaterial.alpha


alphaMode

get alphaMode(): number

Gets the value of the alpha mode

Returns

number

Inherited from

ShaderMaterial.alphaMode

set alphaMode(value): void

Sets the value of the alpha mode.

ValueTypeDescription
0ALPHA_DISABLE
1ALPHA_ADD
2ALPHA_COMBINE
3ALPHA_SUBTRACT
4ALPHA_MULTIPLY
5ALPHA_MAXIMIZED
6ALPHA_ONEONE
7ALPHA_PREMULTIPLIED
8ALPHA_PREMULTIPLIED_PORTERDUFF
9ALPHA_INTERPOLATE
10ALPHA_SCREENMODE

Parameters

NameType
valuenumber

Returns

void

Inherited from

ShaderMaterial.alphaMode


backFaceCulling

get backFaceCulling(): boolean

Gets the culling state

Returns

boolean

Inherited from

ShaderMaterial.backFaceCulling

set backFaceCulling(value): void

Sets the culling state (true to enable culling, false to disable)

Parameters

NameType
valueboolean

Returns

void

Inherited from

ShaderMaterial.backFaceCulling


blockDirtyMechanism

get blockDirtyMechanism(): boolean

Block the dirty-mechanism for this specific material When set to false after being true the material will be marked as dirty.

Returns

boolean

Inherited from

ShaderMaterial.blockDirtyMechanism

set blockDirtyMechanism(value): void

Parameters

NameType
valueboolean

Returns

void

Inherited from

ShaderMaterial.blockDirtyMechanism


canRenderToMRT

get canRenderToMRT(): boolean

If the material can be rendered to several textures with MRT extension

Returns

boolean

Inherited from

ShaderMaterial.canRenderToMRT


cullBackFaces

get cullBackFaces(): boolean

Gets the type of faces that should be culled

Returns

boolean

Inherited from

ShaderMaterial.cullBackFaces

set cullBackFaces(value): void

Sets the type of faces that should be culled (true for back faces, false for front faces)

Parameters

NameType
valueboolean

Returns

void

Inherited from

ShaderMaterial.cullBackFaces


fillMode

get fillMode(): number

Gets the material fill mode

Returns

number

Inherited from

ShaderMaterial.fillMode

set fillMode(value): void

Sets the material fill mode

Parameters

NameType
valuenumber

Returns

void

Inherited from

ShaderMaterial.fillMode


fogEnabled

get fogEnabled(): boolean

Gets the value of the fog enabled state

Returns

boolean

Inherited from

ShaderMaterial.fogEnabled

set fogEnabled(value): void

Sets the state for enabling fog

Parameters

NameType
valueboolean

Returns

void

Inherited from

ShaderMaterial.fogEnabled


hasRenderTargetTextures

get hasRenderTargetTextures(): boolean

Gets a boolean indicating that current material needs to register RTT

Returns

boolean

Inherited from

ShaderMaterial.hasRenderTargetTextures


isFrozen

get isFrozen(): boolean

Specifies if updates for the material been locked

Returns

boolean

Inherited from

ShaderMaterial.isFrozen


isMultiview

get isMultiview(): boolean

is multiview set to true?

Returns

boolean

Inherited from

ShaderMaterial.isMultiview


isPrePassCapable

get isPrePassCapable(): boolean

Can this material render to prepass

Returns

boolean

Inherited from

ShaderMaterial.isPrePassCapable


needDepthPrePass

get needDepthPrePass(): boolean

Gets the depth pre-pass value

Returns

boolean

Inherited from

ShaderMaterial.needDepthPrePass

set needDepthPrePass(value): void

Sets the need depth pre-pass value

Parameters

NameType
valueboolean

Returns

void

Inherited from

ShaderMaterial.needDepthPrePass


onBind

set onBind(callback): void

Called during a bind event

Parameters

NameType
callback(Mesh: AbstractMesh) => void

Returns

void

Inherited from

ShaderMaterial.onBind


onBindObservable

get onBindObservable(): Observable<AbstractMesh>

An event triggered when the material is bound

Returns

Observable<AbstractMesh>

Inherited from

ShaderMaterial.onBindObservable


onDispose

set onDispose(callback): void

Called during a dispose event

Parameters

NameType
callback() => void

Returns

void

Inherited from

ShaderMaterial.onDispose


onEffectCreatedObservable

get onEffectCreatedObservable(): Observable<{ effect: Effect ; subMesh: Nullable<SubMesh> }>

An event triggered when the effect is (re)created

Returns

Observable<{ effect: Effect ; subMesh: Nullable<SubMesh> }>

Inherited from

ShaderMaterial.onEffectCreatedObservable


onUnBindObservable

get onUnBindObservable(): Observable<Material>

An event triggered when the material is unbound

Returns

Observable<Material>

Inherited from

ShaderMaterial.onUnBindObservable


options

get options(): IShaderMaterialOptions

Gets the options used to compile the shader. They can be modified to trigger a new compilation

Returns

IShaderMaterialOptions

Inherited from

ShaderMaterial.options


pointsCloud

get pointsCloud(): boolean

Gets the value specifying if point clouds are enabled

Returns

boolean

Inherited from

ShaderMaterial.pointsCloud

set pointsCloud(value): void

Sets the state of point cloud mode

Parameters

NameType
valueboolean

Returns

void

Inherited from

ShaderMaterial.pointsCloud


shaderPath

get shaderPath(): any

Gets the shader path used to define the shader code It can be modified to trigger a new compilation

Returns

any

Inherited from

ShaderMaterial.shaderPath

set shaderPath(shaderPath): void

Sets the shader path used to define the shader code It can be modified to trigger a new compilation

Parameters

NameType
shaderPathany

Returns

void

Inherited from

ShaderMaterial.shaderPath


transparencyMode

get transparencyMode(): Nullable<number>

Gets the current transparency mode.

Returns

Nullable<number>

Inherited from

ShaderMaterial.transparencyMode

set transparencyMode(value): void

Sets the transparency mode of the material.

ValueTypeDescription
0OPAQUE
1ALPHATEST
2ALPHABLEND
3ALPHATESTANDBLEND

Parameters

NameType
valueNullable<number>

Returns

void

Inherited from

ShaderMaterial.transparencyMode


useLogarithmicDepth

get useLogarithmicDepth(): boolean

In case the depth buffer does not allow enough depth precision for your scene (might be the case in large scenes) You can try switching to logarithmic depth.

Returns

boolean

See

https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/logarithmicDepthBuffer

Inherited from

ShaderMaterial.useLogarithmicDepth

set useLogarithmicDepth(value): void

Parameters

NameType
valueboolean

Returns

void

Inherited from

ShaderMaterial.useLogarithmicDepth


wireframe

get wireframe(): boolean

Returns

boolean

Inherited from

ShaderMaterial.wireframe

set wireframe(value): void

Sets the state of wireframe mode

Parameters

NameType
valueboolean

Returns

void

Inherited from

ShaderMaterial.wireframe

Methods

_afterBind

Protected _afterBind(mesh?, effect?, subMesh?): void

Parameters

NameType
mesh?Mesh
effect?Nullable<Effect>
subMesh?SubMesh

Returns

void

Inherited from

ShaderMaterial._afterBind


_checkScenePerformancePriority

Protected _checkScenePerformancePriority(): void

Returns

void

Inherited from

ShaderMaterial._checkScenePerformancePriority


_clonePlugins

Protected _clonePlugins(targetMaterial, rootUrl): void

Parameters

NameType
targetMaterialMaterial
rootUrlstring

Returns

void

Inherited from

ShaderMaterial._clonePlugins


_getDrawWrapper

_getDrawWrapper(): DrawWrapper

Returns

DrawWrapper

Inherited from

ShaderMaterial._getDrawWrapper


_isReadyForSubMesh

Protected _isReadyForSubMesh(subMesh): boolean

Parameters

NameType
subMeshSubMesh

Returns

boolean

Inherited from

ShaderMaterial._isReadyForSubMesh


_markAllSubMeshesAsAllDirty

Protected _markAllSubMeshesAsAllDirty(): void

Indicates that we need to re-calculated for all submeshes

Returns

void

Inherited from

ShaderMaterial._markAllSubMeshesAsAllDirty


_markAllSubMeshesAsAttributesDirty

Protected _markAllSubMeshesAsAttributesDirty(): void

Indicates that attributes need to be re-calculated for all submeshes

Returns

void

Inherited from

ShaderMaterial._markAllSubMeshesAsAttributesDirty


_markAllSubMeshesAsDirty

Protected _markAllSubMeshesAsDirty(func): void

Marks all submeshes of a material to indicate that their material defines need to be re-calculated

Parameters

NameTypeDescription
func(defines: MaterialDefines) => voiddefines a function which checks material defines against the submeshes

Returns

void

Inherited from

ShaderMaterial._markAllSubMeshesAsDirty


_markAllSubMeshesAsFresnelAndMiscDirty

Protected _markAllSubMeshesAsFresnelAndMiscDirty(): void

Indicates that fresnel and misc need to be re-calculated for all submeshes

Returns

void

Inherited from

ShaderMaterial._markAllSubMeshesAsFresnelAndMiscDirty


_markAllSubMeshesAsFresnelDirty

Protected _markAllSubMeshesAsFresnelDirty(): void

Indicates that fresnel needs to be re-calculated for all submeshes

Returns

void

Inherited from

ShaderMaterial._markAllSubMeshesAsFresnelDirty


_markAllSubMeshesAsImageProcessingDirty

Protected _markAllSubMeshesAsImageProcessingDirty(): void

Indicates that image processing needs to be re-calculated for all submeshes

Returns

void

Inherited from

ShaderMaterial._markAllSubMeshesAsImageProcessingDirty


_markAllSubMeshesAsLightsDirty

Protected _markAllSubMeshesAsLightsDirty(): void

Indicates that lights need to be re-calculated for all submeshes

Returns

void

Inherited from

ShaderMaterial._markAllSubMeshesAsLightsDirty


_markAllSubMeshesAsMiscDirty

Protected _markAllSubMeshesAsMiscDirty(): void

Indicates that misc needs to be re-calculated for all submeshes

Returns

void

Inherited from

ShaderMaterial._markAllSubMeshesAsMiscDirty


_markAllSubMeshesAsPrePassDirty

Protected _markAllSubMeshesAsPrePassDirty(): void

Indicates that prepass needs to be re-calculated for all submeshes

Returns

void

Inherited from

ShaderMaterial._markAllSubMeshesAsPrePassDirty


_markAllSubMeshesAsTexturesAndMiscDirty

Protected _markAllSubMeshesAsTexturesAndMiscDirty(): void

Indicates that textures and misc need to be re-calculated for all submeshes

Returns

void

Inherited from

ShaderMaterial._markAllSubMeshesAsTexturesAndMiscDirty


_markAllSubMeshesAsTexturesDirty

Protected _markAllSubMeshesAsTexturesDirty(): void

Indicates that textures need to be re-calculated for all submeshes

Returns

void

Inherited from

ShaderMaterial._markAllSubMeshesAsTexturesDirty


_markScenePrePassDirty

Protected _markScenePrePassDirty(): void

Indicates that the scene should check if the rendering now needs a prepass

Returns

void

Inherited from

ShaderMaterial._markScenePrePassDirty


_mustRebind

Protected _mustRebind(scene, effect, subMesh, visibility?): boolean

Parameters

NameType
sceneScene
effectEffect
subMeshSubMesh
visibility?number

Returns

boolean

Inherited from

ShaderMaterial._mustRebind


_preBind

_preBind(effect?, overrideOrientation?): boolean

Parameters

NameType
effect?Effect | DrawWrapper
overrideOrientation?Nullable<number>

Returns

boolean

Inherited from

ShaderMaterial._preBind


_serializePlugins

Protected _serializePlugins(serializationObject): void

Parameters

NameType
serializationObjectany

Returns

void

Inherited from

ShaderMaterial._serializePlugins


_setDrawWrapper

_setDrawWrapper(drawWrapper): void

Parameters

NameType
drawWrapperDrawWrapper

Returns

void

Inherited from

ShaderMaterial._setDrawWrapper


_shouldTurnAlphaTestOn

Protected _shouldTurnAlphaTestOn(mesh): boolean

Specifies if material alpha testing should be turned on for the mesh

Parameters

NameTypeDescription
meshAbstractMeshdefines the mesh to check

Returns

boolean

a boolean specifying if alpha testing should be turned on for the mesh

Inherited from

ShaderMaterial._shouldTurnAlphaTestOn


atomicMaterialsUpdate

atomicMaterialsUpdate(callback): void

This allows you to modify the material without marking it as dirty after every change. This function should be used if you need to make more than one dirty-enabling change to the material - adding a texture, setting a new fill mode and so on. The callback will pass the material as an argument, so you can make your changes to it.

Parameters

NameTypeDescription
callback(material: OccluderMaterial) => voidthe callback to be executed that will update the material

Returns

void

Inherited from

ShaderMaterial.atomicMaterialsUpdate


bind

bind(world, mesh?, effectOverride?, subMesh?): void

Binds the material to the mesh

Parameters

NameTypeDescription
worldMatrixdefines the world transformation matrix
mesh?Meshdefines the mesh to bind the material to
effectOverride?Nullable<Effect>If provided, use this effect instead of internal effect
subMesh?SubMeshdefines the submesh to bind the material to

Returns

void

Inherited from

ShaderMaterial.bind


bindEyePosition

bindEyePosition(effect, variableName?): void

Binds the view matrix to the effect

Parameters

NameTypeDescription
effectEffectdefines the effect to bind the view matrix to
variableName?stringname of the shader variable that will hold the eye position

Returns

void

Inherited from

ShaderMaterial.bindEyePosition


bindForSubMesh

bindForSubMesh(world, mesh, subMesh): void

Binds the submesh to this material by preparing the effect and shader to draw

Parameters

NameTypeDescription
worldMatrixdefines the world transformation matrix
meshMeshdefines the mesh containing the submesh
subMeshSubMeshdefines the submesh to bind the material to

Returns

void

Inherited from

ShaderMaterial.bindForSubMesh


bindOnlyNormalMatrix

bindOnlyNormalMatrix(normalMatrix): void

Binds the given normal matrix to the active effect

Parameters

NameTypeDescription
normalMatrixMatrixthe matrix to bind

Returns

void

Inherited from

ShaderMaterial.bindOnlyNormalMatrix


bindOnlyWorldMatrix

bindOnlyWorldMatrix(world, effectOverride?): void

Binds the world matrix to the material

Parameters

NameTypeDescription
worldMatrixdefines the world transformation matrix
effectOverride?Nullable<Effect>If provided, use this effect instead of internal effect

Returns

void

Inherited from

ShaderMaterial.bindOnlyWorldMatrix


bindView

bindView(effect): void

Binds the view matrix to the effect

Parameters

NameTypeDescription
effectEffectdefines the effect to bind the view matrix to

Returns

void

Inherited from

ShaderMaterial.bindView


bindViewProjection

bindViewProjection(effect): void

Binds the view projection and projection matrices to the effect

Parameters

NameTypeDescription
effectEffectdefines the effect to bind the view projection and projection matrices to

Returns

void

Inherited from

ShaderMaterial.bindViewProjection


buildUniformLayout

buildUniformLayout(): void

Initializes the uniform buffer layout for the shader.

Returns

void

Inherited from

ShaderMaterial.buildUniformLayout


clone

clone(name): ShaderMaterial

Makes a duplicate of the material, and gives it a new name

Parameters

NameTypeDescription
namestringdefines the new name for the duplicated material

Returns

ShaderMaterial

the cloned material

Inherited from

ShaderMaterial.clone


dispose

dispose(forceDisposeEffect?, forceDisposeTextures?, notBoundToMesh?): void

Disposes the material

Parameters

NameTypeDescription
forceDisposeEffect?booleanspecifies if effects should be forcefully disposed
forceDisposeTextures?booleanspecifies if textures should be forcefully disposed
notBoundToMesh?booleanspecifies if the material that is being disposed is known to be not bound to any mesh

Returns

void

Inherited from

ShaderMaterial.dispose


forceCompilation

forceCompilation(mesh, onCompiled?, options?, onError?): void

Force shader compilation

Parameters

NameTypeDescription
meshAbstractMeshdefines the mesh associated with this material
onCompiled?(material: Material) => voiddefines a function to execute once the material is compiled
options?Partial<IMaterialCompilationOptions>defines the options to configure the compilation
onError?(reason: string) => voiddefines a function to execute if the material fails compiling

Returns

void

Inherited from

ShaderMaterial.forceCompilation


forceCompilationAsync

forceCompilationAsync(mesh, options?): Promise<void>

Force shader compilation

Parameters

NameTypeDescription
meshAbstractMeshdefines the mesh that will use this material
options?Partial<IMaterialCompilationOptions>defines additional options for compiling the shaders

Returns

Promise<void>

a promise that resolves when the compilation completes

Inherited from

ShaderMaterial.forceCompilationAsync


freeze

freeze(): void

Locks updates for the material

Returns

void

Inherited from

ShaderMaterial.freeze


getActiveTextures

getActiveTextures(): BaseTexture[]

Gets the active textures from the material

Returns

BaseTexture[]

an array of textures

Inherited from

ShaderMaterial.getActiveTextures


getAlphaTestTexture

getAlphaTestTexture(): Nullable<BaseTexture>

Gets the texture used for the alpha test

Returns

Nullable<BaseTexture>

the texture to use for alpha testing

Inherited from

ShaderMaterial.getAlphaTestTexture


getAnimatables

getAnimatables(): IAnimatable[]

Returns the animatable textures.

Returns

IAnimatable[]

  • Array of animatable textures.

Inherited from

ShaderMaterial.getAnimatables


getBindedMeshes

getBindedMeshes(): AbstractMesh[]

Gets the meshes bound to the material

Returns

AbstractMesh[]

an array of meshes bound to the material

Inherited from

ShaderMaterial.getBindedMeshes


getClassName

getClassName(): string

Gets the current class name of the material e.g. "ShaderMaterial" Mainly use in serialization.

Returns

string

the class name

Inherited from

ShaderMaterial.getClassName


getEffect

getEffect(): Effect

Returns

Effect

Inherited from

ShaderMaterial.getEffect


getScene

getScene(): Scene

Returns the current scene

Returns

Scene

a Scene

Inherited from

ShaderMaterial.getScene


hasTexture

hasTexture(texture): boolean

Specifies if the material uses a texture

Parameters

NameTypeDescription
textureBaseTexturedefines the texture to check against the material

Returns

boolean

a boolean specifying if the material uses the texture

Inherited from

ShaderMaterial.hasTexture


isReady

isReady(mesh?, useInstances?, subMesh?): boolean

Checks if the material is ready to render the requested mesh

Parameters

NameTypeDescription
mesh?AbstractMeshDefine the mesh to render
useInstances?booleanDefine whether or not the material is used with instances
subMesh?SubMeshdefines which submesh to render

Returns

boolean

true if ready, otherwise false

Inherited from

ShaderMaterial.isReady


isReadyForSubMesh

isReadyForSubMesh(mesh, subMesh, useInstances?): boolean

Specifies that the submesh is ready to be used

Parameters

NameTypeDescription
meshAbstractMeshdefines the mesh to check
subMeshSubMeshdefines which submesh to check
useInstances?booleanspecifies that instances should be used

Returns

boolean

a boolean indicating that the submesh is ready or not

Inherited from

ShaderMaterial.isReadyForSubMesh


markAsDirty

markAsDirty(flag): void

Marks a define in the material to indicate that it needs to be re-computed

Parameters

NameTypeDescription
flagnumberdefines a flag used to determine which parts of the material have to be marked as dirty

Returns

void

Inherited from

ShaderMaterial.markAsDirty


markDirty

markDirty(forceMaterialDirty?): void

Marks the material to indicate that it needs to be re-calculated

Parameters

NameTypeDescription
forceMaterialDirty?booleanForces the material to be marked as dirty for all components (same as this.markAsDirty(Material.AllDirtyFlag)). You should use this flag if the material is frozen and you want to force a recompilation.

Returns

void

Inherited from

ShaderMaterial.markDirty


needAlphaBlending

needAlphaBlending(): boolean

Specifies if the material will require alpha blending

Returns

boolean

a boolean specifying if alpha blending is needed

Inherited from

ShaderMaterial.needAlphaBlending


needAlphaBlendingForMesh

needAlphaBlendingForMesh(mesh): boolean

Specifies if the mesh will require alpha blending

Parameters

NameTypeDescription
meshAbstractMeshdefines the mesh to check

Returns

boolean

a boolean specifying if alpha blending is needed for the mesh

Inherited from

ShaderMaterial.needAlphaBlendingForMesh


needAlphaTesting

needAlphaTesting(): boolean

Specifies if this material should be rendered in alpha test mode

Returns

boolean

a boolean specifying if an alpha test is needed.

Inherited from

ShaderMaterial.needAlphaTesting


resetDrawCache

resetDrawCache(): void

Resets the draw wrappers cache for all submeshes that are using this material

Returns

void

Inherited from

ShaderMaterial.resetDrawCache


serialize

serialize(): any

Serializes this material in a JSON representation

Returns

any

the serialized material object

Inherited from

ShaderMaterial.serialize


setArray2

setArray2(name, value): ShaderMaterial

Set a vec2 array in the shader from a number array.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valuenumber[]Define the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setArray2


setArray3

setArray3(name, value): ShaderMaterial

Set a vec3 array in the shader from a number array.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valuenumber[]Define the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setArray3


setArray4

setArray4(name, value): ShaderMaterial

Set a vec4 array in the shader from a number array.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valuenumber[]Define the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setArray4


setColor3

setColor3(name, value): ShaderMaterial

Set a vec3 in the shader from a Color3.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valueColor3Define the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setColor3


setColor3Array

setColor3Array(name, value): ShaderMaterial

Set a vec3 array in the shader from a Color3 array.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valueColor3[]Define the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setColor3Array


setColor4

setColor4(name, value): ShaderMaterial

Set a vec4 in the shader from a Color4.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valueColor4Define the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setColor4


setColor4Array

setColor4Array(name, value): ShaderMaterial

Set a vec4 array in the shader from a Color4 array.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valueColor4[]Define the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setColor4Array


setDefine

setDefine(define, value): ShaderMaterial

Adds, removes, or replaces the specified shader define and value.

  • setDefine("MY_DEFINE", true); // enables a boolean define
  • setDefine("MY_DEFINE", "0.5"); // adds "#define MY_DEFINE 0.5" to the shader (or sets and replaces the value of any existing define with that name)
  • setDefine("MY_DEFINE", false); // disables and removes the define Note if the active defines do change, the shader will be recompiled and this can be expensive.

Parameters

NameTypeDescription
definestringthe define name e.g., "OUTPUT_TO_SRGB" or "#define OUTPUT_TO_SRGB". If the define was passed into the constructor already, the version used should match that, and in either case, it should not include any appended value.
valuestring | booleaneither the value of the define (e.g. a numerical value) or for booleans, true if the define should be enabled or false if it should be disabled

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setDefine


setExternalTexture

setExternalTexture(name, texture): ShaderMaterial

Set an internal texture in the shader.

Parameters

NameTypeDescription
namestringDefine the name of the uniform samplers as defined in the shader
textureExternalTextureDefine the texture to bind to this sampler

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setExternalTexture


setFloat

setFloat(name, value): ShaderMaterial

Set a float in the shader.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valuenumberDefine the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setFloat


setFloats

setFloats(name, value): ShaderMaterial

Set an array of floats in the shader.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valuenumber[]Define the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setFloats


setInt

setInt(name, value): ShaderMaterial

Set a int in the shader.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valuenumberDefine the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setInt


setMatrices

setMatrices(name, value): ShaderMaterial

Set a float32Array in the shader from a matrix array.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valueMatrix[]Define the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setMatrices


setMatrix

setMatrix(name, value): ShaderMaterial

Set a mat4 in the shader from a Matrix.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valueMatrixDefine the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setMatrix


setMatrix2x2

setMatrix2x2(name, value): ShaderMaterial

Set a mat2 in the shader from a Float32Array.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valuenumber[] | Float32ArrayDefine the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setMatrix2x2


setMatrix3x3

setMatrix3x3(name, value): ShaderMaterial

Set a mat3 in the shader from a Float32Array.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valuenumber[] | Float32ArrayDefine the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setMatrix3x3


setPrePassRenderer

setPrePassRenderer(prePassRenderer): boolean

Sets the required values to the prepass renderer.

Parameters

NameTypeDescription
prePassRendererPrePassRendererdefines the prepass renderer to setup.

Returns

boolean

true if the pre pass is needed.

Inherited from

ShaderMaterial.setPrePassRenderer


setQuaternion

setQuaternion(name, value): ShaderMaterial

Set a vec4 in the shader from a Quaternion.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valueQuaternionDefine the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setQuaternion


setQuaternionArray

setQuaternionArray(name, value): ShaderMaterial

Set a vec4 array in the shader from a Quaternion array.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valueQuaternion[]Define the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setQuaternionArray


setStorageBuffer

setStorageBuffer(name, buffer): ShaderMaterial

Set a storage buffer in the shader

Parameters

NameTypeDescription
namestringDefine the name of the storage buffer as defined in the shader
bufferStorageBufferDefine the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setStorageBuffer


setTexture

setTexture(name, texture): ShaderMaterial

Set a texture in the shader.

Parameters

NameTypeDescription
namestringDefine the name of the uniform samplers as defined in the shader
textureBaseTextureDefine the texture to bind to this sampler

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setTexture


setTextureArray

setTextureArray(name, textures): ShaderMaterial

Set a texture array in the shader.

Parameters

NameTypeDescription
namestringDefine the name of the uniform sampler array as defined in the shader
texturesBaseTexture[]Define the list of textures to bind to this sampler

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setTextureArray


setTextureSampler

setTextureSampler(name, sampler): ShaderMaterial

Set a texture sampler in the shader

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
samplerTextureSamplerDefine the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setTextureSampler


setUInt

setUInt(name, value): ShaderMaterial

Set a unsigned int in the shader.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valuenumberDefine the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setUInt


setUniformBuffer

setUniformBuffer(name, buffer): ShaderMaterial

Set a uniform buffer in the shader

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
bufferUniformBufferDefine the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setUniformBuffer


setVector2

setVector2(name, value): ShaderMaterial

Set a vec2 in the shader from a Vector2.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valueVector2Define the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setVector2


setVector3

setVector3(name, value): ShaderMaterial

Set a vec3 in the shader from a Vector3.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valueVector3Define the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setVector3


setVector4

setVector4(name, value): ShaderMaterial

Set a vec4 in the shader from a Vector4.

Parameters

NameTypeDescription
namestringDefine the name of the uniform as defined in the shader
valueVector4Define the value to give to the uniform

Returns

ShaderMaterial

the material itself allowing "fluent" like uniform updates

Inherited from

ShaderMaterial.setVector4


toString

toString(fullDetails?): string

Returns a string representation of the current material

Parameters

NameTypeDescription
fullDetails?booleandefines a boolean indicating which levels of logging is desired

Returns

string

a string with material information

Inherited from

ShaderMaterial.toString


unbind

unbind(): void

Unbinds the material from the mesh

Returns

void

Inherited from

ShaderMaterial.unbind


unfreeze

unfreeze(): void

Unlocks updates for the material

Returns

void

Inherited from

ShaderMaterial.unfreeze


Parse

Static Parse(source, scene, rootUrl): ShaderMaterial

Creates a shader material from parsed shader material data

Parameters

NameTypeDescription
sourceanydefines the JSON representation of the material
sceneScenedefines the hosting scene
rootUrlstringdefines the root URL to use to load textures and relative dependencies

Returns

ShaderMaterial

a new material

Inherited from

ShaderMaterial.Parse


ParseFromFileAsync

Static ParseFromFileAsync(name, url, scene, rootUrl?): Promise<ShaderMaterial>

Creates a new ShaderMaterial from a snippet saved in a remote file

Parameters

NameTypeDescription
nameNullable<string>defines the name of the ShaderMaterial to create (can be null or empty to use the one from the json data)
urlstringdefines the url to load from
sceneScenedefines the hosting scene
rootUrl?stringdefines the root URL to use to load textures and relative dependencies

Returns

Promise<ShaderMaterial>

a promise that will resolve to the new ShaderMaterial

Inherited from

ShaderMaterial.ParseFromFileAsync


ParseFromSnippetAsync

Static ParseFromSnippetAsync(snippetId, scene, rootUrl?): Promise<ShaderMaterial>

Creates a ShaderMaterial from a snippet saved by the Inspector

Parameters

NameTypeDescription
snippetIdstringdefines the snippet to load
sceneScenedefines the hosting scene
rootUrl?stringdefines the root URL to use to load textures and relative dependencies

Returns

Promise<ShaderMaterial>

a promise that will resolve to the new ShaderMaterial

Inherited from

ShaderMaterial.ParseFromSnippetAsync


_ParsePlugins

Protected Static _ParsePlugins(serializationObject, material, scene, rootUrl): void

Parameters

NameType
serializationObjectany
materialMaterial
sceneScene
rootUrlstring

Returns

void

Inherited from

ShaderMaterial._ParsePlugins