Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PBRSubSurfaceConfiguration

Plugin that implements the sub surface component of the PBR material

Hierarchy

Index

Constructors

constructor

Properties

diffusionDistanceSearch playground for diffusionDistance

diffusionDistance: Color3

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

indexOfRefractionSearch playground for indexOfRefraction

indexOfRefraction: number

Index of refraction of the material base layer. https://en.wikipedia.org/wiki/List_of_refractive_indices

This does not only impact refraction but also the Base F0 of Dielectric Materials.

From dielectric fresnel rules: F0 = square((iorT - iorI) / (iorT + iorI))

invertRefractionYSearch playground for invertRefractionY

invertRefractionY: boolean

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

isRefractionEnabledSearch playground for isRefractionEnabled

isRefractionEnabled: boolean

Defines if the refraction is enabled in the material.

isScatteringEnabledSearch playground for isScatteringEnabled

isScatteringEnabled: boolean

Defines if the sub surface scattering is enabled in the material.

isTranslucencyEnabledSearch playground for isTranslucencyEnabled

isTranslucencyEnabled: boolean

Defines if the translucency is enabled in the material.

linkRefractionWithTransparencySearch playground for linkRefractionWithTransparency

linkRefractionWithTransparency: boolean

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

Readonly markAllDefinesAsDirtySearch playground for markAllDefinesAsDirty

markAllDefinesAsDirty: () => void

Helper function to mark defines as being dirty.

Type declaration

    • (): void
    • Returns void

maximumThicknessSearch playground for maximumThickness

maximumThickness: number

Defines the maximum thickness stored in the thickness map.

minimumThicknessSearch playground for minimumThickness

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.

nameSearch playground for name

name: string

Defines the name of the plugin

prioritySearch playground for priority

priority: number

Defines the priority of the plugin. Lower numbers run first.

refractionIntensitySearch playground for refractionIntensity

refractionIntensity: number

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

refractionIntensityTextureSearch playground for refractionIntensityTexture

refractionIntensityTexture: Nullable<BaseTexture>

Stores the intensity of the refraction. If provided, it takes precedence over thicknessTexture + useMaskFromThicknessTexture

  • the green (red if useGltfStyleTextures = true) channel is the refraction intensity.

refractionTextureSearch playground for refractionTexture

refractionTexture: Nullable<BaseTexture>

Defines the texture to use for refraction.

registerForExtraEventsSearch playground for registerForExtraEvents

registerForExtraEvents: boolean

Indicates that this plugin should be notified for the extra events (HasRenderTargetTextures / FillRenderTargetTextures / HardBindForSubMesh)

thicknessTextureSearch playground for thicknessTexture

thicknessTexture: Nullable<BaseTexture>

Stores the average thickness of a mesh in a texture (The texture is holding the values linearly). The red (or green if useGltfStyleTextures=true) 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.

tintColorSearch playground for tintColor

tintColor: Color3

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

tintColorAtDistanceSearch playground for tintColorAtDistance

tintColorAtDistance: number

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

translucencyIntensitySearch playground for translucencyIntensity

translucencyIntensity: number

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

translucencyIntensityTextureSearch playground for translucencyIntensityTexture

translucencyIntensityTexture: Nullable<BaseTexture>

Stores the intensity of the translucency. If provided, it takes precedence over thicknessTexture + useMaskFromThicknessTexture

  • the blue channel is the translucency intensity.

useAlbedoToTintRefractionSearch playground for useAlbedoToTintRefraction

useAlbedoToTintRefraction: boolean

When enabled, transparent surfaces will be tinted with the albedo colour (independent of thickness)

useAlbedoToTintTranslucencySearch playground for useAlbedoToTintTranslucency

useAlbedoToTintTranslucency: boolean

When enabled, translucent surfaces will be tinted with the albedo colour (independent of thickness)

useGltfStyleTexturesSearch playground for useGltfStyleTextures

useGltfStyleTextures: boolean

Use channels layout used by glTF:

  • thicknessTexture: the green (instead of red) channel is the thickness
  • thicknessTexture/refractionIntensityTexture: the red (instead of green) channel is the refraction intensity
  • thicknessTexture/translucencyIntensityTexture: no change, use the blue channel for the translucency intensity

useMaskFromThicknessTextureSearch playground for useMaskFromThicknessTexture

useMaskFromThicknessTexture: boolean

Stores the intensity of the different subsurface effects in the thickness texture. Note that if refractionIntensityTexture and/or translucencyIntensityTexture is provided it takes precedence over thicknessTexture + useMaskFromThicknessTexture

  • the green (red if useGltfStyleTextures = true) channel is the refraction intensity.
  • the blue channel is the translucency intensity.

useThicknessAsDepthSearch playground for useThicknessAsDepth

useThicknessAsDepth: boolean

Defines that the thickness should be used as a measure of the depth volume.

Accessors

disableAlphaBlending

  • get disableAlphaBlending(): boolean
  • Returns true if alpha blending should be disabled.

    Returns boolean

scatteringDiffusionProfile

  • Diffusion profile for subsurface scattering. Useful for better scattering in the skins or foliages.

    Returns Nullable<Color3>

  • Diffusion profile for subsurface scattering. Useful for better scattering in the skins or foliages.

    Parameters

    Returns any

volumeIndexOfRefraction

  • get volumeIndexOfRefraction(): number
  • set volumeIndexOfRefraction(value: number): any
  • Index of refraction of the material's volume. https://en.wikipedia.org/wiki/List_of_refractive_indices

    This ONLY impacts refraction. If not provided or given a non-valid value, the volume will use the same IOR as the surface.

    Returns number

  • Index of refraction of the material's volume. https://en.wikipedia.org/wiki/List_of_refractive_indices

    This ONLY impacts refraction. If not provided or given a non-valid value, the volume will use the same IOR as the surface.

    Parameters

    • value: number

    Returns any

Methods

addFallbacksSearch playground for addFallbacks

  • addFallbacks(defines: MaterialSubSurfaceDefines, fallbacks: EffectFallbacks, currentRank: number): number

bindForSubMeshSearch playground for bindForSubMesh

collectDefinesSearch playground for collectDefines

  • collectDefines(defines: {}): void
  • Collects all defines.

    Parameters

    • defines: {}

      The object to append to.

      • [name: string]: { default: any; type: string }
        • default: any
        • type: string

    Returns void

copyToSearch playground for copyTo

  • Makes a duplicate of the current configuration into another one.

    Parameters

    Returns void

disposeSearch playground for dispose

  • dispose(forceDisposeTextures?: boolean): void
  • Parameters

    • Optional forceDisposeTextures: boolean

    Returns void

fillRenderTargetTexturesSearch playground for fillRenderTargetTextures

getActiveTexturesSearch playground for getActiveTextures

  • getActiveTextures(activeTextures: BaseTexture[]): void

getAnimatablesSearch playground for getAnimatables

getAttributesSearch playground for getAttributes

  • Gets the attributes used by the plugin.

    Parameters

    • attributes: string[]

      list that the attribute names should be added to.

    • scene: Scene

      the scene that the material belongs to.

    • mesh: AbstractMesh

      the mesh being rendered.

    Returns void

getClassNameSearch playground for getClassName

  • getClassName(): string

getCustomCodeSearch playground for getCustomCode

  • getCustomCode(shaderType: string): Nullable<{}>
  • Returns a list of custom shader code fragments to customize the shader.

    Parameters

    • shaderType: string

      "vertex" or "fragment"

    Returns Nullable<{}>

    null if no code to be added, or a list of pointName => code. Note that pointName can also be a regular expression if it starts with a !. In that case, the string found by the regular expression (if any) will be replaced by the code provided.

getSamplersSearch playground for getSamplers

  • getSamplers(samplers: string[]): void

getUniformBuffersNamesSearch playground for getUniformBuffersNames

  • getUniformBuffersNames(ubos: string[]): void
  • Gets the uniform buffers names added by the plugin.

    Parameters

    • ubos: string[]

      list that the ubo names should be added to.

    Returns void

getUniformsSearch playground for getUniforms

  • getUniforms(): { fragment?: string; ubo?: Array<{ name: string; size: number; type: string }>; vertex?: string }
  • Returns { fragment?: string; ubo?: Array<{ name: string; size: number; type: string }>; vertex?: string }

    • Optional fragment?: string
    • Optional ubo?: Array<{ name: string; size: number; type: string }>
    • Optional vertex?: string

hardBindForSubMeshSearch playground for hardBindForSubMesh

  • Binds the material data (this function is called even if mustRebind() returns false)

    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.

    • subMesh: SubMesh

      the submesh to bind data for

    Returns void

hasRenderTargetTexturesSearch playground for hasRenderTargetTextures

  • hasRenderTargetTextures(): boolean

hasTextureSearch playground for hasTexture

isReadyForSubMeshSearch playground for isReadyForSubMesh

  • isReadyForSubMesh(defines: MaterialSubSurfaceDefines, scene: Scene): boolean

parseSearch playground for parse

  • parse(source: any, scene: Scene, rootUrl: string): void
  • Parses a anisotropy Configuration from a serialized object.

    Parameters

    • source: any

      Serialized object.

    • scene: Scene

      Defines the scene we are parsing for

    • rootUrl: string

      Defines the rootUrl to load from

    Returns void

prepareDefinesSearch playground for prepareDefines

  • prepareDefines(defines: MaterialSubSurfaceDefines, scene: Scene): void

prepareDefinesBeforeAttributesSearch playground for prepareDefinesBeforeAttributes

serializeSearch playground for serialize

  • serialize(): any
  • Serializes this clear coat configuration.

    Returns any

    • An object with the serialized config.

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method