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...
The friendly name of the texture
The size of the RTT (number if square, or {width: number, height:number} or {ratio:} to define a ratio from the main scene)
The scene the RTT belongs to. The latest created scene will be used if not precised.
True if mip maps need to be generated after render.
True to not change the aspect ratio of the scene in the RTT
The type of the buffer in the RTT (int, half float, float...)
True if a cube texture needs to be created
The sampling mode to be usedwith the render target (Linear, Nearest...)
True to generate a depth buffer
True to generate a stencil buffer
True if multiple textures need to be created (Draw Buffers)
The internal format of the buffer in the RTT (RED, RG, RGB, RGBA, ALPHA...)
if the texture allocation should be delayed (default: false)
Define the camera used to render the texture.
Define the list of animation attached to the texture.
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.
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
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
Get if the texture can be rescaled or not.
Define the clear color of the Render Target if it should be different from the scene.
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.
Override the default coordinates mode to projection for RTT as it is the most common case for rendered textures.
Override the render function of the texture with your own one.
Define the current state of the loading sequence when in delayed load mode.
In case the RTT has been created with a depth texture, get the associated depth texture. Otherwise, return null.
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
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.
Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).
Define if the camera viewport should be respected while rendering the texture or if the render should be done to the entire texture.
List of inspectable custom properties (used by the Inspector)
Gets a boolean indicating if the texture needs to be inverted on the y axis during loading
Is Z inverted in the texture (useful in a cube 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).
Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.
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.
Gets whether or not the texture contains RGBD data.
Define if the texture is a render target.
Intensity or strength of the texture. It is commonly used by materials to fine tune the intensity of the texture
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.
With prefiltered texture, defined the offset used during the prefiltering steps.
With prefiltered texture, defined the scale used during the prefiltering steps.
Gets or sets an object used to store user defined information.
Define the name of the texture.
Are mip maps generated for this texture or not.
Set a after render callback in the texture. This has been kept for backward compatibility and use of onAfterRenderObservable is recommended.
An event triggered after rendering the texture
Set a after unbind callback in the texture. This has been kept for backward compatibility and use of onAfterUnbindObservable is recommended.
An event triggered when the texture is unbind.
An event triggered when the texture is unbind.
Set a before render callback in the texture. This has been kept for backward compatibility and use of onBeforeRenderObservable is recommended.
An event triggered before rendering the texture
Set a clear callback in the texture. This has been kept for backward compatibility and use of onClearObservable is recommended.
An event triggered after the texture clear
Callback triggered when the texture has been disposed. Kept for back compatibility, you can use the onDisposeObservable instead.
An event triggered when the texture is disposed.
Observable triggered once the texture has been loaded.
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...
Use this list to define the list of mesh you want to render.
Use this predicate to dynamically define the list of mesh you want to render. If set, the renderList property will be overwritten.
Define if particles should be rendered in your texture.
Define if sprites should be rendered in your texture.
Gets render target creation options that were used.
For internal use only. Please do not use.
Define the number of samples to use in case of MSAA. It defaults to one meaning no MSAA has been enabled.
Get the current sampling mode associated with the texture.
Get the polynomial representation of the texture data. This is mainly use as a fast way to recover IBL Diffuse irradiance data.
Get the texture underlying format (RGB, RGBA...)
Get the texture underlying type (INT, FLOAT...)
Define an offset on the texture to rotate around the u coordinates of the UVs
Define an offset on the texture to offset the u coordinates of the UVs
Defines the center of rotation (U)
Define an offset on the texture to scale the u coordinates of the UVs
Define the unique id of the texture in the scene.
Gets or sets the unique id of the texture
Define the url of the texture.
Define if camera post processes should be use while rendering the texture.
Define an offset on the texture to rotate around the v coordinates of the UVs
Define an offset on the texture to offset the v coordinates of the UVs
Defines the center of rotation (V)
Define an offset on the texture to scale the v coordinates of the UVs
Define an offset on the texture to rotate around the w coordinates of the UVs (in case of 3d texture)
Defines the center of rotation (W)
Value | Type | Description |
---|---|---|
0 | CLAMP_ADDRESSMODE | |
1 | WRAP_ADDRESSMODE | |
2 | MIRROR_ADDRESSMODE |
Value | Type | Description |
---|---|---|
0 | CLAMP_ADDRESSMODE | |
1 | WRAP_ADDRESSMODE | |
2 | MIRROR_ADDRESSMODE |
Value | Type | Description |
---|---|---|
0 | CLAMP_ADDRESSMODE | |
1 | WRAP_ADDRESSMODE | |
2 | MIRROR_ADDRESSMODE |
Bilinear is mag = linear and min = linear and mip = nearest
Texture is not repeating outside of 0..1 UVs
Cubic coordinates mode
Default anisotropic filtering level for the application. It is set to 4 as a good tradeoff between perf and quality.
Equirectangular coordinates mode
Explicit coordinates mode
Equirectangular Fixed Mirrored coordinates mode
Equirectangular Fixed coordinates mode
Inverse Cubic coordinates mode
mag = linear and min = linear and mip = none
Trilinear is mag = linear and min = linear and mip = linear
Bilinear is mag = linear and min = linear and mip = nearest
mag = linear and min = nearest and mip = none
mag = linear and min = nearest and mip = linear
mag = linear and min = nearest and mip = nearest
Texture is repeating and mirrored
mag = nearest and min = linear and mip = none
mag = nearest and min = linear and mip = linear
mag = nearest and min = linear and mip = nearest
mag = nearest and min = nearest and mip = none
nearest is mag = nearest and min = nearest and mip = linear
mag = nearest and min = nearest and mip = nearest
nearest is mag = nearest and min = nearest and mip = linear
Planar coordinates mode
Projection coordinates mode
The texture will only be rendered once which can be useful to improve performance if everything in your render is static for instance.
The texture will only be rendered rendered every frame and is recomended for dynamic contents.
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.
Inverse Cubic coordinates mode
Spherical coordinates mode
Trilinear is mag = linear and min = linear and mip = linear
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
Texture is repeating outside of 0..1 UVs
Adds a post process to the render target rendering passes.
define the post process to add
Clear all the post processes attached to the render target
define if the cleared post processesshould also be disposed (false by default)
Clones the texture.
the cloned texture
Creates a depth stencil texture. This is only available in WebGL 2 or with the depth texture extension available.
Specifies the comparison function to set on the texture. If 0 or undefined, the texture is not in comparison mode
Specifies whether or not bilinear filtering is enable on the texture
Specifies whether or not a stencil should be allocated in the texture
Dispose the texture and release its associated resources.
This will remove the attached framebuffer objects. The texture will not be able to be used as render target anymore
Clear the info related to rendering groups preventing retention point in material dispose.
Get the base size of the texture. It can be different from the size if the texture has been resized for POT for instance
the base size
Get the current class name of the texture useful for serialization or dynamic coding.
"Texture"
Get the underlying lower level texture from Babylon.
the insternal texture
Get the texture reflection matrix used to rotate/transform the reflection.
the reflection matrix
Gets the actual render height of the texture.
the height of the render size
Gets the actual render size of the texture.
the width of the render size
Gets the actual render width of the texture.
the width of the render size
Get the size of the texture.
the texture size.
Get the current texture matrix which includes the requested offsetting, tiling and rotation components.
the transform matrix of the texture.
Gets the number of views the corresponding to the texture (eg. a MultiviewRenderTarget will have > 1)
the view count
Get if the texture is ready to be used (downloaded, converted, mip mapped...).
true if fully ready
Get if the texture is ready to be consumed (either it is ready or it is not blocking)
true if ready or not blocking
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.
defines the face of the texture to read (in case of cube texture)
defines the LOD level of the texture to read (in case of Mip Maps)
defines a user defined buffer to fill with data (can be null)
The Array buffer containing the pixels data.
Release and destroy the underlying lower level texture aka internalTexture.
Remove one of the post process from the list of attached post processes to the texture
define the post process to remove from the list
Renders all the objects from the render list into the texture.
Define if camera post processes should be used during the rendering
Define if the rendering result should be dumped (copied) for debugging purpose
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.
Resize the texture to a new desired size. Be carrefull as it will recreate all the data in the new texture.
Define the new size. It can be:
Resize the texture using a ratio.
the ratio to apply to the texture size in order to compute the new target size
Serialize the texture to a JSON representation we can easily use in the resepective Parse function.
The JSON representation of the texture
Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
The rendering group id corresponding to its index
Automatically clears depth and stencil between groups if true.
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.
The rendering group id corresponding to its index
The opaque queue comparison function use to sort.
The alpha test queue comparison function use to sort.
The transparent queue comparison function use to sort.
Return a string representation of the texture.
the texture as a string
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
Define the new sampling mode of the texture
Update the url (and optional buffer) of this texture if url was null during construction.
the url of the texture
the buffer of the texture (defaults to null)
callback called when the texture is loaded (defaults to null)
Creates a texture from its base 64 representation.
Define the base64 payload without the data: prefix
Define the name of the texture in the scene useful fo caching purpose for instance
Define the scene the texture should belong to
Forces the texture to not create mip map information if true
define if the texture needs to be inverted on the y axis during loading
define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)
define a callback triggered when the texture has been loaded
define a callback triggered when an error occurred during the loading session
define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)
the created texture
Creates a texture from its data: representation. (data: will be added in case only the payload has been passed in)
Define the name of the texture in the scene useful fo caching purpose for instance
define the buffer to load the texture from in case the texture is loaded from a buffer representation
Define the scene the texture should belong to
define if the buffer we are loading the texture from should be deleted after load
Forces the texture to not create mip map information if true
define if the texture needs to be inverted on the y axis during loading
define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)
define a callback triggered when the texture has been loaded
define a callback triggered when an error occurred during the loading session
define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)
the created texture
Parse the JSON representation of a texture in order to recreate the texture in the given scene.
Define the JSON representation of the texture
Define the scene the parsed texture should be instantiated in
Define the root url of the parsing sequence in the case of relative dependencies
The parsed texture if successful
Helper function to be called back once a list of texture contains only ready textures.
Define the list of textures to wait for
Define the callback triggered once the entire list will be ready
Generated using TypeDoc
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...