Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HDRCubeTexture

This represents a texture coming from an HDR input.

The only supported format is currently panorama picture stored in RGBE format. Example of such files can be found on Poly Haven: https://polyhaven.com/hdris

Hierarchy

Implements

Index

Constructors

constructor

  • new HDRCubeTexture(url: string, sceneOrEngine: Scene | ThinEngine, size: number, noMipmap?: boolean, generateHarmonics?: boolean, gammaSpace?: boolean, prefilterOnLoad?: boolean, onLoad?: Nullable<() => void>, onError?: Nullable<(message?: string, exception?: any) => void>): HDRCubeTexture
  • Instantiates an HDRTexture from the following parameters.

    Parameters

    • url: string

      The location of the HDR raw data (Panorama stored in RGBE format)

    • sceneOrEngine: Scene | ThinEngine

      The scene or engine the texture will be used in

    • size: number

      The cubemap desired size (the more it increases the longer the generation will be)

    • Optional noMipmap: boolean

      Forces to not generate the mipmap if true

    • Optional generateHarmonics: boolean

      Specifies whether you want to extract the polynomial harmonics during the generation process

    • Optional gammaSpace: boolean

      Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)

    • Optional prefilterOnLoad: boolean

      Prefilters HDR texture to allow use of this texture as a PBR reflection texture.

    • Optional onLoad: Nullable<() => void>
    • Optional onError: Nullable<(message?: string, exception?: any) => void>

    Returns HDRCubeTexture

Properties

animationsSearch playground for animations

animations: Animation[]

Define the list of animation attached to the texture.

anisotropicFilteringLevelSearch playground for 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.

boundingBoxPositionSearch playground for boundingBoxPosition

boundingBoxPosition: Vector3

Gets or sets the center of the bounding box associated with the cube texture It must define where the camera used to render the texture was set

delayLoadStateSearch playground for delayLoadState

delayLoadState: number

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

invertZSearch playground for invertZ

invertZ: boolean

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

isRenderTargetSearch playground for isRenderTarget

isRenderTarget: boolean

Define if the texture is a render target.

levelSearch playground for level

level: number

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

metadataSearch playground for metadata

metadata: any

Gets or sets an object used to store user defined information.

nameSearch playground for name

name: string

Define the name of the texture.

onDisposeObservableSearch playground for onDisposeObservable

onDisposeObservable: Observable<BaseTexture>

An event triggered when the texture is disposed.

onLoadObservableSearch playground for onLoadObservable

onLoadObservable: Observable<HDRCubeTexture>

Observable triggered once the texture has been loaded.

reservedDataStoreSearch playground for reservedDataStore

reservedDataStore: any

For internal use only. Please do not use.

sphericalPolynomialSearch playground for 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

uniqueIdSearch playground for uniqueId

uniqueId: number

Gets or sets the unique id of the texture

urlSearch playground for url

url: string

The texture URL.

wrapRSearch playground for wrapR

wrapR: number
ValueTypeDescription
0CLAMP_ADDRESSMODE
1WRAP_ADDRESSMODE
2MIRROR_ADDRESSMODE

Static DEFAULT_ANISOTROPIC_FILTERING_LEVELSearch playground for 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.

Accessors

boundingBoxSize

  • get boundingBoxSize(): Vector3
  • set boundingBoxSize(value: Vector3): any

canRescale

  • get canRescale(): boolean
  • Get if the texture can rescale.

    Returns boolean

coordinatesIndex

  • get coordinatesIndex(): number
  • set coordinatesIndex(value: number): any
  • Define the UV channel to use starting from 0 and defaulting to 0. This is part of the texture as textures usually maps to one uv set.

    Returns number

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

    Parameters

    • value: number

    Returns any

coordinatesMode

  • get coordinatesMode(): number
  • set coordinatesMode(value: number): any
  • How a texture is mapped.

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

    Returns number

  • How a texture is mapped.

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

    Parameters

    • value: number

    Returns any

errorObject

  • get errorObject(): { exception?: any; message?: string } | undefined
  • If a loading error occurred this object will be populated with information about the error.

    Returns { exception?: any; message?: string } | undefined

gammaSpace

  • get gammaSpace(): boolean
  • set gammaSpace(gamma: boolean): any
  • 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

    Returns 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

    Parameters

    • gamma: boolean

    Returns any

getAlphaFromRGB

  • get getAlphaFromRGB(): boolean
  • set getAlphaFromRGB(value: boolean): any
  • 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.

    Returns 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.

    Parameters

    • value: boolean

    Returns any

hasAlpha

  • get hasAlpha(): boolean
  • set hasAlpha(value: boolean): any
  • Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).

    Returns boolean

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

    Parameters

    • value: boolean

    Returns any

irradianceTexture

  • In case a better definition than spherical harmonics is required for the diffuse part of the environment. You can set the irradiance texture to rely on a texture instead of the spherical approach. This texture need to have the same characteristics than its parent (Cube vs 2d, coordinates mode, Gamma/Linear, RGBD).

    Returns Nullable<BaseTexture>

  • In case a better definition than spherical harmonics is required for the diffuse part of the environment. You can set the irradiance texture to rely on a texture instead of the spherical approach. This texture need to have the same characteristics than its parent (Cube vs 2d, coordinates mode, Gamma/Linear, RGBD).

    Parameters

    Returns any

is2DArray

  • get is2DArray(): boolean
  • set is2DArray(value: boolean): any

is3D

  • get is3D(): boolean
  • set is3D(value: boolean): any
  • Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.

    Returns boolean

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

    Parameters

    • value: boolean

    Returns any

isBlocking

  • get isBlocking(): boolean
  • set isBlocking(value: boolean): any
  • Gets whether or not the texture is blocking during loading.

    Returns boolean

  • Sets whether or not the texture is blocking during loading.

    Parameters

    • value: boolean

    Returns any

isCube

  • get isCube(): boolean
  • set isCube(value: boolean): any

isRGBD

  • get isRGBD(): boolean
  • set isRGBD(value: boolean): any
  • Gets or sets whether or not the texture contains RGBD data.

    Returns boolean

  • Gets or sets whether or not the texture contains RGBD data.

    Parameters

    • value: boolean

    Returns any

linearSpecularLOD

  • get linearSpecularLOD(): boolean
  • set linearSpecularLOD(value: boolean): any
  • With prefiltered texture, defined if the specular generation is based on a linear ramp. By default we are using a log2 of the linear roughness helping to keep a better resolution for average roughness values.

    Returns boolean

  • With prefiltered texture, defined if the specular generation is based on a linear ramp. By default we are using a log2 of the linear roughness helping to keep a better resolution for average roughness values.

    Parameters

    • value: boolean

    Returns any

loadingError

  • get loadingError(): boolean
  • Was there any loading error?

    Returns boolean

lodGenerationOffset

  • get lodGenerationOffset(): number
  • set lodGenerationOffset(value: number): any
  • With prefiltered texture, defined the offset used during the prefiltering steps.

    Returns number

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

    Parameters

    • value: number

    Returns any

lodGenerationScale

  • get lodGenerationScale(): number
  • set lodGenerationScale(value: number): any
  • With prefiltered texture, defined the scale used during the prefiltering steps.

    Returns number

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

    Parameters

    • value: number

    Returns any

noMipmap

  • get noMipmap(): boolean
  • Are mip maps generated for this texture or not.

    Returns boolean

onDispose

  • set onDispose(callback: () => void): any
  • Callback triggered when the texture has been disposed. Kept for back compatibility, you can use the onDisposeObservable instead.

    Parameters

    • callback: () => void
        • (): void
        • Returns void

    Returns any

rotationY

  • get rotationY(): number
  • set rotationY(value: number): any
  • Gets texture matrix rotation angle around Y axis radians.

    Returns number

  • Sets texture matrix rotation angle around Y axis in radians.

    Parameters

    • value: number

    Returns any

samplingMode

  • get samplingMode(): number
  • Get the current sampling mode associated with the texture.

    Returns number

textureFormat

  • get textureFormat(): number
  • Get the texture underlying format (RGB, RGBA...)

    Returns number

textureType

  • get textureType(): number
  • Get the texture underlying type (INT, FLOAT...)

    Returns number

uid

  • get uid(): string
  • Define the unique id of the texture in the scene.

    Returns string

wrapU

  • get wrapU(): number
  • set wrapU(value: number): any

wrapV

  • get wrapV(): number
  • set wrapV(value: number): any

Methods

checkTransformsAreIdenticalSearch playground for checkTransformsAreIdentical

  • Checks if the texture has the same transform matrix than another texture

    Parameters

    Returns boolean

    true if the transforms are the same, else false

cloneSearch playground for clone

delayLoadSearch playground for delayLoad

  • delayLoad(): void

disposeSearch playground for dispose

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

    Returns void

forceSphericalPolynomialsRecomputeSearch playground for forceSphericalPolynomialsRecompute

  • forceSphericalPolynomialsRecompute(): void
  • Force recomputation of spherical polynomials. Can be useful if you generate a cubemap multiple times (from a probe for eg) and you need the proper polynomials each time

    Returns void

getBaseSizeSearch playground for 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

getClassNameSearch playground for getClassName

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

    Returns string

    "HDRCubeTexture"

getInternalTextureSearch playground for getInternalTexture

getReflectionTextureMatrixSearch playground for getReflectionTextureMatrix

  • getReflectionTextureMatrix(): Matrix

getSceneSearch playground for getScene

  • Get the scene the texture belongs to.

    Returns Nullable<Scene>

    the scene or null if undefined

getSizeSearch playground for getSize

  • Get the size of the texture.

    Returns ISize

    the texture size.

getTextureMatrixSearch playground for getTextureMatrix

  • Get the texture transform matrix used to offset tile the texture for instance.

    Returns Matrix

    the transformation matrix

isReadySearch playground for isReady

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

    Returns boolean

    true if fully ready

isReadyOrNotBlockingSearch playground for 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, not blocking or if there was an error loading the texture

readPixelsSearch playground for readPixels

  • readPixels(faceIndex?: number, level?: number, buffer?: Nullable<ArrayBufferView>, flushRenderer?: boolean, noDataConversion?: boolean, x?: number, y?: number, width?: number, height?: number): Nullable<Promise<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)

    • Optional flushRenderer: boolean

      true to flush the renderer from the pending commands before reading the pixels

    • Optional noDataConversion: boolean

      false to convert the data to Uint8Array (if texture type is UNSIGNED_BYTE) or to Float32Array (if texture type is anything but UNSIGNED_BYTE). If true, the type of the generated buffer (if buffer==null) will depend on the type of the texture

    • Optional x: number

      defines the region x coordinates to start reading from (default to 0)

    • Optional y: number

      defines the region y coordinates to start reading from (default to 0)pe is UNSIGNED_BYTE) or to Float32Array (if texture type is anything but UNSIGNED_BYTE). If true, the type of the generated buffer (if buffer==null) will depend on the type of the texture

    • Optional width: number

      defines the region width to read from (default to the texture size at level)

    • Optional height: number

      defines the region width to read from (default to the texture size at level)

    Returns Nullable<Promise<ArrayBufferView>>

    The Array buffer promise containing the pixels data.

releaseInternalTextureSearch playground for releaseInternalTexture

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

    Returns void

scaleSearch playground for 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

serializeSearch playground for serialize

  • serialize(): any

setReflectionTextureMatrixSearch playground for setReflectionTextureMatrix

  • setReflectionTextureMatrix(value: Matrix): void
  • Set the texture reflection matrix used to rotate/transform the reflection.

    Parameters

    • value: Matrix

      Define the reflection matrix to set

    Returns void

toStringSearch playground for toString

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

    Returns string

    the texture as a string

updateSamplingModeSearch playground for updateSamplingMode

  • updateSamplingMode(samplingMode: number): void
  • Update the sampling mode of the texture. Default is Trilinear mode.

    ValueTypeDescription
    1NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEARNearest is: mag = nearest, min = nearest, mip = linear
    2BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEARESTBilinear is: mag = linear, min = linear, mip = nearest
    3TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEARTrilinear is: mag = linear, min = linear, mip = linear
    4NEAREST_NEAREST_MIPNEAREST
    5NEAREST_LINEAR_MIPNEAREST
    6NEAREST_LINEAR_MIPLINEAR
    7NEAREST_LINEAR
    8NEAREST_NEAREST
    9LINEAR_NEAREST_MIPNEAREST
    10LINEAR_NEAREST_MIPLINEAR
    11LINEAR_LINEAR
    12LINEAR_NEAREST

    mag: magnification filter (close to the viewer) min: minification filter (far from the viewer) mip: filter used between mip map levels

    Parameters

    • samplingMode: number

      Define the new sampling mode of the texture

    Returns void

Static ParseSearch playground for Parse

  • Parses a JSON representation of an HDR Texture in order to create the texture

    Parameters

    • parsedTexture: any

      Define the JSON representation

    • scene: Scene

      Define the scene the texture should be created in

    • rootUrl: string

      Define the root url in case we need to load relative dependencies

    Returns Nullable<HDRCubeTexture>

    the newly created texture after parsing

Static WhenAllReadySearch playground for WhenAllReady

  • WhenAllReady(textures: BaseTexture[], callback: () => void): 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: () => void

      Define the callback triggered once the entire list will be ready

        • (): void
        • Returns void

    Returns void

Legend

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