Class RenderTargetTexture
Hierarchy
- Texture
- RenderTargetTexture
Implements
Index
Constructors
Properties
- active
Camera - animations
- anisotropic
Filtering Level - bounding
Box Position - clear
Color - custom
Is Ready Function - custom
Render Function - delay
Load State - force
Layer Mask Check - get
Custom Render List - homogeneous
Rotation InUVTransform - ignore
Camera Viewport - inspectable
Custom Properties - invertZ
- is
Render Target - level
- metadata
- name
- no
Pre Pass Renderer - on
After Render Observable - on
After Unbind Observable - on
Before Bind Observable - on
Before Render Observable - on
Clear Observable - on
Dispose Observable - on
Load Observable - on
Resize Observable - optimizeUVAllocation
- render
List Predicate - render
Particles - render
Pass Id - render
Sprites - reserved
Data Store - skip
Initial Clear - spherical
Polynomial - u
Ang - u
Offset - u
Rotation Center - u
Scale - unique
Id - url
- use
Camera Post Processes - v
Ang - v
Offset - v
Rotation Center - v
Scale - w
Ang - w
Rotation Center - wrapR
- BILINEAR_
SAMPLINGMODE - CLAMP_
ADDRESSMODE - CUBIC_
MODE - DEFAULT_
ANISOTROPIC_ FILTERING_ LEVEL - EQUIRECTANGULAR_
MODE - EXPLICIT_
MODE - FIXED_
EQUIRECTANGULAR_ MIRRORED_ MODE - FIXED_
EQUIRECTANGULAR_ MODE - Force
Serialize Buffers - INVCUBIC_
MODE - LINEAR_
LINEAR - LINEAR_
LINEAR_ MIPLINEAR - LINEAR_
LINEAR_ MIPNEAREST - LINEAR_
NEAREST - LINEAR_
NEAREST_ MIPLINEAR - LINEAR_
NEAREST_ MIPNEAREST - MIRROR_
ADDRESSMODE - NEAREST_
LINEAR - NEAREST_
LINEAR_ MIPLINEAR - NEAREST_
LINEAR_ MIPNEAREST - NEAREST_
NEAREST - NEAREST_
NEAREST_ MIPLINEAR - NEAREST_
NEAREST_ MIPNEAREST - NEAREST_
SAMPLINGMODE - On
Texture Load Error Observable - PLANAR_
MODE - PROJECTION_
MODE - REFRESHRATE_
RENDER_ ONCE - REFRESHRATE_
RENDER_ ONEVERYFRAME - REFRESHRATE_
RENDER_ ONEVERYTWOFRAMES - SKYBOX_
MODE - SPHERICAL_
MODE - Serialize
Buffers - TRILINEAR_
SAMPLINGMODE - Use
Serialized Url If Any - WRAP_
ADDRESSMODE
Accessors
- bounding
Box Size - can
Rescale - coordinates
Index - coordinates
Mode - current
Refresh Id - depth
Stencil Texture - error
Object - gamma
Space - get
Alpha FromRGB - has
Alpha - invertY
- irradiance
Texture - is2DArray
- is3D
- is
Blocking - is
Cube - is
Multi - isRGBD
- linear
SpecularLOD - loading
Error - lod
Generation Offset - lod
Generation Scale - mime
Type - no
Mipmap - on
After Render - on
After Unbind - on
Before Render - on
Clear - on
Dispose - post
Processes - refresh
Rate - render
List - render
Pass Ids - render
Target - render
Target Options - samples
- sampling
Mode - texture
Format - texture
Type - uid
- wrapU
- wrapV
Methods
- add
Post Process - check
Transforms Are Identical - clear
Post Processes - clone
- create
Depth Stencil Texture - disable
Rescaling - dispose
- dispose
Framebuffer Objects - force
Spherical Polynomials Recompute - free
Rendering Groups - get
Base Size - get
Class Name - get
Internal Texture - get
Reflection Texture Matrix - get
Refraction Texture Matrix - get
Render Height - get
Render Layers - get
Render Size - get
Render Width - get
Scene - get
Size - get
Texture Matrix - get
View Count - is
Ready - is
Ready For Rendering - is
Ready Or Not Blocking - read
Pixels - release
Internal Texture - remove
Post Process - render
- reset
Refresh Counter - resize
- scale
- serialize
- set
Material For Rendering - set
Rendering Auto Clear Depth Stencil - set
Rendering Order - to
String - update
Sampling Mode - updateURL
- Create
From Base64 String - Load
From Data String - Parse
- When
All Ready
Constructors
constructor
Instantiate a render target texture. This is mainly used to render of screen the scene to for instance apply post process or used a shadow, depth texture...
Parameters
name: string
The friendly name of the texture
size: number | { height: number; layers?: number; width: number } | { ratio: number }
The size of the RTT (number if square, or {width: number, height:number} or {ratio:} to define a ratio from the main scene)
Optional scene: Nullable<Scene>
The scene the RTT belongs to. Default is the last created scene.
Optional options: RenderTargetTextureOptions
The options for creating the render target texture.
Returns RenderTargetTexture
Instantiate a render target texture. This is mainly used to render of screen the scene to for instance apply post process or used a shadow, depth texture...
Parameters
name: string
The friendly name of the texture
size: number | { height: number; layers?: number; width: number } | { ratio: number }
The size of the RTT (number if square, or {width: number, height:number} or {ratio:} to define a ratio from the main scene)
Optional scene: Nullable<Scene>
The scene the RTT belongs to. Default is the last created scene
Optional generateMipMaps: boolean
True (default: false) if mipmaps need to be generated after render
Optional doNotChangeAspectRatio: boolean
True (default) to not change the aspect ratio of the scene in the RTT
Optional type: number
The type of the buffer in the RTT (byte (default), half float, float...)
Optional isCube: boolean
True (default: false) if a cube texture needs to be created
Optional samplingMode: number
The sampling mode to be used with the render target (Trilinear (default), Linear, Nearest...)
Optional generateDepthBuffer: boolean
True (default) to generate a depth buffer
Optional generateStencilBuffer: boolean
True (default: false) to generate a stencil buffer
Optional isMulti: boolean
True (default: false) 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 (default), ALPHA...)
Optional delayAllocation: boolean
True (default: false) if the texture allocation should be delayed
Optional samples: number
Sample count to use when creating the RTT
Optional creationFlags: number
specific flags to use when creating the texture (e.g., Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures)
Optional noColorAttachment: boolean
True (default: false) to indicate that no color target should be created. (e.g., if you only want to write to the depth buffer)
Optional useSRGBBuffer: boolean
True (default: false) to create a SRGB texture
Returns RenderTargetTexture
Properties
active CameraSearch playground for activeCamera
Define the camera used to render the texture.
animationsSearch playground for animations
Define the list of animation attached to the texture.
anisotropic Filtering LevelSearch playground for anisotropicFilteringLevel
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 PositionSearch playground for boundingBoxPosition
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 ColorSearch playground for clearColor
Define the clear color of the Render Target if it should be different from the scene.
custom Is Ready FunctionSearch playground for customIsReadyFunction
Type declaration
Override the mesh isReady function with your own one.
Parameters
mesh: AbstractMesh
refreshRate: number
Optional preWarm: boolean
Returns boolean
custom Render FunctionSearch playground for customRenderFunction
Type declaration
Override the render function of the texture with your own one.
Parameters
opaqueSubMeshes: SmartArray<SubMesh>
alphaTestSubMeshes: SmartArray<SubMesh>
transparentSubMeshes: SmartArray<SubMesh>
depthOnlySubMeshes: SmartArray<SubMesh>
Optional beforeTransparents: (() => void)
Returns void
Returns void
delay Load StateSearch playground for delayLoadState
Define the current state of the loading sequence when in delayed load mode.
force Layer Mask CheckSearch playground for forceLayerMaskCheck
Force checking the layerMask property even if a custom list of meshes is provided (ie. if renderList is not undefined)
get Custom Render ListSearch playground for getCustomRenderList
Type declaration
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!
Parameters
layerOrFace: number
renderList: Nullable<readonly AbstractMesh[]>
renderListLength: number
Returns Nullable<AbstractMesh[]>
homogeneous Rotation InUVTransformSearch playground for homogeneousRotationInUVTransform
Sets this property to true to avoid deformations when rotating the texture with non-uniform scaling
ignore Camera ViewportSearch playground for ignoreCameraViewport
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 PropertiesSearch playground for inspectableCustomProperties
List of inspectable custom properties (used by the Inspector)
invertZSearch playground for invertZ
Is Z inverted in the texture (useful in a cube texture).
is Render TargetSearch playground for isRenderTarget
Define if the texture is a render target.
levelSearch playground for level
Intensity or strength of the texture. It is commonly used by materials to fine tune the intensity of the texture
metadataSearch playground for metadata
Gets or sets an object used to store user defined information.
nameSearch playground for name
Define the name of the texture.
no Pre Pass RendererSearch playground for noPrePassRenderer
Gets or sets a boolean indicating that the prepass renderer should not be used with this render target
on After Render ObservableSearch playground for onAfterRenderObservable
An event triggered after rendering the texture
on After Unbind ObservableSearch playground for onAfterUnbindObservable
An event triggered when the texture is unbind.
on Before Bind ObservableSearch playground for onBeforeBindObservable
An event triggered when the texture is unbind.
on Before Render ObservableSearch playground for onBeforeRenderObservable
An event triggered before rendering the texture
on Clear ObservableSearch playground for onClearObservable
An event triggered after the texture clear
on Dispose ObservableSearch playground for onDisposeObservable
An event triggered when the texture is disposed.
on Load ObservableSearch playground for onLoadObservable
Observable triggered once the texture has been loaded.
on Resize ObservableSearch playground for onResizeObservable
An event triggered when the texture is resized.
optimizeUVAllocationSearch playground for optimizeUVAllocation
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)
render List PredicateSearch playground for renderListPredicate
Type declaration
Use this predicate to dynamically define the list of mesh you want to render. If set, the renderList property will be overwritten.
Parameters
AbstractMesh: AbstractMesh
Returns boolean
render ParticlesSearch playground for renderParticles
Define if particles should be rendered in your texture.
render Pass IdSearch playground for renderPassId
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!
render SpritesSearch playground for renderSprites
Define if sprites should be rendered in your texture.
reserved Data StoreSearch playground for reservedDataStore
For internal use only. Please do not use.
skip Initial ClearSearch playground for skipInitialClear
Skip the initial clear of the rtt at the beginning of the frame render loop
spherical PolynomialSearch playground for sphericalPolynomial
Get the polynomial representation of the texture data. This is mainly use as a fast way to recover IBL Diffuse irradiance data.
u AngSearch playground for uAng
Define an offset on the texture to rotate around the u coordinates of the UVs The angle is defined in radians.
u OffsetSearch playground for uOffset
Define an offset on the texture to offset the u coordinates of the UVs
u Rotation CenterSearch playground for uRotationCenter
Defines the center of rotation (U)
u ScaleSearch playground for uScale
Define an offset on the texture to scale the u coordinates of the UVs
unique IdSearch playground for uniqueId
Gets or sets the unique id of the texture
urlSearch playground for url
Define the url of the texture.
use Camera Post ProcessesSearch playground for useCameraPostProcesses
Define if camera post processes should be use while rendering the texture.
v AngSearch playground for vAng
Define an offset on the texture to rotate around the v coordinates of the UVs The angle is defined in radians.
v OffsetSearch playground for vOffset
Define an offset on the texture to offset the v coordinates of the UVs
v Rotation CenterSearch playground for vRotationCenter
Defines the center of rotation (V)
v ScaleSearch playground for vScale
Define an offset on the texture to scale the v coordinates of the UVs
w AngSearch playground for wAng
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.
w Rotation CenterSearch playground for wRotationCenter
Defines the center of rotation (W)
wrapRSearch playground for wrapR
Value | Type | Description |
---|---|---|
0 | CLAMP_ADDRESSMODE | |
1 | WRAP_ADDRESSMODE | |
2 | MIRROR_ADDRESSMODE |
Static Readonly BILINEAR_ SAMPLINGMODESearch playground for BILINEAR_SAMPLINGMODE
Bilinear is mag = linear and min = linear and no mip
Static Readonly CLAMP_ ADDRESSMODESearch playground for CLAMP_ADDRESSMODE
Texture is not repeating outside of 0..1 UVs
Static Readonly CUBIC_ MODESearch playground for CUBIC_MODE
Cubic coordinates mode
Static DEFAULT_ ANISOTROPIC_ FILTERING_ LEVELSearch playground for DEFAULT_ANISOTROPIC_FILTERING_LEVEL
Default anisotropic filtering level for the application. It is set to 4 as a good tradeoff between perf and quality.
Static Readonly EQUIRECTANGULAR_ MODESearch playground for EQUIRECTANGULAR_MODE
Equirectangular coordinates mode
Static Readonly EXPLICIT_ MODESearch playground for EXPLICIT_MODE
Explicit coordinates mode
Static Readonly FIXED_ EQUIRECTANGULAR_ MIRRORED_ MODESearch playground for FIXED_EQUIRECTANGULAR_MIRRORED_MODE
Equirectangular Fixed Mirrored coordinates mode
Static Readonly FIXED_ EQUIRECTANGULAR_ MODESearch playground for FIXED_EQUIRECTANGULAR_MODE
Equirectangular Fixed coordinates mode
Static Force Serialize BuffersSearch playground for ForceSerializeBuffers
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 Readonly INVCUBIC_ MODESearch playground for INVCUBIC_MODE
Inverse Cubic coordinates mode
Static Readonly LINEAR_ LINEARSearch playground for LINEAR_LINEAR
mag = linear and min = linear and mip = none
Static Readonly LINEAR_ LINEAR_ MIPLINEARSearch playground for LINEAR_LINEAR_MIPLINEAR
Trilinear is mag = linear and min = linear and mip = linear
Static Readonly LINEAR_ LINEAR_ MIPNEARESTSearch playground for LINEAR_LINEAR_MIPNEAREST
Bilinear is mag = linear and min = linear and mip = nearest
Static Readonly LINEAR_ NEARESTSearch playground for LINEAR_NEAREST
mag = linear and min = nearest and mip = none
Static Readonly LINEAR_ NEAREST_ MIPLINEARSearch playground for LINEAR_NEAREST_MIPLINEAR
mag = linear and min = nearest and mip = linear
Static Readonly LINEAR_ NEAREST_ MIPNEARESTSearch playground for LINEAR_NEAREST_MIPNEAREST
mag = linear and min = nearest and mip = nearest
Static Readonly MIRROR_ ADDRESSMODESearch playground for MIRROR_ADDRESSMODE
Texture is repeating and mirrored
Static Readonly NEAREST_ LINEARSearch playground for NEAREST_LINEAR
mag = nearest and min = linear and mip = none
Static Readonly NEAREST_ LINEAR_ MIPLINEARSearch playground for NEAREST_LINEAR_MIPLINEAR
mag = nearest and min = linear and mip = linear
Static Readonly NEAREST_ LINEAR_ MIPNEARESTSearch playground for NEAREST_LINEAR_MIPNEAREST
mag = nearest and min = linear and mip = nearest
Static Readonly NEAREST_ NEARESTSearch playground for NEAREST_NEAREST
mag = nearest and min = nearest and mip = none
Static Readonly NEAREST_ NEAREST_ MIPLINEARSearch playground for NEAREST_NEAREST_MIPLINEAR
nearest is mag = nearest and min = nearest and mip = linear
Static Readonly NEAREST_ NEAREST_ MIPNEARESTSearch playground for NEAREST_NEAREST_MIPNEAREST
mag = nearest and min = nearest and mip = nearest
Static Readonly NEAREST_ SAMPLINGMODESearch playground for NEAREST_SAMPLINGMODE
nearest is mag = nearest and min = nearest and no mip
Static On Texture Load Error ObservableSearch playground for OnTextureLoadErrorObservable
This observable will notify when any texture had a loading error
Static Readonly PLANAR_ MODESearch playground for PLANAR_MODE
Planar coordinates mode
Static Readonly PROJECTION_ MODESearch playground for PROJECTION_MODE
Projection coordinates mode
Static Readonly REFRESHRATE_ RENDER_ ONCESearch playground for REFRESHRATE_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 Readonly REFRESHRATE_ RENDER_ ONEVERYFRAMESearch playground for REFRESHRATE_RENDER_ONEVERYFRAME
The texture will only be rendered rendered every frame and is recommended for dynamic contents.
Static Readonly REFRESHRATE_ RENDER_ ONEVERYTWOFRAMESSearch playground for REFRESHRATE_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.
Static Readonly SKYBOX_ MODESearch playground for SKYBOX_MODE
Inverse Cubic coordinates mode
Static Readonly SPHERICAL_ MODESearch playground for SPHERICAL_MODE
Spherical coordinates mode
Static Serialize BuffersSearch playground for SerializeBuffers
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_ SAMPLINGMODESearch playground for TRILINEAR_SAMPLINGMODE
Trilinear is mag = linear and min = linear and mip = linear
Static Use Serialized Url If AnySearch playground for UseSerializedUrlIfAny
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_ ADDRESSMODESearch playground for WRAP_ADDRESSMODE
Texture is repeating outside of 0..1 UVs
Accessors
bounding Box Size
Gets or sets the size of the bounding box associated with the texture (when in cube mode) When defined, the cubemap will switch to local mode
Returns Vector3
Gets or sets the size of the bounding box associated with the texture (when in cube mode) When defined, the cubemap will switch to local mode
Parameters
value: Vector3
Returns void
can Rescale
Get if the texture can be rescaled or not.
Returns boolean
coordinates Index
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 void
coordinates Mode
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 void
current Refresh Id
Gets the current value of the refreshId counter
Returns number
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>
error Object
If a loading error occurred this object will be populated with information about the error.
Returns undefined | { exception?: any; message?: string }
gamma Space
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 void
get Alpha FromRGB
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 void
has Alpha
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 void
invertY
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>
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
value: Nullable<BaseTexture>
Returns void
is2DArray
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 void
is3D
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 void
is Blocking
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 void
is Cube
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 void
is Multi
Define if the texture has multiple draw buffers or if false a single draw buffer.
Returns boolean
isRGBD
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 void
linear SpecularLOD
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 void
loading Error
Was there any loading error?
Returns boolean
lod Generation Offset
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 void
lod Generation Scale
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 void
mime Type
Returns the texture mime type if it was defined by a loader (undefined else)
Returns undefined | string
no Mipmap
Are mip maps generated for this texture or not.
Returns boolean
on After Render
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)
Parameters
faceIndex: number
Returns void
Returns void
on After Unbind
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
Returns void
on Before Render
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)
Parameters
faceIndex: number
Returns void
Returns void
on Clear
on Dispose
Callback triggered when the texture has been disposed. Kept for back compatibility, you can use the onDisposeObservable instead.
Parameters
callback: (() => void)
Returns void
Returns void
post Processes
Post-processes for this render target
Returns PostProcess[]
refresh Rate
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 void
render List
Use this list to define the list of mesh you want to render.
Returns Nullable<AbstractMesh[]>
Use this list to define the list of mesh you want to render.
Parameters
value: Nullable<AbstractMesh[]>
Returns void
render Pass Ids
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 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
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 void
sampling Mode
Get the current sampling mode associated with the texture.
Returns number
texture Format
Get the texture underlying format (RGB, RGBA...)
Returns number
texture Type
Get the texture underlying type (INT, FLOAT...)
Returns number
uid
Define the unique id of the texture in the scene.
Returns string
wrapU
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 void
wrapV
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 void
Methods
add Post ProcessSearch playground for addPostProcess
Adds a post process to the render target rendering passes.
Parameters
postProcess: PostProcess
define the post process to add
Returns void
check Transforms Are IdenticalSearch playground for checkTransformsAreIdentical
clear Post ProcessesSearch playground for clearPostProcesses
Clear all the post processes attached to the render target
Parameters
Optional dispose: boolean
define if the cleared post processes should also be disposed (false by default)
Returns void
cloneSearch playground for clone
Clones the texture.
Returns RenderTargetTexture
the cloned texture
create Depth Stencil TextureSearch playground for createDepthStencilTexture
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 (default: 0)
Optional bilinearFiltering: boolean
Specifies whether or not bilinear filtering is enable on the texture (default: true)
Optional generateStencil: boolean
Specifies whether or not a stencil should be allocated in the texture (default: false)
Optional samples: number
sample count of the depth/stencil texture (default: 1)
Optional format: number
format of the depth texture (default: Constants.TEXTUREFORMAT_DEPTH32_FLOAT)
Returns void
disable RescalingSearch playground for disableRescaling
Don't allow this render target texture to rescale. Mainly used to prevent rescaling by the scene optimizer.
Returns void
disposeSearch playground for dispose
Dispose the texture and release its associated resources.
Returns void
dispose Framebuffer ObjectsSearch playground for disposeFramebufferObjects
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 RecomputeSearch playground for forceSphericalPolynomialsRecompute
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 GroupsSearch playground for freeRenderingGroups
Clear the info related to rendering groups preventing retention point in material dispose.
Returns void
get Base SizeSearch 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
get Class NameSearch playground for getClassName
Get the current class name of the texture useful for serialization or dynamic coding.
Returns string
"Texture"
get Internal TextureSearch playground for getInternalTexture
Get the underlying lower level texture from Babylon.
Returns Nullable<InternalTexture>
the internal texture
get Reflection Texture MatrixSearch playground for getReflectionTextureMatrix
Get the texture reflection matrix used to rotate/transform the reflection.
Returns Matrix
the reflection matrix
get Refraction Texture MatrixSearch playground for getRefractionTextureMatrix
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 HeightSearch playground for getRenderHeight
Gets the actual render height of the texture.
Returns number
the height of the render size
get Render LayersSearch playground for getRenderLayers
Gets the actual number of layers of the texture.
Returns number
the number of layers
get Render SizeSearch playground for getRenderSize
Gets the actual render size of the texture.
Returns number
the width of the render size
get Render WidthSearch playground for getRenderWidth
Gets the actual render width of the texture.
Returns number
the width of the render size
get SceneSearch playground for getScene
get SizeSearch playground for getSize
Get the size of the texture.
Returns ISize
the texture size.
get Texture MatrixSearch playground for getTextureMatrix
Get the current texture matrix which includes the requested offsetting, tiling and rotation components.
Parameters
Optional uBase: number
Returns Matrix
the transform matrix of the texture.
get View CountSearch playground for getViewCount
Gets the number of views the corresponding to the texture (eg. a MultiviewRenderTarget will have > 1)
Returns number
the view count
is ReadySearch playground for isReady
Get if the texture is ready to be used (downloaded, converted, mip mapped...).
Returns boolean
true if fully ready
is Ready For RenderingSearch playground for isReadyForRendering
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 BlockingSearch playground for isReadyOrNotBlocking
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 PixelsSearch playground for readPixels
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)
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.
release Internal TextureSearch playground for releaseInternalTexture
Release and destroy the underlying lower level texture aka internalTexture.
Returns void
remove Post ProcessSearch playground for removePostProcess
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
renderSearch playground for render
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
reset Refresh CounterSearch playground for resetRefreshCounter
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
resizeSearch playground for resize
Resize the texture to a new desired size. Be careful as it will recreate all the data in the new texture.
Parameters
size: number | { height: number; width: number } | { 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
scaleSearch playground for 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
serializeSearch playground for 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 RenderingSearch playground for setMaterialForRendering
Sets 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
Optional material: 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
set Rendering Auto Clear Depth StencilSearch playground for setRenderingAutoClearDepthStencil
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
set Rendering OrderSearch playground for setRenderingOrder
Overrides 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
Optional opaqueSortCompareFn: Nullable<((a: SubMesh, b: SubMesh) => number)>
The opaque queue comparison function use to sort.
Optional alphaTestSortCompareFn: Nullable<((a: SubMesh, b: SubMesh) => number)>
The alpha test queue comparison function use to sort.
Optional transparentSortCompareFn: Nullable<((a: SubMesh, b: SubMesh) => number)>
The transparent queue comparison function use to sort.
Returns void
to StringSearch playground for toString
Return a string representation of the texture.
Returns string
the texture as a string
update Sampling ModeSearch playground for updateSamplingMode
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
updateURLSearch playground for updateURL
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 | ArrayBufferView | Blob | ArrayBuffer | HTMLImageElement | ImageBitmap>
the buffer of the texture (defaults to null)
Optional onLoad: (() => void)
callback called when the texture is loaded (defaults to null)
Returns void
Optional forcedExtension: string
defines the extension to use to pick the right loader
Returns void
Static Create From Base64 StringSearch playground for CreateFromBase64String
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 noMipmapOrOptions: boolean | ITextureCreationOptions
defines if the texture will require mip maps or not or set of all options to create the texture
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 fetching from it (Texture.NEAREST_SAMPLINGMODE...)
Optional onLoad: Nullable<(() => void)>
define a callback triggered when the texture has been loaded
Optional onError: Nullable<(() => void)>
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...)
Optional creationFlags: number
specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)
Returns Texture
the created texture
Static Load From Data StringSearch playground for LoadFromDataString
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 noMipmapOrOptions: boolean | ITextureCreationOptions
defines if the texture will require mip maps or not or set of all options to create the texture
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 fetching from it (Texture.NEAREST_SAMPLINGMODE...)
Optional onLoad: Nullable<(() => void)>
define a callback triggered when the texture has been loaded
Optional onError: Nullable<((message?: string, exception?: any) => void)>
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...)
Optional creationFlags: number
specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)
Returns Texture
the created texture
Static ParseSearch playground for Parse
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 When All ReadySearch playground for WhenAllReady
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
Returns void
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...