ColorGradingTexture

This represents a color grading texture. This acts as a lookup table LUT, useful during post process It can help converting any input color in a desired output one. This can then be used to create effects from sepia, black and white to sixties or futuristic rendering...

The only supported format is currently 3dl. More information on LUT: https://en.wikipedia.org/wiki/3D_lookup_table

Hierarchy

Index

Constructors

constructor

  • Instantiates a ColorGradingTexture from the following parameters.

    Parameters

    • url: string

      The location of the color gradind data (currently only supporting 3dl)

    • scene: Scene

      The scene the texture will be used in

    Returns ColorGradingTexture

Properties

animations

animations: Animation[]

Define the list of animation attached to the texture.

anisotropicFilteringLevel

anisotropicFilteringLevel: number

With compliant hardware and browser (supporting anisotropic filtering) this defines the level of anisotropic filtering in the texture. The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.

canRescale

canRescale: boolean

Get if the texture can rescale.

coordinatesIndex

coordinatesIndex: number

Define the UV chanel to use starting from 0 and defaulting to 0. This is part of the texture as textures usually maps to one uv set.

coordinatesMode

coordinatesMode: number

How a texture is mapped.

Value Type Description
0 EXPLICIT_MODE
1 SPHERICAL_MODE
2 PLANAR_MODE
3 CUBIC_MODE
4 PROJECTION_MODE
5 SKYBOX_MODE
6 INVCUBIC_MODE
7 EQUIRECTANGULAR_MODE
8 FIXED_EQUIRECTANGULAR_MODE
9 FIXED_EQUIRECTANGULAR_MIRRORED_MODE

delayLoadState

delayLoadState: number

Define the current state of the loading sequence when in delayed load mode.

gammaSpace

gammaSpace: boolean

Define if the texture contains data in gamma space (most of the png/jpg aside bump). HDR texture are usually stored in linear space. This only impacts the PBR and Background materials

getAlphaFromRGB

getAlphaFromRGB: boolean

Defines if the alpha value should be determined via the rgb values. If true the luminance of the pixel might be used to find the corresponding alpha value.

hasAlpha

hasAlpha: boolean

Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).

invertZ

invertZ: boolean

Is Z inverted in the texture (useful in a cube texture).

is3D

is3D: boolean

Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.

isBlocking

isBlocking: boolean

Define if the texture is preventinga material to render or not. If not and the texture is not ready, the engine will use a default black texture instead.

isCube

isCube: boolean

Define if the texture is a cube texture or if false a 2d texture.

isRGBD

isRGBD: boolean

Gets whether or not the texture contains RGBD data.

isRenderTarget

isRenderTarget: boolean

Define if the texture is a render target.

level

level: number

Intensity or strength of the texture. It is commonly used by materials to fine tune the intensity of the texture

lodGenerationOffset

lodGenerationOffset: number

With prefiltered texture, defined the offset used during the prefiltering steps.

lodGenerationScale

lodGenerationScale: number

With prefiltered texture, defined the scale used during the prefiltering steps.

name

name: string

Define the name of the texture.

onDispose

onDispose: function

Callback triggered when the texture has been disposed. Kept for back compatibility, you can use the onDisposeObservable instead.

Type declaration

    • (): void
    • Returns void

onDisposeObservable

onDisposeObservable: Observable<BaseTexture>

An event triggered when the texture is disposed.

sphericalPolynomial

sphericalPolynomial: Nullable<SphericalPolynomial>

Get the polynomial representation of the texture data. This is mainly use as a fast way to recover IBL Diffuse irradiance data.

see

https://learnopengl.com/PBR/IBL/Diffuse-irradiance

textureFormat

textureFormat: number

Get the texture underlying format (RGB, RGBA...)

textureType

textureType: number

Get the texture underlying type (INT, FLOAT...)

uid

uid: string

Define the unique id of the texture in the scene.

url

url: string

The texture URL.

wrapR

wrapR: number
Value Type Description
0 CLAMP_ADDRESSMODE
1 WRAP_ADDRESSMODE
2 MIRROR_ADDRESSMODE

wrapU

wrapU: number
Value Type Description
0 CLAMP_ADDRESSMODE
1 WRAP_ADDRESSMODE
2 MIRROR_ADDRESSMODE

wrapV

wrapV: number
Value Type Description
0 CLAMP_ADDRESSMODE
1 WRAP_ADDRESSMODE
2 MIRROR_ADDRESSMODE

Static DEFAULT_ANISOTROPIC_FILTERING_LEVEL

DEFAULT_ANISOTROPIC_FILTERING_LEVEL: number

Default anisotropic filtering level for the application. It is set to 4 as a good tradeoff between perf and quality.

Methods

clone

delayLoad

  • delayLoad(): void
  • Called during delayed load for textures.

    Returns void

dispose

  • dispose(): void
  • Dispose the texture and release its associated resources.

    Returns void

getBaseSize

  • Get the base size of the texture. It can be different from the size if the texture has been resized for POT for instance

    Returns ISize

    the base size

getClassName

  • getClassName(): string
  • Get the class name of the texture.

    Returns string

    "BaseTexture"

getInternalTexture

getReflectionTextureMatrix

  • getReflectionTextureMatrix(): Matrix

getScene

  • Get the scene the texture belongs to.

    Returns Nullable<Scene>

    the scene or null if undefined

getSize

  • Get the size of the texture.

    Returns ISize

    the texture size.

getTextureMatrix

  • Returns the texture matrix used in most of the material. This is not used in color grading but keep for troubleshooting purpose (easily swap diffuse by colorgrading to look in).

    Returns Matrix

isReady

  • isReady(): boolean
  • Get if the texture is ready to be used (downloaded, converted, mip mapped...).

    Returns boolean

    true if fully ready

isReadyOrNotBlocking

  • isReadyOrNotBlocking(): boolean
  • Get if the texture is ready to be consumed (either it is ready or it is not blocking)

    Returns boolean

    true if ready or not blocking

readPixels

  • readPixels(faceIndex?: number, level?: number, buffer?: Nullable<ArrayBufferView>): Nullable<ArrayBufferView>
  • Reads the pixels stored in the webgl texture and returns them as an ArrayBuffer. This will returns an RGBA array buffer containing either in values (0-255) or float values (0-1) depending of the underlying buffer type.

    Parameters

    • Optional faceIndex: number

      defines the face of the texture to read (in case of cube texture)

    • Optional level: number

      defines the LOD level of the texture to read (in case of Mip Maps)

    • Optional buffer: Nullable<ArrayBufferView>

      defines a user defined buffer to fill with data (can be null)

    Returns Nullable<ArrayBufferView>

    The Array buffer containing the pixels data.

releaseInternalTexture

  • releaseInternalTexture(): void
  • Release and destroy the underlying lower level texture aka internalTexture.

    Returns void

scale

  • scale(ratio: number): void
  • Scales the texture if is canRescale()

    Parameters

    • ratio: number

      the resize factor we want to use to rescale

    Returns void

serialize

  • serialize(): any
  • Serializes the LUT texture to json format.

    Returns any

toString

  • toString(): string
  • Return a string representation of the texture.

    Returns string

    the texture as a string

Static Parse

  • Parses a color grading texture serialized by Babylon.

    Parameters

    • parsedTexture: any

      The texture information being parsedTexture

    • scene: Scene

      The scene to load the texture in

    • rootUrl: string

      The root url of the data assets to load

    Returns Nullable<ColorGradingTexture>

    A color gradind texture

Static WhenAllReady

  • WhenAllReady(textures: BaseTexture[], callback: function): void
  • Helper function to be called back once a list of texture contains only ready textures.

    Parameters

    • textures: BaseTexture[]

      Define the list of textures to wait for

    • callback: function

      Define the callback triggered once the entire list will be ready

        • (): void
        • Returns void

    Returns void

Generated using TypeDoc