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 HDRLib: http://hdrlib.com/

Hierarchy

Index

Constructors

constructor

Find examples in Playground
  • new HDRCubeTexture(url: string, scene: Scene, size: number, noMipmap?: boolean, generateHarmonics?: boolean, gammaSpace?: boolean, reserved?: boolean, onLoad?: Nullable<function>, onError?: Nullable<function>): HDRCubeTexture
  • Instantiates an HDRTexture from the following parameters.

    Parameters

    • url: string

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

    • scene: Scene

      The scene 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 reserved: boolean

      Reserved flag for internal use.

    • Optional onLoad: Nullable<function>
    • Optional onError: Nullable<function>

    Returns HDRCubeTexture

Properties

animations

Find examples in Playground
animations: Animation[]

Define the list of animation attached to the texture.

anisotropicFilteringLevel

Find examples in Playground
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.

boundingBoxPosition

Find examples in Playground
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

boundingBoxSize

Find examples in Playground
boundingBoxSize: Vector3

Gets or sets the size of the bounding box associated with the cube texture When defined, the cubemap will switch to local mode

see

https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity

example

https://www.babylonjs-playground.com/#RNASML

canRescale

Find examples in Playground
canRescale: boolean

Get if the texture can rescale.

coordinatesIndex

Find examples in Playground
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

Find examples in Playground
coordinatesMode: number

The texture coordinates mode. As this texture is stored in a cube format, please modify carefully.

delayLoadState

Find examples in Playground
delayLoadState: number

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

gammaSpace

Find examples in Playground
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

Find examples in Playground
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

Find examples in Playground
hasAlpha: boolean

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

invertZ

Find examples in Playground
invertZ: boolean

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

is3D

Find examples in Playground
is3D: boolean

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

isBlocking

Find examples in Playground
isBlocking: boolean

Gets wether or not the texture is blocking during loading.

isCube

Find examples in Playground
isCube: boolean

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

isRGBD

Find examples in Playground
isRGBD: boolean

Gets whether or not the texture contains RGBD data.

isRenderTarget

Find examples in Playground
isRenderTarget: boolean

Define if the texture is a render target.

level

Find examples in Playground
level: number

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

lodGenerationOffset

Find examples in Playground
lodGenerationOffset: number

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

lodGenerationScale

Find examples in Playground
lodGenerationScale: number

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

metadata

Find examples in Playground
metadata: any

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

name

Find examples in Playground
name: string

Define the name of the texture.

noMipmap

Find examples in Playground
noMipmap: boolean

Are mip maps generated for this texture or not.

onDispose

Find examples in Playground
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

Find examples in Playground
onDisposeObservable: Observable<BaseTexture>

An event triggered when the texture is disposed.

reservedDataStore

Find examples in Playground
reservedDataStore: any

For internal use only. Please do not use.

rotationY

Find examples in Playground
rotationY: number

Gets texture matrix rotation angle around Y axis radians.

sphericalPolynomial

Find examples in Playground
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

Find examples in Playground
textureFormat: number

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

textureType

Find examples in Playground
textureType: number

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

uid

Find examples in Playground
uid: string

Define the unique id of the texture in the scene.

uniqueId

Find examples in Playground
uniqueId: number

Gets or sets the unique id of the texture

url

Find examples in Playground
url: string

The texture URL.

wrapR

Find examples in Playground
wrapR: number
Value Type Description
0 CLAMP_ADDRESSMODE
1 WRAP_ADDRESSMODE
2 MIRROR_ADDRESSMODE

wrapU

Find examples in Playground
wrapU: number
Value Type Description
0 CLAMP_ADDRESSMODE
1 WRAP_ADDRESSMODE
2 MIRROR_ADDRESSMODE

wrapV

Find examples in Playground
wrapV: number
Value Type Description
0 CLAMP_ADDRESSMODE
1 WRAP_ADDRESSMODE
2 MIRROR_ADDRESSMODE

Static DEFAULT_ANISOTROPIC_FILTERING_LEVEL

Find examples in Playground
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

Find examples in Playground

delayLoad

Find examples in Playground
  • delayLoad(): void

dispose

Find examples in Playground
  • dispose(): void
  • Dispose the texture and release its associated resources.

    Returns void

getBaseSize

Find examples in Playground
  • 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

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

    Returns string

    "HDRCubeTexture"

getInternalTexture

Find examples in Playground

getReflectionTextureMatrix

Find examples in Playground
  • getReflectionTextureMatrix(): Matrix

getScene

Find examples in Playground

getSize

Find examples in Playground

getTextureMatrix

Find examples in Playground

isReady

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

    Returns boolean

    true if fully ready

isReadyOrNotBlocking

Find examples in Playground
  • 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

Find examples in Playground
  • 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

Find examples in Playground
  • releaseInternalTexture(): void

scale

Find examples in Playground
  • 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

Find examples in Playground
  • serialize(): any

setReflectionTextureMatrix

Find examples in Playground
  • 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

toString

Find examples in Playground
  • toString(): string
  • Return a string representation of the texture.

    Returns string

    the texture as a string

updateSamplingMode

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

    Value Type Description
    1 NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR Nearest is: mag = nearest, min = nearest, mip = linear
    2 BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST Bilinear is: mag = linear, min = linear, mip = nearest
    3 TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR Trilinear is: mag = linear, min = linear, mip = linear
    4 NEAREST_NEAREST_MIPNEAREST
    5 NEAREST_LINEAR_MIPNEAREST
    6 NEAREST_LINEAR_MIPLINEAR
    7 NEAREST_LINEAR
    8 NEAREST_NEAREST
    9 LINEAR_NEAREST_MIPNEAREST
    10 LINEAR_NEAREST_MIPLINEAR
    11 LINEAR_LINEAR
    12 LINEAR_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 Parse

Find examples in Playground
  • 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 WhenAllReady

Find examples in Playground
  • 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