PBRSubSurfaceConfiguration

Define the code related to the sub surface parameters of the pbr material.

Hierarchy

  • PBRSubSurfaceConfiguration

Index

Constructors

constructor

Find examples in Playground
  • Instantiate a new istance of sub surface configuration.

    Parameters

    • markAllSubMeshesAsTexturesDirty: function

      Callback to flag the material to dirty

        • (): void
        • Returns void

    Returns PBRSubSurfaceConfiguration

Properties

diffusionDistance

Find examples in Playground
diffusionDistance: Color3

Defines how far each channel transmit through the media. It is defined as a color to simplify it selection.

disableAlphaBlending

Find examples in Playground
disableAlphaBlending: boolean

Returns true if alpha blending should be disabled.

indexOfRefraction

Find examples in Playground
indexOfRefraction: number

Defines the indice of refraction used in the material. https://en.wikipedia.org/wiki/List_of_refractive_indices

invertRefractionY

Find examples in Playground
invertRefractionY: boolean

Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.

isRefractionEnabled

Find examples in Playground
isRefractionEnabled: boolean

Defines if the refraction is enabled in the material.

isTranslucencyEnabled

Find examples in Playground
isTranslucencyEnabled: boolean

Defines if the translucency is enabled in the material.

linkRefractionWithTransparency

Find examples in Playground
linkRefractionWithTransparency: boolean

This parameters will make the material used its opacity to control how much it is refracting aginst not. Materials half opaque for instance using refraction could benefit from this control.

maximumThickness

Find examples in Playground
maximumThickness: number

Defines the maximum thickness stored in the thickness map.

minimumThickness

Find examples in Playground
minimumThickness: number

Defines the minimum thickness stored in the thickness map. If no thickness map is defined, this value will be used to simulate thickness.

refractionIntensity

Find examples in Playground
refractionIntensity: number

Defines the refraction intensity of the material. The refraction when enabled replaces the Diffuse part of the material. The intensity helps transitionning between diffuse and refraction.

refractionTexture

Find examples in Playground
refractionTexture: Nullable<BaseTexture>

Defines the texture to use for refraction.

scatteringIntensity

Find examples in Playground
scatteringIntensity: number

Defines the scattering intensity of the material. When scattering has been enabled, this defines how much of the "scattered light" is addded to the diffuse part of the material.

thicknessTexture

Find examples in Playground
thicknessTexture: Nullable<BaseTexture>

Stores the average thickness of a mesh in a texture (The texture is holding the values linearly). The red channel of the texture should contain the thickness remapped between 0 and 1. 0 would mean minimumThickness 1 would mean maximumThickness The other channels might be use as a mask to vary the different effects intensity.

tintColor

Find examples in Playground
tintColor: Color3

Defines the volume tint of the material. This is used for both translucency and scattering.

tintColorAtDistance

Find examples in Playground
tintColorAtDistance: number

Defines the distance at which the tint color should be found in the media. This is used for refraction only.

translucencyIntensity

Find examples in Playground
translucencyIntensity: number

Defines the translucency intensity of the material. When translucency has been enabled, this defines how much of the "translucency" is addded to the diffuse part of the material.

useMaskFromThicknessTexture

Find examples in Playground
useMaskFromThicknessTexture: boolean

Stores the intensity of the different subsurface effects in the thickness texture.

  • the green channel is the translucency intensity.
  • the blue channel is the scattering intensity.
  • the alpha channel is the refraction intensity.

Methods

bindForSubMesh

Find examples in Playground
  • bindForSubMesh(uniformBuffer: UniformBuffer, scene: Scene, engine: Engine, isFrozen: boolean, lodBasedMicrosurface: boolean): void
  • Binds the material data.

    Parameters

    • uniformBuffer: UniformBuffer

      defines the Uniform buffer to fill in.

    • scene: Scene

      defines the scene the material belongs to.

    • engine: Engine

      defines the engine the material belongs to.

    • isFrozen: boolean

      defines wether the material is frozen or not.

    • lodBasedMicrosurface: boolean

      defines wether the material relies on lod based microsurface or not.

    Returns void

copyTo

Find examples in Playground
  • Makes a duplicate of the current configuration into another one.

    Parameters

    Returns void

dispose

Find examples in Playground
  • dispose(forceDisposeTextures?: boolean): void
  • Disposes the resources of the material.

    Parameters

    • Optional forceDisposeTextures: boolean

      Forces the disposal of all textures.

    Returns void

fillRenderTargetTextures

Find examples in Playground
  • Fills the list of render target textures.

    Parameters

    Returns void

getActiveTextures

Find examples in Playground
  • getActiveTextures(activeTextures: BaseTexture[]): void
  • Returns an array of the actively used textures.

    Parameters

    Returns void

getAnimatables

Find examples in Playground
  • Returns the animatable textures.

    Parameters

    • animatables: IAnimatable[]

      Array of animatable textures.

    Returns void

getClassName

Find examples in Playground
  • getClassName(): string
  • Get the current class name of the texture useful for serialization or dynamic coding.

    Returns string

    "PBRSubSurfaceConfiguration"

hasRenderTargetTextures

Find examples in Playground
  • hasRenderTargetTextures(): boolean
  • Gets a boolean indicating that current material needs to register RTT

    Returns boolean

    true if this uses a render target otherwise false.

hasTexture

Find examples in Playground
  • Checks to see if a texture is used in the material.

    Parameters

    Returns boolean

    • Boolean specifying if a texture is used in the material.

isReadyForSubMesh

Find examples in Playground
  • isReadyForSubMesh(defines: IMaterialSubSurfaceDefines, scene: Scene): boolean
  • Gets wehter the submesh is ready to be used or not.

    Parameters

    • defines: IMaterialSubSurfaceDefines

      the list of "defines" to update.

    • scene: Scene

      defines the scene the material belongs to.

    Returns boolean

    • boolean indicating that the submesh is ready or not.

parse

Find examples in Playground
  • parse(source: any): void
  • Parses a Sub Surface Configuration from a serialized object.

    Parameters

    • source: any

      Serialized object.

    Returns void

prepareDefines

Find examples in Playground
  • prepareDefines(defines: IMaterialSubSurfaceDefines, scene: Scene): void
  • Checks to see if a texture is used in the material.

    Parameters

    • defines: IMaterialSubSurfaceDefines

      the list of "defines" to update.

    • scene: Scene

      defines the scene to the material belongs to.

    Returns void

serialize

Find examples in Playground
  • serialize(): any
  • Serializes this Sub Surface configuration.

    Returns any

    • An object with the serialized config.

unbind

Find examples in Playground
  • unbind(activeEffect: Effect): boolean
  • Unbinds the material from the mesh.

    Parameters

    • activeEffect: Effect

      defines the effect that should be unbound from.

    Returns boolean

    true if unbound, otherwise false

Static AddFallbacks

Find examples in Playground
  • AddFallbacks(defines: IMaterialSubSurfaceDefines, fallbacks: EffectFallbacks, currentRank: number): number
  • Add fallbacks to the effect fallbacks list.

    Parameters

    • defines: IMaterialSubSurfaceDefines

      defines the Base texture to use.

    • fallbacks: EffectFallbacks

      defines the current fallback list.

    • currentRank: number

      defines the current fallback rank.

    Returns number

    the new fallback rank.

Static AddSamplers

Find examples in Playground
  • AddSamplers(samplers: string[]): void
  • Add the required samplers to the current list.

    Parameters

    • samplers: string[]

      defines the current sampler list.

    Returns void

Static AddUniforms

Find examples in Playground
  • AddUniforms(uniforms: string[]): void
  • Add the required uniforms to the current list.

    Parameters

    • uniforms: string[]

      defines the current uniform list.

    Returns void

Static PrepareUniformBuffer

Find examples in Playground
  • Add the required uniforms to the current buffer.

    Parameters

    • uniformBuffer: UniformBuffer

      defines the current uniform buffer.

    Returns void

Generated using TypeDoc