Class RenderTargetTexture
Hierarchy (View Summary)
- Texture
- RenderTargetTexture
Implements
Index
Properties
Accessors
Methods
Properties
animations
Define the list of animation attached to the texture.
anisotropic Filtering Level
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.
bounding Box Position
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
clear Color
Define the clear color of the Render Target if it should be different from the scene.
delay Load State
Define the current state of the loading sequence when in delayed load mode.
display Name
Define the display name of the texture, which is used as tree item name of the dedicated node in the inspector
homogeneous Rotation In UV Transform
Sets this property to true to avoid deformations when rotating the texture with non-uniform scaling
ignore Camera Viewport
Define if the camera viewport should be respected while rendering the texture or if the render should be done to the entire texture.
inspectable Custom Properties
List of inspectable custom properties (used by the Inspector)
invert Z
Is Z inverted in the texture (useful in a cube texture).
is Render Target
Define if the texture is a render target.
level
Intensity or strength of the texture. It is commonly used by materials to fine tune the intensity of the texture
metadata
Gets or sets an object used to store user defined information.
name
Define the name of the texture.
no Pre Pass Renderer
Gets or sets a boolean indicating that the prepass renderer should not be used with this render target
on After Unbind Observable
An event triggered after the texture is unbound.
on Before Bind Observable
An event triggered before the texture is bound to the output.
on Clear Observable
An event triggered after the texture clear
on Dispose Observable
An event triggered when the texture is disposed.
on Load Observable
Observable triggered once the texture has been loaded.
on Resize Observable
An event triggered when the texture is resized.
optimize UV Allocation
Gets or sets a boolean indicating that the texture should try to reduce shader code if there is no UV manipulation. (ie. when texture.getTextureMatrix().isIdentityAs3x2() returns true)
reserved Data Store
For internal use only. Please do not use.
skip Initial Clear
Skip the initial clear of the rtt at the beginning of the frame render loop
spherical Polynomial
Get the polynomial representation of the texture data. This is mainly use as a fast way to recover IBL Diffuse irradiance data.
u Ang
Define an offset on the texture to rotate around the u coordinates of the UVs The angle is defined in radians.
unique Id
Gets or sets the unique id of the texture
u Offset
Define an offset on the texture to offset the u coordinates of the UVs
url
Define the url of the texture.
u Rotation Center
Defines the center of rotation (U)
u Scale
Define an offset on the texture to scale the u coordinates of the UVs
use Camera Post Processes
Define if camera post processes should be use while rendering the texture.
v Ang
Define an offset on the texture to rotate around the v coordinates of the UVs The angle is defined in radians.
v Offset
Define an offset on the texture to offset the v coordinates of the UVs
v Rotation Center
Defines the center of rotation (V)
v Scale
Define an offset on the texture to scale the v coordinates of the UVs
w Ang
Define an offset on the texture to rotate around the w coordinates of the UVs (in case of 3d texture) The angle is defined in radians.
wrap R
| Value | Type | Description |
|---|---|---|
| 0 | CLAMP_ADDRESSMODE | |
| 1 | WRAP_ADDRESSMODE | |
| 2 | MIRROR_ADDRESSMODE |
w Rotation Center
Defines the center of rotation (W)
Static ReadonlyBILINEAR_ SAMPLINGMODE
Bilinear is mag = linear and min = linear and no mip
Static ReadonlyCLAMP_ ADDRESSMODE
Texture is not repeating outside of 0..1 UVs
Static ReadonlyCUBIC_ MODE
Cubic coordinates mode
StaticDEFAULT_ ANISOTROPIC_ FILTERING_ LEVEL
Default anisotropic filtering level for the application. It is set to 4 as a good tradeoff between perf and quality.
Static ReadonlyEQUIRECTANGULAR_ MODE
Equirectangular coordinates mode
Static ReadonlyEXPLICIT_ MODE
Explicit coordinates mode
Static ReadonlyFIXED_ EQUIRECTANGULAR_ MIRRORED_ MODE
Equirectangular Fixed Mirrored coordinates mode
Static ReadonlyFIXED_ EQUIRECTANGULAR_ MODE
Equirectangular Fixed coordinates mode
StaticForce Serialize Buffers
Gets or sets a general boolean used to indicate that texture buffers must be saved as part of the serialization process. If no buffer exists, one will be created as base64 string from the internal webgl data.
Static ReadonlyINVCUBIC_ MODE
Inverse Cubic coordinates mode
Static ReadonlyLINEAR_ LINEAR
mag = linear and min = linear and mip = none
Static ReadonlyLINEAR_ LINEAR_ MIPLINEAR
Trilinear is mag = linear and min = linear and mip = linear
Static ReadonlyLINEAR_ LINEAR_ MIPNEAREST
Bilinear is mag = linear and min = linear and mip = nearest
Static ReadonlyLINEAR_ NEAREST
mag = linear and min = nearest and mip = none
Static ReadonlyLINEAR_ NEAREST_ MIPLINEAR
mag = linear and min = nearest and mip = linear
Static ReadonlyLINEAR_ NEAREST_ MIPNEAREST
mag = linear and min = nearest and mip = nearest
Static ReadonlyMIRROR_ ADDRESSMODE
Texture is repeating and mirrored
Static ReadonlyNEAREST_ LINEAR
mag = nearest and min = linear and mip = none
Static ReadonlyNEAREST_ LINEAR_ MIPLINEAR
mag = nearest and min = linear and mip = linear
Static ReadonlyNEAREST_ LINEAR_ MIPNEAREST
mag = nearest and min = linear and mip = nearest
Static ReadonlyNEAREST_ NEAREST
mag = nearest and min = nearest and mip = none
Static ReadonlyNEAREST_ NEAREST_ MIPLINEAR
nearest is mag = nearest and min = nearest and mip = linear
Static ReadonlyNEAREST_ NEAREST_ MIPNEAREST
mag = nearest and min = nearest and mip = nearest
Static ReadonlyNEAREST_ SAMPLINGMODE
nearest is mag = nearest and min = nearest and no mip
StaticOn Texture Load Error Observable
This observable will notify when any texture had a loading error
Static ReadonlyPLANAR_ MODE
Planar coordinates mode
Static ReadonlyPROJECTION_ MODE
Projection coordinates mode
Static ReadonlyREFRESHRATE_ RENDER_ ONCE
The texture will only be rendered once which can be useful to improve performance if everything in your render is static for instance.
Static ReadonlyREFRESHRATE_ RENDER_ ONEVERYFRAME
The texture will be rendered every frame and is recommended for dynamic contents.
Static ReadonlyREFRESHRATE_ RENDER_ ONEVERYTWOFRAMES
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.
StaticSerialize Buffers
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 ReadonlySKYBOX_ MODE
Inverse Cubic coordinates mode
Static ReadonlySPHERICAL_ MODE
Spherical coordinates mode
Static ReadonlyTRILINEAR_ SAMPLINGMODE
Trilinear is mag = linear and min = linear and mip = linear
StaticUse Serialized Url If Any
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 ReadonlyWRAP_ ADDRESSMODE
Texture is repeating outside of 0..1 UVs
Accessors
active Camera
bounding Box Size
camera For LOD
can Rescale
-
get canRescale(): boolean
Get if the texture can be rescaled or not.
Returns boolean
coordinates Index
-
get coordinatesIndex(): number
Returns number
-
set coordinatesIndex(value: number): void
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 void
coordinates Mode
-
get coordinatesMode(): number
How a texture is mapped. Unused in thin texture mode.
Returns number
-
set coordinatesMode(value: number): void
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 void
current Refresh Id
-
get currentRefreshId(): any
Gets the current value of the refreshId counter
Returns any
custom Is Ready Function
-
get customIsReadyFunction(): (
mesh: AbstractMesh,
refreshRate: number,
preWarm?: boolean,
) => booleanOverride the mesh isReady function with your own one.
Returns (mesh: AbstractMesh, refreshRate: number, preWarm?: boolean) => boolean
-
set customIsReadyFunction(
value: (
mesh: AbstractMesh,
refreshRate: number,
preWarm?: boolean,
) => boolean,
): voidParameters
- value: (mesh: AbstractMesh, refreshRate: number, preWarm?: boolean) => boolean
Returns void
custom Render Function
-
get customRenderFunction(): (
opaqueSubMeshes: SmartArray<SubMesh>,
alphaTestSubMeshes: SmartArray<SubMesh>,
transparentSubMeshes: SmartArray<SubMesh>,
depthOnlySubMeshes: SmartArray<SubMesh>,
beforeTransparents?: () => void,
) => voidOverride the render function of the texture with your own one.
Returns (
opaqueSubMeshes: SmartArray<SubMesh>,
alphaTestSubMeshes: SmartArray<SubMesh>,
transparentSubMeshes: SmartArray<SubMesh>,
depthOnlySubMeshes: SmartArray<SubMesh>,
beforeTransparents?: () => void,
) => void -
set customRenderFunction(
value: (
opaqueSubMeshes: SmartArray<SubMesh>,
alphaTestSubMeshes: SmartArray<SubMesh>,
transparentSubMeshes: SmartArray<SubMesh>,
depthOnlySubMeshes: SmartArray<SubMesh>,
beforeTransparents?: () => void,
) => void,
): voidParameters
- value: (
opaqueSubMeshes: SmartArray<SubMesh>,
alphaTestSubMeshes: SmartArray<SubMesh>,
transparentSubMeshes: SmartArray<SubMesh>,
depthOnlySubMeshes: SmartArray<SubMesh>,
beforeTransparents?: () => void,
) => void
Returns void
- value: (
depth Stencil Texture
-
In case the RTT has been created with a depth texture, get the associated depth texture. Otherwise, return null.
Returns Nullable<InternalTexture>
disable Image Processing
-
get disableImageProcessing(): boolean
If true, the renderer will render all objects without any image processing applied. If false (default value), the renderer will use the current setting of the scene's image processing configuration.
Returns boolean
-
set disableImageProcessing(value: boolean): void
Parameters
- value: boolean
Returns void
enable Bounding Box Rendering
-
get enableBoundingBoxRendering(): boolean
Define if bounding box rendering should be enabled (still subject to Mesh.showBoundingBox or scene.forceShowBoundingBoxes). (Default: false).
Returns boolean
-
set enableBoundingBoxRendering(value: boolean): void
Parameters
- value: boolean
Returns void
enable Outline Rendering
-
get enableOutlineRendering(): boolean
Define if outline/overlay rendering should be enabled (still subject to Mesh.renderOutline/Mesh.renderOverlay). (Default: true).
Returns boolean
-
set enableOutlineRendering(value: boolean): void
Parameters
- value: boolean
Returns void
error Object
-
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
force Layer Mask Check
-
get forceLayerMaskCheck(): boolean
Force checking the layerMask property even if a custom list of meshes is provided (ie. if renderList is not undefined) (default: false).
Returns boolean
-
set forceLayerMaskCheck(value: boolean): void
Parameters
- value: boolean
Returns void
gamma Space
-
get 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
Returns boolean
-
set gammaSpace(gamma: boolean): void
Parameters
- gamma: boolean
Returns void
get Alpha From RGB
-
get getAlphaFromRGB(): boolean
Returns boolean
-
set getAlphaFromRGB(value: boolean): void
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 void
get Custom Render List
-
get getCustomRenderList(): Nullable<
(
layerOrFace: number,
renderList: Nullable<readonly AbstractMesh[]>,
renderListLength: number,
) => Nullable<AbstractMesh[]>,
>Use this function to overload the renderList array at rendering time. Return null to render with the current 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!
Returns Nullable<
(
layerOrFace: number,
renderList: Nullable<readonly AbstractMesh[]>,
renderListLength: number,
) => Nullable<AbstractMesh[]>,
> -
set getCustomRenderList(
value: Nullable<
(
layerOrFace: number,
renderList: Nullable<readonly AbstractMesh[]>,
renderListLength: number,
) => Nullable<AbstractMesh[]>,
>,
): voidParameters
- value: Nullable<
(
layerOrFace: number,
renderList: Nullable<readonly AbstractMesh[]>,
renderListLength: number,
) => Nullable<AbstractMesh[]>,
>
Returns void
- value: Nullable<
has Alpha
-
get hasAlpha(): boolean
Returns boolean
-
set hasAlpha(value: boolean): void
Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).
Parameters
- value: boolean
Returns void
invert Y
-
get invertY(): boolean
Gets a boolean indicating if the texture needs to be inverted on the y axis during loading
Returns boolean
irradiance Texture
-
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>
-
Parameters
- value: Nullable<BaseTexture>
Returns void
is2 D Array
-
get is2DArray(): boolean
Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.
Returns boolean
-
set is2DArray(value: boolean): void
Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.
Parameters
- value: boolean
Returns void
is3 D
-
get is3D(): boolean
Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.
Returns boolean
-
set is3D(value: boolean): void
Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.
Parameters
- value: boolean
Returns void
is Blocking
-
get isBlocking(): boolean
Define if the texture is preventing a material to render or not. If not and the texture is not ready, the engine will use a default black texture instead.
Returns boolean
-
set isBlocking(value: boolean): void
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 void
is Cube
-
get isCube(): boolean
Define if the texture is a cube texture or if false a 2d texture.
Returns boolean
-
set isCube(value: boolean): void
Define if the texture is a cube texture or if false a 2d texture.
Parameters
- value: boolean
Returns void
is Multi
-
get isMulti(): boolean
Define if the texture has multiple draw buffers or if false a single draw buffer.
Returns boolean
is RGBD
-
get isRGBD(): boolean
Gets or sets whether or not the texture contains RGBD data.
Returns boolean
-
set isRGBD(value: boolean): void
Parameters
- value: boolean
Returns void
linear Specular LOD
-
get linearSpecularLOD(): 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.
Returns boolean
-
set linearSpecularLOD(value: boolean): void
Parameters
- value: boolean
Returns void
loading Error
-
get loadingError(): boolean
Was there any loading error?
Returns boolean
lod Generation Offset
-
get lodGenerationOffset(): number
With prefiltered texture, defined the offset used during the prefiltering steps.
Returns number
-
set lodGenerationOffset(value: number): void
Parameters
- value: number
Returns void
lod Generation Scale
-
get lodGenerationScale(): number
With prefiltered texture, defined the scale used during the prefiltering steps.
Returns number
-
set lodGenerationScale(value: number): void
Parameters
- value: number
Returns void
mime Type
-
get mimeType(): string | undefined
Returns the texture mime type if it was defined by a loader (undefined else)
Returns string | undefined
no Mipmap
-
get noMipmap(): boolean
Are mip maps generated for this texture or not.
Returns boolean
on After Render
-
set onAfterRender(callback: (faceIndex: number) => void): void
Set a after render callback in the texture. This has been kept for backward compatibility and use of onAfterRenderObservable is recommended.
Parameters
- callback: (faceIndex: number) => void
Returns void
on After Render Observable
-
get onAfterRenderObservable(): any
An event triggered after rendering the texture
Returns any
on After Unbind
-
set onAfterUnbind(callback: () => void): void
Set a after unbind callback in the texture. This has been kept for backward compatibility and use of onAfterUnbindObservable is recommended.
Parameters
- callback: () => void
Returns void
on Before Render
-
set onBeforeRender(callback: (faceIndex: number) => void): void
Set a before render callback in the texture. This has been kept for backward compatibility and use of onBeforeRenderObservable is recommended.
Parameters
- callback: (faceIndex: number) => void
Returns void
on Before Render Observable
-
get onBeforeRenderObservable(): any
An event triggered before rendering the texture
Returns any
on Clear
-
Set a clear callback in the texture. This has been kept for backward compatibility and use of onClearObservable is recommended.
Parameters
- callback: (Engine: AbstractEngine) => void
Returns void
on Dispose
-
set onDispose(callback: () => void): void
Callback triggered when the texture has been disposed. Kept for back compatibility, you can use the onDisposeObservable instead.
Parameters
- callback: () => void
Returns void
particle System List
-
Define the list of particle systems to render in the texture. If not provided, will render all the particle systems of the scene. Note that the particle systems are rendered only if renderParticles is set to true.
Returns Nullable<IParticleSystem[]>
-
Parameters
- value: Nullable<IParticleSystem[]>
Returns void
post Processes
-
Post-processes for this render target
Returns PostProcess[]
refresh Rate
-
get refreshRate(): 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...
Returns number
-
set refreshRate(value: number): void
Parameters
- value: number
Returns void
render List
-
Use this list to define the list of mesh you want to render.
Returns Nullable<AbstractMesh[]>
-
Parameters
- value: Nullable<AbstractMesh[]>
Returns void
render List Predicate
-
Use this predicate to dynamically define the list of mesh you want to render. If set, the renderList property will be overwritten.
Returns (AbstractMesh: AbstractMesh) => boolean
-
Parameters
- value: (AbstractMesh: AbstractMesh) => boolean
Returns void
render Particles
-
get renderParticles(): boolean
Define if particles should be rendered in your texture (default: true).
Returns boolean
-
set renderParticles(value: boolean): void
Parameters
- value: boolean
Returns void
render Pass Id
-
get renderPassId(): number
Current render pass id of the render target texture. Note it can change over the rendering as there's a separate id for each face of a cube / each layer of an array layer!
Returns number
render Pass Ids
-
get renderPassIds(): readonly number[]
Gets the render pass ids used by the render target texture. For a single render target the array length will be 1, for a cube texture it will be 6 and for a 2D texture array it will return an array of ids the size of the 2D texture array
Returns readonly number[]
render Sprites
-
get renderSprites(): boolean
Define if sprites should be rendered in your texture (default: false).
Returns boolean
-
set renderSprites(value: boolean): void
Parameters
- value: boolean
Returns void
render Target
-
Gets the render target wrapper associated with this render target
Returns Nullable<RenderTargetWrapper>
render Target Options
-
Gets render target creation options that were used.
Returns RenderTargetCreationOptions
samples
-
get samples(): number
Define the number of samples to use in case of MSAA. It defaults to one meaning no MSAA has been enabled.
Returns number
-
set samples(value: number): void
Parameters
- value: number
Returns void
sampling Mode
-
get samplingMode(): number
Get the current sampling mode associated with the texture.
Returns number
texture Format
-
get textureFormat(): number
Get the texture underlying format (RGB, RGBA...)
Returns number
texture Type
-
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
wrap U
-
get wrapU(): number
Value Type Description 0 CLAMP_ADDRESSMODE 1 WRAP_ADDRESSMODE 2 MIRROR_ADDRESSMODE Returns number
-
set wrapU(value: number): void
Value Type Description 0 CLAMP_ADDRESSMODE 1 WRAP_ADDRESSMODE 2 MIRROR_ADDRESSMODE Parameters
- value: number
Returns void
wrap V
-
get wrapV(): number
Value Type Description 0 CLAMP_ADDRESSMODE 1 WRAP_ADDRESSMODE 2 MIRROR_ADDRESSMODE Returns number
-
set wrapV(value: number): void
Value Type Description 0 CLAMP_ADDRESSMODE 1 WRAP_ADDRESSMODE 2 MIRROR_ADDRESSMODE Parameters
- value: number
Returns void
Methods
add Post Process
-
Adds a post process to the render target rendering passes.
Parameters
- postProcess: PostProcess
define the post process to add
Returns void
- postProcess: PostProcess
clear Post Processes
-
Clear all the post processes attached to the render target
Parameters
- dispose: boolean = false
define if the cleared post processes should also be disposed (false by default)
Returns void
- dispose: boolean = false
clone
create Depth Stencil Texture
-
createDepthStencilTexture(
comparisonFunction?: number,
bilinearFiltering?: boolean,
generateStencil?: boolean,
samples?: number,
format?: number,
label?: string,
): voidCreates a depth stencil texture. This is only available in WebGL 2 or with the depth texture extension available.
Parameters
- comparisonFunction: number = 0
Specifies the comparison function to set on the texture. If 0 or undefined, the texture is not in comparison mode (default: 0)
- bilinearFiltering: boolean = true
Specifies whether or not bilinear filtering is enable on the texture (default: true)
- generateStencil: boolean = false
Specifies whether or not a stencil should be allocated in the texture (default: false)
- samples: number = 1
sample count of the depth/stencil texture (default: 1)
- format: number = Constants.TEXTUREFORMAT_DEPTH32_FLOAT
format of the depth texture (default: Constants.TEXTUREFORMAT_DEPTH32_FLOAT)
Optionallabel: stringdefines the label of the texture (for debugging purpose)
Returns void
- comparisonFunction: number = 0
disable Rescaling
-
Don't allow this render target texture to rescale. Mainly used to prevent rescaling by the scene optimizer.
Returns void
dispose
-
Dispose the texture and release its associated resources.
Returns void
dispose Framebuffer Objects
-
This will remove the attached framebuffer objects. The texture will not be able to be used as render target anymore
Returns void
force Spherical Polynomials Recompute
-
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
free Rendering Groups
-
Clear the info related to rendering groups preventing retention point in material dispose.
Returns void
get Base Size
-
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
get Class Name
-
Get the current class name of the texture useful for serialization or dynamic coding.
Returns string
"Texture"
get Internal Texture
-
Get the underlying lower level texture from Babylon.
Returns Nullable<InternalTexture>
the internal texture
get Reflection Texture Matrix
-
Get the texture reflection matrix used to rotate/transform the reflection.
Returns Matrix
the reflection matrix
get Refraction Texture Matrix
-
Gets a suitable rotate/transform matrix when the texture is used for refraction. There's a separate function from getReflectionTextureMatrix because refraction requires a special configuration of the matrix in right-handed mode.
Returns Matrix
The refraction matrix
get Render Height
-
Gets the actual render height of the texture.
Returns number
the height of the render size
get Render Layers
-
Gets the actual number of layers of the texture or, in the case of a 3D texture, return the depth.
Returns number
the number of layers
get Render Size
-
Gets the actual render size of the texture.
Returns number
the width of the render size
get Render Width
-
Gets the actual render width of the texture.
Returns number
the width of the render size
get Scene
get Size
get Texture Matrix
-
Get the current texture matrix which includes the requested offsetting, tiling and rotation components.
Parameters
- uBase: number = 1
The horizontal base offset multiplier (1 by default)
Returns Matrix
the transform matrix of the texture.
- uBase: number = 1
get View Count
-
Gets the number of views the corresponding to the texture (eg. a MultiviewRenderTarget will have > 1)
Returns number
the view count
is Ready
-
Get if the texture is ready to be used (downloaded, converted, mip mapped...).
Returns boolean
true if fully ready
is Ready For Rendering
-
This function will check if the render target texture can be rendered (textures are loaded, shaders are compiled)
Returns boolean
true if all required resources are ready
is Ready Or Not Blocking
-
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
read Pixels
-
readPixels(
faceIndex?: number,
level?: number,
buffer?: Nullable<ArrayBufferView<ArrayBufferLike>>,
flushRenderer?: boolean,
noDataConversion?: boolean,
x?: number,
y?: number,
width?: number,
height?: number,
): Nullable<Promise<ArrayBufferView<ArrayBufferLike>>>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. Note that you can use GetTextureDataAsync instead, which will also support reading from a compressed texture (by rendering it to an intermediate RGBA texture and retrieving the bytes from it).
Parameters
- faceIndex: number = 0
defines the face of the texture to read (in case of cube texture)
- level: number = 0
defines the LOD level of the texture to read (in case of Mip Maps)
- buffer: Nullable<ArrayBufferView<ArrayBufferLike>> = null
defines a user defined buffer to fill with data (can be null)
- flushRenderer: boolean = true
true to flush the renderer from the pending commands before reading the pixels
- noDataConversion: boolean = false
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
- x: number = 0
defines the region x coordinates to start reading from (default to 0)
- y: number = 0
defines the region y coordinates to start reading from (default to 0)
- width: number = Number.MAX_VALUE
defines the region width to read from (default to the texture size at level)
- height: number = Number.MAX_VALUE
defines the region width to read from (default to the texture size at level)
Returns Nullable<Promise<ArrayBufferView<ArrayBufferLike>>>
The Array buffer promise containing the pixels data.
- faceIndex: number = 0
release Internal Texture
-
Release and destroy the underlying lower level texture aka internalTexture.
Returns void
remove Post Process
-
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
- postProcess: PostProcess
render
-
Renders all the objects from the render list into the texture.
Parameters
- useCameraPostProcess: boolean = false
Define if camera post processes should be used during the rendering
- dumpForDebug: boolean = false
Define if the rendering result should be dumped (copied) for debugging purpose
Returns void
- useCameraPostProcess: boolean = false
reset Refresh Counter
-
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
-
Resize the texture to a new desired size. Be careful as it will recreate all the data in the new texture.
Parameters
- size: TextureSize | { ratio: number }
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
- size: TextureSize | { ratio: number }
scale
-
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
- ratio: number
serialize
-
Serialize the texture to a JSON representation we can easily use in the respective Parse function.
Returns any
The JSON representation of the texture
set Material For Rendering
-
setMaterialForRendering(
mesh: AbstractMesh | AbstractMesh[],
material?: Material | Material[],
): voidSets a specific material to be used to render a mesh/a list of meshes in this render target texture
Parameters
- mesh: AbstractMesh | AbstractMesh[]
mesh or array of meshes
Optionalmaterial: Material | Material[]material or array of materials to use for this render pass. If undefined is passed, no specific material will be used but the regular material instead (mesh.material). It's possible to provide an array of materials to use a different material for each rendering in the case of a cube texture (6 rendering) and a 2D texture array (as many rendering as the length of the array)
Returns void
- mesh: AbstractMesh | AbstractMesh[]
set Rendering Auto Clear Depth Stencil
-
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
- renderingGroupId: number
set Rendering Order
-
setRenderingOrder(
renderingGroupId: number,
opaqueSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>,
alphaTestSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>,
transparentSortCompareFn?: Nullable<(a: SubMesh, b: SubMesh) => number>,
): voidOverrides the default sort function applied in the rendering group to prepare the meshes. This allowed control for front to back rendering or reversely depending of the special needs.
Parameters
- renderingGroupId: number
The rendering group id corresponding to its index
- opaqueSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number> = null
The opaque queue comparison function use to sort.
- alphaTestSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number> = null
The alpha test queue comparison function use to sort.
- transparentSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number> = null
The transparent queue comparison function use to sort.
Returns void
- renderingGroupId: number
to String
-
Return a string representation of the texture.
Returns string
the texture as a string
update Sampling Mode
-
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
- generateMipMaps: boolean = false
Define if the texture should generate mip maps or not. Default is false.
Returns void
- samplingMode: number
update URL
-
updateURL(
url: string,
buffer?: Nullable<
| string
| ArrayBuffer
| ArrayBufferView<ArrayBufferLike>
| HTMLImageElement
| ImageBitmap
| Blob,
>,
onLoad?: () => void,
forcedExtension?: string,
): voidUpdate the url (and optional buffer) of this texture if url was null during construction.
Parameters
- url: string
the url of the texture
- buffer: Nullable<
| string
| ArrayBuffer
| ArrayBufferView<ArrayBufferLike>
| HTMLImageElement
| ImageBitmap
| Blob,
> = nullthe buffer of the texture (defaults to null)
OptionalonLoad: () => voidcallback called when the texture is loaded (defaults to null)
OptionalforcedExtension: stringdefines the extension to use to pick the right loader
Returns void
- url: string
StaticCreate From Base64 String
-
CreateFromBase64String(
data: string,
name: string,
scene: Scene,
noMipmapOrOptions?: boolean | ITextureCreationOptions,
invertY?: boolean,
samplingMode?: number,
onLoad?: Nullable<() => void>,
onError?: Nullable<() => void>,
format?: number,
creationFlags?: number,
forcedExtension?: string,
): TextureCreates 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
OptionalnoMipmapOrOptions: boolean | ITextureCreationOptionsdefines if the texture will require mip maps or not or set of all options to create the texture
OptionalinvertY: booleandefine if the texture needs to be inverted on the y axis during loading
- samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE
define the sampling mode we want for the texture while fetching from it (Texture.NEAREST_SAMPLINGMODE...)
- onLoad: Nullable<() => void> = null
define a callback triggered when the texture has been loaded
- onError: Nullable<() => void> = null
define a callback triggered when an error occurred during the loading session
- format: number = Constants.TEXTUREFORMAT_RGBA
define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)
OptionalcreationFlags: numberspecific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)
OptionalforcedExtension: stringdefines the extension to use to pick the right loader
Returns Texture
the created texture
- data: string
StaticLoad From Data String
-
LoadFromDataString(
name: string,
buffer: any,
scene: Scene,
deleteBuffer?: boolean,
noMipmapOrOptions?: boolean | ITextureCreationOptions,
invertY?: boolean,
samplingMode?: number,
onLoad?: Nullable<() => void>,
onError?: Nullable<(message?: string, exception?: any) => void>,
format?: number,
creationFlags?: number,
forcedExtension?: string,
): TextureCreates 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
- deleteBuffer: boolean = false
define if the buffer we are loading the texture from should be deleted after load
OptionalnoMipmapOrOptions: boolean | ITextureCreationOptionsdefines if the texture will require mip maps or not or set of all options to create the texture
- invertY: boolean = true
define if the texture needs to be inverted on the y axis during loading
- samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE
define the sampling mode we want for the texture while fetching from it (Texture.NEAREST_SAMPLINGMODE...)
- onLoad: Nullable<() => void> = null
define a callback triggered when the texture has been loaded
- onError: Nullable<(message?: string, exception?: any) => void> = null
define a callback triggered when an error occurred during the loading session
- format: number = Constants.TEXTUREFORMAT_RGBA
define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)
OptionalcreationFlags: numberspecific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)
OptionalforcedExtension: stringdefines the extension to use to pick the right loader
Returns Texture
the created texture
- name: string
StaticParse
-
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
- parsedTexture: any
StaticWhen All Ready
-
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
Returns void
- textures: BaseTexture[]
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...