RenderTargetTexture

This Helps creating a texture that will be created from a camera in your scene. It is basically a dynamic texture that could be used to create special effects for instance. Actually, It is the base of lot of effects in the framework like post process, shadows, effect layers and rendering pipelines...

Hierarchy

Implements

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

Find examples in Playground
  • new RenderTargetTexture(name: string, size: number | object | object, scene: Nullable<Scene>, generateMipMaps?: boolean, doNotChangeAspectRatio?: boolean, type?: number, isCube?: boolean, samplingMode?: number, generateDepthBuffer?: boolean, generateStencilBuffer?: boolean, isMulti?: boolean, format?: number, delayAllocation?: boolean): RenderTargetTexture
  • Instantiate a render target texture. This is mainly used to render of screen the scene to for instance apply post processse or used a shadow, depth texture...

    Parameters

    • name: string

      The friendly name of the texture

    • size: number | object | object

      The size of the RTT (number if square, or {width: number, height:number} or {ratio:} to define a ratio from the main scene)

    • scene: Nullable<Scene>

      The scene the RTT belongs to. The latest created scene will be used if not precised.

    • Optional generateMipMaps: boolean

      True if mip maps need to be generated after render.

    • Optional doNotChangeAspectRatio: boolean

      True to not change the aspect ratio of the scene in the RTT

    • Optional type: number

      The type of the buffer in the RTT (int, half float, float...)

    • Optional isCube: boolean

      True if a cube texture needs to be created

    • Optional samplingMode: number

      The sampling mode to be usedwith the render target (Linear, Nearest...)

    • Optional generateDepthBuffer: boolean

      True to generate a depth buffer

    • Optional generateStencilBuffer: boolean

      True to generate a stencil buffer

    • Optional isMulti: boolean

      True if multiple textures need to be created (Draw Buffers)

    • Optional format: number

      The internal format of the buffer in the RTT (RED, RG, RGB, RGBA, ALPHA...)

    • Optional delayAllocation: boolean

      if the texture allocation should be delayed (default: false)

    Returns RenderTargetTexture

Properties

activeCamera

Find examples in Playground
activeCamera: Nullable<Camera>

Define the camera used to render the texture.

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 texture (when in cube mode) It must define where the camera used to render the texture is set

clearColor

Find examples in Playground
clearColor: Color4

Define the clear color of the Render Target if it should be different from the scene.

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.

customIsReadyFunction

Find examples in Playground
customIsReadyFunction: function

Override the mesh isReady function with your own one.

Type declaration

customRenderFunction

Find examples in Playground
customRenderFunction: function

Override the render function of the texture with your own one.

Type declaration

delayLoadState

Find examples in Playground
delayLoadState: number

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

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.

getCustomRenderList

Find examples in Playground
getCustomRenderList: function

Use this function to overload the renderList array at rendering time. Return null to render with the curent renderList, else return the list of meshes to use for rendering. For 2DArray RTT, layerOrFace is the index of the layer that is going to be rendered, else it is the faceIndex of the cube (if the RTT is a cube, else layerOrFace=0). The renderList passed to the function is the current render list (the one that will be used if the function returns null). The length of this list is passed through renderListLength: don't use renderList.length directly because the array can hold dummy elements!

Type declaration

ignoreCameraViewport

Find examples in Playground
ignoreCameraViewport: boolean

Define if the camera viewport should be respected while rendering the texture or if the render should be done to the entire texture.

inspectableCustomProperties

Find examples in Playground
inspectableCustomProperties: Nullable<IInspectable[]>

List of inspectable custom properties (used by the Inspector)

see

https://doc.babylonjs.com/how_to/debug_layer#extensibility

invertZ

Find examples in Playground
invertZ: boolean

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

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

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.

onAfterRenderObservable

Find examples in Playground
onAfterRenderObservable: Observable<number>

An event triggered after rendering the texture

onAfterUnbindObservable

Find examples in Playground
onAfterUnbindObservable: Observable<RenderTargetTexture>

An event triggered when the texture is unbind.

onBeforeBindObservable

Find examples in Playground
onBeforeBindObservable: Observable<RenderTargetTexture>

An event triggered when the texture is unbind.

onBeforeRenderObservable

Find examples in Playground
onBeforeRenderObservable: Observable<number>

An event triggered before rendering the texture

onClearObservable

Find examples in Playground
onClearObservable: Observable<Engine>

An event triggered after the texture clear

onDisposeObservable

Find examples in Playground
onDisposeObservable: Observable<BaseTexture>

An event triggered when the texture is disposed.

onLoadObservable

Find examples in Playground
onLoadObservable: Observable<Texture>

Observable triggered once the texture has been loaded.

onResizeObservable

Find examples in Playground
onResizeObservable: Observable<RenderTargetTexture>

An event triggered when the texture is resized.

renderListPredicate

Find examples in Playground
renderListPredicate: function

Use this predicate to dynamically define the list of mesh you want to render. If set, the renderList property will be overwritten.

Type declaration

renderParticles

Find examples in Playground
renderParticles: boolean

Define if particles should be rendered in your texture.

renderSprites

Find examples in Playground
renderSprites: boolean

Define if sprites should be rendered in your texture.

reservedDataStore

Find examples in Playground
reservedDataStore: any

For internal use only. Please do not use.

uAng

Find examples in Playground
uAng: number

Define an offset on the texture to rotate around the u coordinates of the UVs

see

https://doc.babylonjs.com/how_to/more_materials

uOffset

Find examples in Playground
uOffset: number

Define an offset on the texture to offset the u coordinates of the UVs

see

https://doc.babylonjs.com/how_to/more_materials#offsetting

uRotationCenter

Find examples in Playground
uRotationCenter: number

Defines the center of rotation (U)

uScale

Find examples in Playground
uScale: number

Define an offset on the texture to scale the u coordinates of the UVs

see

https://doc.babylonjs.com/how_to/more_materials#tiling

uniqueId

Find examples in Playground
uniqueId: number

Gets or sets the unique id of the texture

url

Find examples in Playground
url: Nullable<string>

Define the url of the texture.

useCameraPostProcesses

Find examples in Playground
useCameraPostProcesses: boolean

Define if camera post processes should be use while rendering the texture.

vAng

Find examples in Playground
vAng: number

Define an offset on the texture to rotate around the v coordinates of the UVs

see

https://doc.babylonjs.com/how_to/more_materials

vOffset

Find examples in Playground
vOffset: number

Define an offset on the texture to offset the v coordinates of the UVs

see

https://doc.babylonjs.com/how_to/more_materials#offsetting

vRotationCenter

Find examples in Playground
vRotationCenter: number

Defines the center of rotation (V)

vScale

Find examples in Playground
vScale: number

Define an offset on the texture to scale the v coordinates of the UVs

see

https://doc.babylonjs.com/how_to/more_materials#tiling

wAng

Find examples in Playground
wAng: number

Define an offset on the texture to rotate around the w coordinates of the UVs (in case of 3d texture)

see

https://doc.babylonjs.com/how_to/more_materials

wRotationCenter

Find examples in Playground
wRotationCenter: number

Defines the center of rotation (W)

wrapR

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

Static Readonly BILINEAR_SAMPLINGMODE

Find examples in Playground
BILINEAR_SAMPLINGMODE: number

Bilinear is mag = linear and min = linear and mip = nearest

Static Readonly CLAMP_ADDRESSMODE

Find examples in Playground
CLAMP_ADDRESSMODE: number

Texture is not repeating outside of 0..1 UVs

Static Readonly CUBIC_MODE

Find examples in Playground
CUBIC_MODE: number

Cubic coordinates mode

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.

Static Readonly EQUIRECTANGULAR_MODE

Find examples in Playground
EQUIRECTANGULAR_MODE: number

Equirectangular coordinates mode

Static Readonly EXPLICIT_MODE

Find examples in Playground
EXPLICIT_MODE: number

Explicit coordinates mode

Static Readonly FIXED_EQUIRECTANGULAR_MIRRORED_MODE

Find examples in Playground
FIXED_EQUIRECTANGULAR_MIRRORED_MODE: number

Equirectangular Fixed Mirrored coordinates mode

Static Readonly FIXED_EQUIRECTANGULAR_MODE

Find examples in Playground
FIXED_EQUIRECTANGULAR_MODE: number

Equirectangular Fixed coordinates mode

Static Readonly INVCUBIC_MODE

Find examples in Playground
INVCUBIC_MODE: number

Inverse Cubic coordinates mode

Static Readonly LINEAR_LINEAR

Find examples in Playground
LINEAR_LINEAR: number

mag = linear and min = linear and mip = none

Static Readonly LINEAR_LINEAR_MIPLINEAR

Find examples in Playground
LINEAR_LINEAR_MIPLINEAR: number

Trilinear is mag = linear and min = linear and mip = linear

Static Readonly LINEAR_LINEAR_MIPNEAREST

Find examples in Playground
LINEAR_LINEAR_MIPNEAREST: number

Bilinear is mag = linear and min = linear and mip = nearest

Static Readonly LINEAR_NEAREST

Find examples in Playground
LINEAR_NEAREST: number

mag = linear and min = nearest and mip = none

Static Readonly LINEAR_NEAREST_MIPLINEAR

Find examples in Playground
LINEAR_NEAREST_MIPLINEAR: number

mag = linear and min = nearest and mip = linear

Static Readonly LINEAR_NEAREST_MIPNEAREST

Find examples in Playground
LINEAR_NEAREST_MIPNEAREST: number

mag = linear and min = nearest and mip = nearest

Static Readonly MIRROR_ADDRESSMODE

Find examples in Playground
MIRROR_ADDRESSMODE: number

Texture is repeating and mirrored

Static Readonly NEAREST_LINEAR

Find examples in Playground
NEAREST_LINEAR: number

mag = nearest and min = linear and mip = none

Static Readonly NEAREST_LINEAR_MIPLINEAR

Find examples in Playground
NEAREST_LINEAR_MIPLINEAR: number

mag = nearest and min = linear and mip = linear

Static Readonly NEAREST_LINEAR_MIPNEAREST

Find examples in Playground
NEAREST_LINEAR_MIPNEAREST: number

mag = nearest and min = linear and mip = nearest

Static Readonly NEAREST_NEAREST

Find examples in Playground
NEAREST_NEAREST: number

mag = nearest and min = nearest and mip = none

Static Readonly NEAREST_NEAREST_MIPLINEAR

Find examples in Playground
NEAREST_NEAREST_MIPLINEAR: number

nearest is mag = nearest and min = nearest and mip = linear

Static Readonly NEAREST_NEAREST_MIPNEAREST

Find examples in Playground
NEAREST_NEAREST_MIPNEAREST: number

mag = nearest and min = nearest and mip = nearest

Static Readonly NEAREST_SAMPLINGMODE

Find examples in Playground
NEAREST_SAMPLINGMODE: number

nearest is mag = nearest and min = nearest and mip = linear

Static Readonly PLANAR_MODE

Find examples in Playground
PLANAR_MODE: number

Planar coordinates mode

Static Readonly PROJECTION_MODE

Find examples in Playground
PROJECTION_MODE: number

Projection coordinates mode

Static Readonly REFRESHRATE_RENDER_ONCE

Find examples in Playground
REFRESHRATE_RENDER_ONCE: number

The texture will only be rendered once which can be useful to improve performance if everything in your render is static for instance.

Static Readonly REFRESHRATE_RENDER_ONEVERYFRAME

Find examples in Playground
REFRESHRATE_RENDER_ONEVERYFRAME: number

The texture will only be rendered rendered every frame and is recomended for dynamic contents.

Static Readonly REFRESHRATE_RENDER_ONEVERYTWOFRAMES

Find examples in Playground
REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number

The texture will be rendered every 2 frames which could be enough if your dynamic objects are not the central point of your effect and can save a lot of performances.

Static Readonly SKYBOX_MODE

Find examples in Playground
SKYBOX_MODE: number

Inverse Cubic coordinates mode

Static Readonly SPHERICAL_MODE

Find examples in Playground
SPHERICAL_MODE: number

Spherical coordinates mode

Static SerializeBuffers

Find examples in Playground
SerializeBuffers: boolean

Gets or sets a general boolean used to indicate that textures containing direct data (buffers) must be saved as part of the serialization process

Static Readonly TRILINEAR_SAMPLINGMODE

Find examples in Playground
TRILINEAR_SAMPLINGMODE: number

Trilinear is mag = linear and min = linear and mip = linear

Static UseSerializedUrlIfAny

Find examples in Playground
UseSerializedUrlIfAny: boolean

Gets or sets a boolean which defines if the texture url must be build from the serialized URL instead of just using the name and loading them side by side with the scene file

Static Readonly WRAP_ADDRESSMODE

Find examples in Playground
WRAP_ADDRESSMODE: number

Texture is repeating outside of 0..1 UVs

Accessors

boundingBoxSize

Find examples in Playground
  • get boundingBoxSize(): Vector3
  • set boundingBoxSize(value: Vector3): any

canRescale

Find examples in Playground
  • get canRescale(): boolean

coordinatesMode

Find examples in Playground
  • get coordinatesMode(): number
  • set coordinatesMode(value: number): any
  • 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

    Returns 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

    Parameters

    • value: number

    Returns any

depthStencilTexture

Find examples in Playground
  • In case the RTT has been created with a depth texture, get the associated depth texture. Otherwise, return null.

    Returns Nullable<InternalTexture>

gammaSpace

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

hasAlpha

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

invertY

Find examples in Playground
  • get invertY(): boolean
  • Gets a boolean indicating if the texture needs to be inverted on the y axis during loading

    Returns boolean

irradianceTexture

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

Find examples in Playground
  • get is2DArray(): boolean
  • set is2DArray(value: boolean): any
  • Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.

    Returns boolean

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

    Parameters

    • value: boolean

    Returns any

is3D

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

Find examples in Playground
  • get isBlocking(): boolean
  • set isBlocking(value: boolean): any
  • Is the texture preventing material to render while loading. If false, a default texture will be used instead of the loading one during the preparation step.

    Returns boolean

  • Is the texture preventing material to render while loading. If false, a default texture will be used instead of the loading one during the preparation step.

    Parameters

    • value: boolean

    Returns any

isCube

Find examples in Playground
  • get isCube(): boolean
  • set isCube(value: boolean): any
  • Define if the texture is a cube texture or if false a 2d texture.

    Returns boolean

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

    Parameters

    • value: boolean

    Returns any

isRGBD

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

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

lodGenerationOffset

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

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

mimeType

Find examples in Playground
  • get mimeType(): string | undefined
  • Returns the texture mime type if it was defined by a loader (undefined else)

    Returns string | undefined

noMipmap

Find examples in Playground
  • get noMipmap(): boolean

onAfterRender

Find examples in Playground
  • set onAfterRender(callback: function): any
  • Set a after render callback in the texture. This has been kept for backward compatibility and use of onAfterRenderObservable is recommended.

    Parameters

    • callback: function
        • (faceIndex: number): void
        • Parameters

          • faceIndex: number

          Returns void

    Returns any

onAfterUnbind

Find examples in Playground
  • set onAfterUnbind(callback: function): any
  • Set a after unbind callback in the texture. This has been kept for backward compatibility and use of onAfterUnbindObservable is recommended.

    Parameters

    • callback: function
        • (): void
        • Returns void

    Returns any

onBeforeRender

Find examples in Playground
  • set onBeforeRender(callback: function): any
  • Set a before render callback in the texture. This has been kept for backward compatibility and use of onBeforeRenderObservable is recommended.

    Parameters

    • callback: function
        • (faceIndex: number): void
        • Parameters

          • faceIndex: number

          Returns void

    Returns any

onClear

Find examples in Playground
  • set onClear(callback: function): any
  • Set a clear callback in the texture. This has been kept for backward compatibility and use of onClearObservable is recommended.

    Parameters

    • callback: function
        • Parameters

          Returns void

    Returns any

onDispose

Find examples in Playground
  • set onDispose(callback: function): any
  • Callback triggered when the texture has been disposed. Kept for back compatibility, you can use the onDisposeObservable instead.

    Parameters

    • callback: function
        • (): void
        • Returns void

    Returns any

refreshRate

Find examples in Playground
  • get refreshRate(): number
  • set refreshRate(value: number): any
  • Define the refresh rate of the texture or the rendering frequency. Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...

    Returns number

  • Define the refresh rate of the texture or the rendering frequency. Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...

    Parameters

    • value: number

    Returns any

renderList

Find examples in Playground
  • Use this list to define the list of mesh you want to render.

    Returns Nullable<Array<AbstractMesh>>

  • Use this list to define the list of mesh you want to render.

    Parameters

    Returns any

renderTargetOptions

Find examples in Playground

samples

Find examples in Playground
  • get samples(): number
  • set samples(value: number): any
  • Define the number of samples to use in case of MSAA. It defaults to one meaning no MSAA has been enabled.

    Returns number

  • Define the number of samples to use in case of MSAA. It defaults to one meaning no MSAA has been enabled.

    Parameters

    • value: number

    Returns any

samplingMode

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

    Returns number

textureFormat

Find examples in Playground
  • get textureFormat(): number

textureType

Find examples in Playground
  • get textureType(): number

uid

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

    Returns string

wrapU

Find examples in Playground
  • get wrapU(): number
  • set wrapU(value: number): any
  • Value Type Description
    0 CLAMP_ADDRESSMODE
    1 WRAP_ADDRESSMODE
    2 MIRROR_ADDRESSMODE

    Returns number

  • Value Type Description
    0 CLAMP_ADDRESSMODE
    1 WRAP_ADDRESSMODE
    2 MIRROR_ADDRESSMODE

    Parameters

    • value: number

    Returns any

wrapV

Find examples in Playground
  • get wrapV(): number
  • set wrapV(value: number): any
  • Value Type Description
    0 CLAMP_ADDRESSMODE
    1 WRAP_ADDRESSMODE
    2 MIRROR_ADDRESSMODE

    Returns number

  • Value Type Description
    0 CLAMP_ADDRESSMODE
    1 WRAP_ADDRESSMODE
    2 MIRROR_ADDRESSMODE

    Parameters

    • value: number

    Returns any

Methods

addPostProcess

Find examples in Playground
  • Adds a post process to the render target rendering passes.

    Parameters

    • postProcess: PostProcess

      define the post process to add

    Returns void

clearPostProcesses

Find examples in Playground
  • clearPostProcesses(dispose?: boolean): void
  • Clear all the post processes attached to the render target

    Parameters

    • Optional dispose: boolean

      define if the cleared post processesshould also be disposed (false by default)

    Returns void

clone

Find examples in Playground

createDepthStencilTexture

Find examples in Playground
  • createDepthStencilTexture(comparisonFunction?: number, bilinearFiltering?: boolean, generateStencil?: boolean): void
  • Creates a depth stencil texture. This is only available in WebGL 2 or with the depth texture extension available.

    Parameters

    • Optional comparisonFunction: number

      Specifies the comparison function to set on the texture. If 0 or undefined, the texture is not in comparison mode

    • Optional bilinearFiltering: boolean

      Specifies whether or not bilinear filtering is enable on the texture

    • Optional generateStencil: boolean

      Specifies whether or not a stencil should be allocated in the texture

    Returns void

dispose

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

    Returns void

disposeFramebufferObjects

Find examples in Playground
  • disposeFramebufferObjects(): void
  • This will remove the attached framebuffer objects. The texture will not be able to be used as render target anymore

    Returns void

freeRenderingGroups

Find examples in Playground
  • freeRenderingGroups(): void
  • Clear the info related to rendering groups preventing retention point in material dispose.

    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

getInternalTexture

Find examples in Playground

getReflectionTextureMatrix

Find examples in Playground
  • getReflectionTextureMatrix(): Matrix

getRenderHeight

Find examples in Playground
  • getRenderHeight(): number
  • Gets the actual render height of the texture.

    Returns number

    the height of the render size

getRenderLayers

Find examples in Playground
  • getRenderLayers(): number
  • Gets the actual number of layers of the texture.

    Returns number

    the number of layers

getRenderSize

Find examples in Playground
  • getRenderSize(): number
  • Gets the actual render size of the texture.

    Returns number

    the width of the render size

getRenderWidth

Find examples in Playground
  • getRenderWidth(): number
  • Gets the actual render width of the texture.

    Returns number

    the width of the render size

getScene

Find examples in Playground

getSize

Find examples in Playground

getTextureMatrix

Find examples in Playground
  • getTextureMatrix(uBase?: number): Matrix

getViewCount

Find examples in Playground
  • getViewCount(): number
  • Gets the number of views the corresponding to the texture (eg. a MultiviewRenderTarget will have > 1)

    Returns number

    the view count

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

removePostProcess

Find examples in Playground
  • Remove one of the post process from the list of attached post processes to the texture

    Parameters

    • postProcess: PostProcess

      define the post process to remove from the list

    Returns void

render

Find examples in Playground
  • render(useCameraPostProcess?: boolean, dumpForDebug?: boolean): void
  • Renders all the objects from the render list into the texture.

    Parameters

    • Optional useCameraPostProcess: boolean

      Define if camera post processes should be used during the rendering

    • Optional dumpForDebug: boolean

      Define if the rendering result should be dumped (copied) for debugging purpose

    Returns void

resetRefreshCounter

Find examples in Playground
  • resetRefreshCounter(): void
  • Resets the refresh counter of the texture and start bak from scratch. Could be useful to regenerate the texture if it is setup to render only once.

    Returns void

resize

Find examples in Playground
  • resize(size: number | object | object): void
  • Resize the texture to a new desired size. Be carrefull as it will recreate all the data in the new texture.

    Parameters

    • size: number | object | object

      Define the new size. It can be:

      • a number for squared texture,
      • an object containing { width: number, height: number }
      • or an object containing a ratio { ratio: number }

    Returns void

scale

Find examples in Playground
  • scale(ratio: number): void
  • Resize the texture using a ratio.

    Parameters

    • ratio: number

      the ratio to apply to the texture size in order to compute the new target size

    Returns void

serialize

Find examples in Playground
  • serialize(): any
  • Serialize the texture to a JSON representation we can easily use in the resepective Parse function.

    Returns any

    The JSON representation of the texture

setRenderingAutoClearDepthStencil

Find examples in Playground
  • setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void
  • Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.

    Parameters

    • renderingGroupId: number

      The rendering group id corresponding to its index

    • autoClearDepthStencil: boolean

      Automatically clears depth and stencil between groups if true.

    Returns void

setRenderingOrder

Find examples in Playground
  • setRenderingOrder(renderingGroupId: number, opaqueSortCompareFn?: Nullable<function>, alphaTestSortCompareFn?: Nullable<function>, transparentSortCompareFn?: Nullable<function>): void
  • Overrides the default sort function applied in the renderging group to prepare the meshes. This allowed control for front to back rendering or reversly depending of the special needs.

    Parameters

    • renderingGroupId: number

      The rendering group id corresponding to its index

    • Optional opaqueSortCompareFn: Nullable<function>

      The opaque queue comparison function use to sort.

    • Optional alphaTestSortCompareFn: Nullable<function>

      The alpha test queue comparison function use to sort.

    • Optional transparentSortCompareFn: Nullable<function>

      The transparent queue comparison function use to sort.

    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

updateURL

Find examples in Playground
  • updateURL(url: string, buffer?: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob>, onLoad?: function): void
  • Update the url (and optional buffer) of this texture if url was null during construction.

    Parameters

    • url: string

      the url of the texture

    • Optional buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob>

      the buffer of the texture (defaults to null)

    • Optional onLoad: function

      callback called when the texture is loaded (defaults to null)

        • (): void
        • Returns void

    Returns void

Static CreateFromBase64String

Find examples in Playground
  • CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: Nullable<function>, onError?: Nullable<function>, format?: number): Texture
  • Creates a texture from its base 64 representation.

    Parameters

    • data: string

      Define the base64 payload without the data: prefix

    • name: string

      Define the name of the texture in the scene useful fo caching purpose for instance

    • scene: Scene

      Define the scene the texture should belong to

    • Optional noMipmap: boolean

      Forces the texture to not create mip map information if true

    • Optional invertY: boolean

      define if the texture needs to be inverted on the y axis during loading

    • Optional samplingMode: number

      define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)

    • Optional onLoad: Nullable<function>

      define a callback triggered when the texture has been loaded

    • Optional onError: Nullable<function>

      define a callback triggered when an error occurred during the loading session

    • Optional format: number

      define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)

    Returns Texture

    the created texture

Static LoadFromDataString

Find examples in Playground
  • LoadFromDataString(name: string, buffer: any, scene: Scene, deleteBuffer?: boolean, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: Nullable<function>, onError?: Nullable<function>, format?: number): Texture
  • Creates a texture from its data: representation. (data: will be added in case only the payload has been passed in)

    Parameters

    • name: string

      Define the name of the texture in the scene useful fo caching purpose for instance

    • buffer: any

      define the buffer to load the texture from in case the texture is loaded from a buffer representation

    • scene: Scene

      Define the scene the texture should belong to

    • Optional deleteBuffer: boolean

      define if the buffer we are loading the texture from should be deleted after load

    • Optional noMipmap: boolean

      Forces the texture to not create mip map information if true

    • Optional invertY: boolean

      define if the texture needs to be inverted on the y axis during loading

    • Optional samplingMode: number

      define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)

    • Optional onLoad: Nullable<function>

      define a callback triggered when the texture has been loaded

    • Optional onError: Nullable<function>

      define a callback triggered when an error occurred during the loading session

    • Optional format: number

      define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)

    Returns Texture

    the created texture

Static Parse

Find examples in Playground
  • Parse the JSON representation of a texture in order to recreate the texture in the given scene.

    Parameters

    • parsedTexture: any

      Define the JSON representation of the texture

    • scene: Scene

      Define the scene the parsed texture should be instantiated in

    • rootUrl: string

      Define the root url of the parsing sequence in the case of relative dependencies

    Returns Nullable<BaseTexture>

    The parsed texture if successful

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