Class OcclusionMaterialSince
Hierarchy (View Summary)
- ShaderMaterial
- OcclusionMaterial
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Parameters
- name: string
- scene: Scene
Returns OcclusionMaterial
Properties
allow Shader Hot Swapping
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)
animations
Stores the animations for the material
check Ready On Every Call
Specifies if the ready state should be checked on each call
check Ready Only Once
Specifies if the ready state should be checked once
clip Plane
Gets or sets the active clipplane 1
clip Plane2
Gets or sets the active clipplane 2
clip Plane3
Gets or sets the active clipplane 3
clip Plane4
Gets or sets the active clipplane 4
clip Plane5
Gets or sets the active clipplane 5
clip Plane6
Gets or sets the active clipplane 6
custom Shader Name Resolve
shaderName: string,
uniforms: string[],
uniformBuffers: string[],
samplers: string[],
defines: string[] | MaterialDefines,
attributes?: string[],
options?: ICustomShaderNameResolveOptions,
) => string
Custom callback helping to override the default shader used in the material.
depth Function
Specifies the depth function that should be used. 0 means the default engine function
disable Color Write
Specifies if color writing should be disabled
disable Depth Write
Specifies if depth writing should be disabled
do Not Serialize
Specifies if the material should be serialized
force Depth Write
Specifies if depth writing should be forced
get Render Target Textures
Callback triggered to get the render target textures
id
The ID of the material
inspectable Custom Properties
List of inspectable custom properties (used by the Inspector)
metadata
Gets or sets user defined metadata
name
The name of the material
on Compiled
Callback triggered when the material is compiled
on Dispose Observable
An event triggered when the material is disposed
on Error
Callback triggered when an error occurs
Optionalplugin Manager
Plugin manager for this material
point Size
Stores the size of points
reserved Data Store
For internal use only. Please do not use.
separate Culling Pass
Specifies if there should be a separate pass for culling
shadow Depth Wrapper
Custom shadow depth material to use for shadow rendering instead of the in-built one
side Orientation
Stores the value for side orientation
snippet Id
Snippet ID if the material was created from the snippet server
state
The state of the material
Readonlystencil
Gives access to the stencil properties of the material
texture Repetition Hex Tiling Params
Parameters for the hex tiling texture repetition mode (TEXTURE_REPETITION_HEX_TILING). x = rotation strength (0..1, default 1.0) — how much each hex tile is rotated. y = fall-off contrast (0..1, default 0.6) — how much luminance affects blending weight at tile borders. z = exponent (1..20, default 7.0) — controls the sharpness of weight falloff between tiles. w = contrast (0..1, default 0.5) — boost blending contrast via Gain3 (0.5 = neutral, >0.5 = higher contrast).
unique Id
Gets or sets the unique id of the material
z Offset
Stores the z offset Factor value
z Offset Units
Stores the z offset Units value
Static ReadonlyAll Dirty Flag
The all dirty flag value
Static ReadonlyAttributes Dirty Flag
The dirty attribute flag value
Static ReadonlyClock Wise Side Orientation
Stores the clock-wise side orientation
Static ReadonlyCounter Clock Wise Side Orientation
Stores the counter clock-wise side orientation
StaticForce Vertex Output Invariant
If true, all materials will have their vertex output set to invariant (see the vertexOutputInvariant property).
Static ReadonlyFresnel Dirty Flag
The dirty fresnel flag value
Static ReadonlyImage Processing Dirty Flag
The dirty image processing flag value
Static ReadonlyLight Dirty Flag
The dirty light flag value
Static ReadonlyLIGHTFALLOFF_ GLTF
PBRMaterialLightFalloff gltf: light is falling off as described in the gltf moving to PBR document to enhance interoperability with other engines.
Static ReadonlyLIGHTFALLOFF_ PHYSICAL
PBRMaterialLightFalloff Physical: light is falling off following the inverse squared distance law.
Static ReadonlyLIGHTFALLOFF_ STANDARD
PBRMaterialLightFalloff Standard: light is falling off like in the standard material to enhance interoperability with other materials.
Static ReadonlyLine List Draw Mode
Returns the line list draw mode
Static ReadonlyLine Loop Draw Mode
Returns the line loop draw mode
Static ReadonlyLine Strip Draw Mode
Returns the line strip draw mode
Static ReadonlyMATERIAL_ ALPHABLEND
MaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
Static ReadonlyMATERIAL_ ALPHATEST
MaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.
Static ReadonlyMATERIAL_ ALPHATESTANDBLEND
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.
Static ReadonlyMATERIAL_ NORMALBLENDMETHOD_ RNM
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/
Static ReadonlyMATERIAL_ NORMALBLENDMETHOD_ WHITEOUT
The Whiteout method is used to blend normals. Details of the algorithm can be found here: https://blog.selfshadow.com/publications/blending-in-detail/
Static ReadonlyMATERIAL_ OPAQUE
MaterialTransparencyMode: No transparency mode, Alpha channel is not use.
Static ReadonlyMisc Dirty Flag
The dirty misc flag value
StaticOn Event Observable
Event observable which raises global events common to all materials (like MaterialPluginEvent.Created)
Static ReadonlyPoint Fill Mode
Returns the point fill mode
Static ReadonlyPoint List Draw Mode
Returns the point list draw mode
Static ReadonlyPre Pass Dirty Flag
The dirty prepass flag value
StaticSnippet Url
Define the Url to load snippets
Static ReadonlyTexture Dirty Flag
The dirty texture flag value
Static ReadonlyTriangle Fan Draw Mode
Returns the triangle fan draw mode
Static ReadonlyTriangle Fill Mode
Returns the triangle fill mode
Static ReadonlyTriangle Strip Draw Mode
Returns the triangle strip draw mode
Static ReadonlyWire Frame Fill Mode
Returns the wireframe mode
Accessors
alpha
-
get alpha(): number
Gets the alpha value of the material
Returns number
-
set alpha(value: number): void
Sets the alpha value of the material
Parameters
- value: number
Returns void
alpha Mode
-
get alphaMode(): number
Gets the value of the alpha mode
Returns number
-
set alphaMode(value: number): void
Sets the value of the alpha mode.
Value Type Description 0 ALPHA_DISABLE 1 ALPHA_ADD Defines that alpha blending is COLOR=SRC_ALPHA * SRC + DEST, ALPHA=DEST_ALPHA 2 ALPHA_COMBINE Defines that alpha blending is COLOR=SRC_ALPHA * SRC + (1 - SRC_ALPHA) * DEST, ALPHA=SRC_ALPHA + DEST_ALPHA 3 ALPHA_SUBTRACT Defines that alpha blending is COLOR=(1 - SRC) * DEST, ALPHA=SRC_ALPHA + DEST_ALPHA 4 ALPHA_MULTIPLY Defines that alpha blending is COLOR=DEST * SRC, ALPHA=SRC_ALPHA + DEST_ALPHA 5 ALPHA_MAXIMIZED Defines that alpha blending is COLOR=SRC_ALPHA * SRC + (1 - SRC) * DEST, ALPHA=SRC_ALPHA + DEST_ALPHA 6 ALPHA_ONEONE Defines that alpha blending is COLOR=SRC + DEST, ALPHA=DEST_ALPHA 7 ALPHA_PREMULTIPLIED Defines that alpha blending is COLOR=SRC + (1 - SRC_ALPHA) * DEST, ALPHA=SRC_ALPHA + DEST_ALPHA 8 ALPHA_PREMULTIPLIED_PORTERDUFF Defines that alpha blending is COLOR=SRC + (1 - SRC_ALPHA) * DEST, ALPHA=SRC_ALPHA + (1 - SRC_ALPHA) * DEST_ALPHA 9 ALPHA_INTERPOLATE Defines that alpha blending is COLOR=CST * SRC + (1 - CST) * DEST, ALPHA=CST_ALPHA * SRC + (1 - CST_ALPHA) * DEST_ALPHA 10 ALPHA_SCREENMODE Defines that alpha blending is COLOR=SRC + (1 - SRC) * DEST, ALPHA=SRC_ALPHA + (1 - SRC_ALPHA) * DEST_ALPHA 11 ALPHA_ONEONE_ONEONE Defines that alpha blending is COLOR=SRC + DST, ALPHA=SRC_ALPHA + DEST_ALPHA 12 ALPHA_ALPHATOCOLOR Defines that alpha blending is COLOR=DEST_ALPHA * SRC + DST, ALPHA=0 13 ALPHA_REVERSEONEMINUS Defines that alpha blending is COLOR=(1 - DEST) * SRC + (1 - SRC) * DEST, ALPHA=(1 - DEST_ALPHA) * SRC_ALPHA + (1 - SRC_ALPHA) * DEST_ALPHA 14 ALPHA_SRC_DSTONEMINUSSRCALPHA Defines that alpha blending is ALPHA=SRC + (1 - SRC ALPHA) * DEST, ALPHA=SRC_ALPHA + (1 - SRC ALPHA) * DEST_ALPHA 15 ALPHA_ONEONE_ONEZERO Defines that alpha blending is COLOR=SRC + DST, ALPHA=SRC_ALPHA 16 ALPHA_EXCLUSION Defines that alpha blending is COLOR=(1 - DEST) * SRC + (1 - SRC) * DEST, ALPHA=DEST_ALPHA 17 ALPHA_LAYER_ACCUMULATE Defines that alpha blending is COLOR=SRC_ALPHA * SRC + (1 - SRC ALPHA) * DEST, ALPHA=SRC_ALPHA + (1 - SRC_ALPHA) * DEST_ALPHA 18 ALPHA_MIN Defines that alpha blending is COLOR=MIN(SRC, DEST), ALPHA=MIN(SRC_ALPHA, DEST_ALPHA) 19 ALPHA_MAX Defines that alpha blending is COLOR=MAX(SRC, DEST), ALPHA=MAX(SRC_ALPHA, DEST_ALPHA) 20 ALPHA_DUAL_SRC0_ADD_SRC1xDST Defines that alpha blending uses dual source blending and is COLOR=SRC + SRC1 * DEST, ALPHA=DST_ALPHA 21 ALPHA_REPLACE_COLOR Defines that alpha blending is COLOR=SRC, ALPHA=SRC_ALPHA + (1 - SRC_ALPHA) * DEST_ALPHA Parameters
- value: number
Returns void
alpha Modes
-
get alphaModes(): readonly number[]
Gets the list of alpha modes (length greater than 1 for multi-targets)
Returns readonly number[]
back Face Culling
-
get backFaceCulling(): boolean
Gets the culling state
Returns boolean
-
set backFaceCulling(value: boolean): void
Sets the culling state (true to enable culling, false to disable)
Parameters
- value: boolean
Returns void
block Dirty Mechanism
-
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
-
set blockDirtyMechanism(value: boolean): void
Parameters
- value: boolean
Returns void
can Render To MRT
-
get canRenderToMRT(): boolean
If the material can be rendered to several textures with MRT extension
Returns boolean
cull Back Faces
-
get cullBackFaces(): boolean
Gets the type of faces that should be culled
Returns boolean
-
set cullBackFaces(value: boolean): void
Sets the type of faces that should be culled (true for back faces, false for front faces)
Parameters
- value: boolean
Returns void
fill Mode
-
get fillMode(): number
Gets the material fill mode
Returns number
-
set fillMode(value: number): void
Sets the material fill mode
Parameters
- value: number
Returns void
fog Enabled
-
get fogEnabled(): boolean
Gets the value of the fog enabled state
Returns boolean
-
set fogEnabled(value: boolean): void
Sets the state for enabling fog
Parameters
- value: boolean
Returns void
has Render Target Textures
-
get hasRenderTargetTextures(): boolean
Gets a boolean indicating that current material needs to register RTT
Returns boolean
is Frozen
-
get isFrozen(): boolean
Specifies if updates for the material been locked
Returns boolean
is Multiview
-
get isMultiview(): boolean
is multiview set to true?
Returns boolean
is Pre Pass Capable
-
get isPrePassCapable(): boolean
Can this material render to prepass
Returns boolean
is Vertex Output Invariant
-
get isVertexOutputInvariant(): boolean
Gets or sets the vertex output invariant state Setting this property to true will force the shader compiler to disable some optimization to make sure the vertex output is always calculated the same way across different compilation units. You may need to enable this option if you are seeing some depth artifacts when using a depth pre-pass, for e.g. Note that this may have an impact on performance, so leave this option disabled if not needed.
Returns boolean
-
set isVertexOutputInvariant(value: boolean): void
Parameters
- value: boolean
Returns void
need Depth Pre Pass
-
get needDepthPrePass(): boolean
Gets the depth pre-pass value
Returns boolean
-
set needDepthPrePass(value: boolean): void
Sets the need depth pre-pass value
Parameters
- value: boolean
Returns void
on Bind
on Bind Observable
-
An event triggered when the material is bound
Returns Observable<AbstractMesh>
on Dispose
-
set onDispose(callback: () => void): void
Called during a dispose event
Parameters
- callback: () => void
Returns void
on Effect Created Observable
-
An event triggered when the effect is (re)created
Returns Observable<{ effect: Effect; subMesh: Nullable<SubMesh> }>
on Un Bind Observable
-
An event triggered when the material is unbound
Returns Observable<Material>
options
-
Gets the options used to compile the shader. They can be modified to trigger a new compilation
Returns IShaderMaterialOptions
points Cloud
-
get pointsCloud(): boolean
Gets the value specifying if point clouds are enabled
Returns boolean
-
set pointsCloud(value: boolean): void
Sets the state of point cloud mode
Parameters
- value: boolean
Returns void
shader Language
-
Gets the shader language used in this material.
Returns ShaderLanguage
shader Path
-
Gets the shader path used to define the shader code It can be modified to trigger a new compilation
Returns string | IShaderPath
-
Sets the shader path used to define the shader code It can be modified to trigger a new compilation
Parameters
- shaderPath: string | IShaderPath
Returns void
texture Repetition Mode
-
get textureRepetitionMode(): number
Gets the texture repetition breaking mode.
Returns number
-
set textureRepetitionMode(value: number): void
Sets the texture repetition breaking mode. Use one of the Constants.TEXTURE_REPETITION_* values to break visible texture tiling patterns. Ordered by cost: NONE (1 fetch), NOISE_BLEND (3), HEX_TILING (3), TILE_RANDOMIZATION (4), VORONOI_BOMBING (9). Not supported on WebGL1 — the mode will be forced to NONE.
Parameters
- value: number
Returns void
transparency Mode
use Logarithmic Depth
-
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
-
set useLogarithmicDepth(value: boolean): void
Parameters
- value: boolean
Returns void
use Vertex Pulling
-
get useVertexPulling(): boolean
Tells the engine to draw geometry using vertex pulling instead of index drawing. This will automatically set the vertex buffers as storage buffers and make them accessible to the vertex shader (WebGPU only).
Returns boolean
-
set useVertexPulling(value: boolean): void
Parameters
- value: boolean
Returns void
wireframe
-
get wireframe(): boolean
Returns boolean
-
set wireframe(value: boolean): void
Sets the state of wireframe mode
Parameters
- value: boolean
Returns void
Methods
atomic Materials Update
-
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
- callback: (material: this) => void
the callback to be executed that will update the material
Returns void
- callback: (material: this) => void
bind
-
bind(
world: Matrix,
mesh?: AbstractMesh,
effectOverride?: Nullable<Effect>,
subMesh?: SubMesh,
): voidBinds the material to the mesh
Parameters
- world: Matrix
defines the world transformation matrix
Optionalmesh: AbstractMeshdefines the mesh to bind the material to
OptionaleffectOverride: Nullable<Effect>If provided, use this effect instead of internal effect
OptionalsubMesh: SubMeshdefines the submesh to bind the material to
Returns void
- world: Matrix
bind Eye Position
-
Binds the view matrix to the effect
Parameters
- effect: Effect
defines the effect to bind the view matrix to
OptionalvariableName: stringname of the shader variable that will hold the eye position
Returns void
- effect: Effect
bind For Sub Mesh
bind Only Normal Matrix
-
Binds the given normal matrix to the active effect
Parameters
- normalMatrix: Matrix
the matrix to bind
Returns void
- normalMatrix: Matrix
bind Only World Matrix
bind View
-
Binds the view matrix to the effect
Parameters
- effect: Effect
defines the effect to bind the view matrix to
Returns void
- effect: Effect
bind View Projection
-
Binds the view projection and projection matrices to the effect
Parameters
- effect: Effect
defines the effect to bind the view projection and projection matrices to
Returns void
- effect: Effect
build Uniform Layout
-
Initializes the uniform buffer layout for the shader.
Returns void
clone
-
Makes a duplicate of the material, and gives it a new name
Parameters
- name: string
defines the new name for the duplicated material
Returns ShaderMaterial
the cloned material
- name: string
dispose
-
dispose(
forceDisposeEffect?: boolean,
forceDisposeTextures?: boolean,
notBoundToMesh?: boolean,
): voidDisposes the material
Parameters
OptionalforceDisposeEffect: booleanspecifies if effects should be forcefully disposed
OptionalforceDisposeTextures: booleanspecifies if textures should be forcefully disposed
OptionalnotBoundToMesh: booleanspecifies if the material that is being disposed is known to be not bound to any mesh
Returns void
force Compilation
-
forceCompilation(
mesh: AbstractMesh,
onCompiled?: (material: Material) => void,
options?: Partial<IMaterialCompilationOptions>,
onError?: (reason: string) => void,
): voidForce shader compilation
Parameters
- mesh: AbstractMesh
defines the mesh associated with this material
OptionalonCompiled: (material: Material) => voiddefines a function to execute once the material is compiled
Optionaloptions: Partial<IMaterialCompilationOptions>defines the options to configure the compilation
OptionalonError: (reason: string) => voiddefines a function to execute if the material fails compiling
Returns void
- mesh: AbstractMesh
force Compilation Async
-
forceCompilationAsync(
mesh: AbstractMesh,
options?: Partial<IMaterialCompilationOptions>,
): Promise<void>Force shader compilation
Parameters
- mesh: AbstractMesh
defines the mesh that will use this material
Optionaloptions: Partial<IMaterialCompilationOptions>defines additional options for compiling the shaders
Returns Promise<void>
a promise that resolves when the compilation completes
- mesh: AbstractMesh
freeze
-
Locks updates for the material.
Note: while a material is frozen, the scene can still rebind it at least once per camera render (and again whenever another material was bound in between). What can be skipped while the frozen material stays cached are per-mesh updates performed during a rebind.
This includes per-mesh morph target influences. If the same frozen material is shared across several meshes that each have different per-mesh morph influences, only the mesh that triggers the rebind updates those values. Other meshes rendered afterward with the same cached frozen material may reuse stale influences and render with the wrong values.
For that scenario either keep the material unfrozen, clone the material per mesh and freeze each clone, or
unfreeze()before changing influences andfreeze()again afterwards.Returns void
get Active Textures
get Alpha Test Texture
-
Gets the texture used for the alpha test
Returns Nullable<BaseTexture>
the texture to use for alpha testing
get Animatables
get Binded Meshes
-
Gets the meshes bound to the material
Returns AbstractMesh[]
an array of meshes bound to the material
get Class Name
-
Gets the current class name of the material e.g. "ShaderMaterial" Mainly use in serialization.
Returns string
the class name
get Effect
get Scene
has Texture
-
Specifies if the material uses a texture
Parameters
- texture: BaseTexture
defines the texture to check against the material
Returns boolean
a boolean specifying if the material uses the texture
- texture: BaseTexture
is Ready
-
Checks if the material is ready to render the requested mesh
Parameters
Optionalmesh: AbstractMeshDefine the mesh to render
OptionaluseInstances: booleanDefine whether or not the material is used with instances
OptionalsubMesh: SubMeshdefines which submesh to render
Returns boolean
true if ready, otherwise false
is Ready For Sub Mesh
-
Specifies that the submesh is ready to be used
Parameters
- mesh: AbstractMesh
defines the mesh to check
- subMesh: SubMesh
defines which submesh to check
OptionaluseInstances: booleanspecifies that instances should be used
Returns boolean
a boolean indicating that the submesh is ready or not
- mesh: AbstractMesh
mark As Dirty
-
Marks a define in the material to indicate that it needs to be re-computed
Parameters
- flag: number
defines a flag used to determine which parts of the material have to be marked as dirty
Returns void
- flag: number
mark Dirty
-
Marks the material to indicate that it needs to be re-calculated
Parameters
- forceMaterialDirty: boolean = false
Forces 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
- forceMaterialDirty: boolean = false
need Alpha Blending
-
Specifies if the material will require alpha blending
Returns boolean
a boolean specifying if alpha blending is needed
need Alpha Blending For Mesh
-
Specifies if the mesh will require alpha blending
Parameters
- mesh: AbstractMesh
defines the mesh to check
Returns boolean
a boolean specifying if alpha blending is needed for the mesh
- mesh: AbstractMesh
need Alpha Testing
-
Specifies if this material should be rendered in alpha test mode
Returns boolean
a boolean specifying if an alpha test is needed.
need Alpha Testing For Mesh
-
Specifies if material alpha testing should be turned on for the mesh
Parameters
- mesh: AbstractMesh
defines the mesh to check
Returns boolean
a boolean specifying if alpha testing should be turned on for the mesh
- mesh: AbstractMesh
remove Texture
-
Remove a texture from the material.
Parameters
- name: string
Define the name of the texture to remove
Returns void
- name: string
reset Draw Cache
-
Resets the draw wrappers cache for all submeshes that are using this material
Returns void
serialize
-
Serializes this material in a JSON representation
Returns any
the serialized material object
set Alpha Mode
-
Sets the value of the alpha mode for a specific target index.
Parameters
- value: number
The alpha mode value to set.
- targetIndex: number = 0
The index of the target to set the alpha mode for. Defaults to 0.
Returns void
- value: number
set Array2
-
Set a vec2 array in the shader from a number array.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: number[]
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Array3
-
Set a vec3 array in the shader from a number array.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: number[]
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Array4
-
Set a vec4 array in the shader from a number array.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: number[]
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Color3
-
Set a vec3 in the shader from a Color3.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: IColor3Like
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Color3 Array
-
Set a vec3 array in the shader from a IColor3Like array.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: IColor3Like[]
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Color4
-
Set a vec4 in the shader from a Color4.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: IColor4Like
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Color4 Array
-
Set a vec4 array in the shader from a IColor4Like array.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: IColor4Like[]
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Define
-
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
- define: string
the 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.
- value: string | boolean
either 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
set External Texture
-
Set an internal texture in the shader.
Parameters
- name: string
Define the name of the uniform samplers as defined in the shader
- texture: ExternalTexture
Define the texture to bind to this sampler
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Float
-
Set a float in the shader.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: number
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Floats
-
Set an array of floats in the shader.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: number[]
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Int
-
Set a int in the shader.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: number
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Internal Texture
-
Set an internal texture in the shader.
Parameters
- name: string
Define the name of the uniform samplers as defined in the shader
- texture: InternalTexture
Define the texture to bind to this sampler
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Matrices
-
Set a float32Array in the shader from a matrix array.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: Matrix[]
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Matrix
-
Set a mat4 in the shader from a Matrix.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: Matrix
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Matrix2x2
-
Set a mat2 in the shader from a Float32Array.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: number[] | Float32Array<ArrayBufferLike>
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Matrix3x3
-
Set a mat3 in the shader from a Float32Array.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: number[] | Float32Array<ArrayBufferLike>
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Pre Pass Renderer
-
Sets the required values to the prepass renderer.
Parameters
- prePassRenderer: PrePassRenderer
defines the prepass renderer to setup.
Returns boolean
true if the pre pass is needed.
- prePassRenderer: PrePassRenderer
set Quaternion
-
Set a vec4 in the shader from a Quaternion.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: Quaternion
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Quaternion Array
-
Set a vec4 array in the shader from a Quaternion array.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: Quaternion[]
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Storage Buffer
-
Set a storage buffer in the shader
Parameters
- name: string
Define the name of the storage buffer as defined in the shader
- buffer: StorageBuffer
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Texture
-
Set a texture in the shader.
Parameters
- name: string
Define the name of the uniform samplers as defined in the shader
- texture: BaseTexture
Define the texture to bind to this sampler
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Texture Array
-
Set a texture array in the shader.
Parameters
- name: string
Define the name of the uniform sampler array as defined in the shader
- textures: BaseTexture[]
Define the list of textures to bind to this sampler
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Texture Sampler
-
Set a texture sampler in the shader
Parameters
- name: string
Define the name of the uniform as defined in the shader
- sampler: TextureSampler
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set U Int
-
Set a unsigned int in the shader.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: number
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Uniform Buffer
-
Set a uniform buffer in the shader
Parameters
- name: string
Define the name of the uniform as defined in the shader
- buffer: UniformBuffer
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Vector2
-
Set a vec2 in the shader from a Vector2.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: IVector2Like
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Vector3
-
Set a vec3 in the shader from a Vector3.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: IVector3Like
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
set Vector4
-
Set a vec4 in the shader from a Vector4.
Parameters
- name: string
Define the name of the uniform as defined in the shader
- value: IVector4Like
Define the value to give to the uniform
Returns ShaderMaterial
the material itself allowing "fluent" like uniform updates
- name: string
to String
-
Returns a string representation of the current material
Parameters
OptionalfullDetails: booleandefines a boolean indicating which levels of logging is desired
Returns string
a string with material information
unbind
-
Unbinds the material from the mesh
Returns void
unfreeze
-
Unlocks updates for the material
Returns void
StaticParse Alpha Mode
-
Parses the alpha mode from the material data to parse
Parameters
- parsedMaterial: any
defines the material data to parse
- material: Material
defines the material to update
Returns void
- parsedMaterial: any
A material to use for fast depth-only rendering. 5.0.0