Creates a video texture. If you want to display a video in your scene, this is the special texture for that. This special texture works similar to other textures, with the exception of a few parameters.
optional name, will detect from video source, if not defined
can be used to provide an url, array of urls or an already setup HTML video element.
is obviously the current scene.
can be used to turn on mipmaps (Can be expensive for videoTextures because they are often updated).
is false by default but can be used to invert video on Y axis
controls the sampling method and is set to TRILINEAR_SAMPLINGMODE by default
allows finer control over video usage
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.
Tells whether textures will be updated automatically or user is required to call updateTexture
manually
Get if the texture can rescale.
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.
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 |
Define the current state of the loading sequence when in delayed load mode.
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).
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.
Define if the texture is a cube texture or if false a 2d texture.
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.
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.
Event triggerd when a dom action is required by the user to play the video. This happens due to recent changes in browser policies preventing video to auto start.
For internal use only. Please do not use.
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 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
The video instance used by the texture internally
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
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
Clones the texture.
the cloned texture
Dispose the texture and release its associated resources.
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 current matrix used to apply reflection. This is useful to rotate an environment texture for instance.
The reflection texture transform
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.
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.
Scales the texture if is canRescale()
the resize factor we want to use to rescale
Serialize the texture to a JSON representation we can easily use in the resepective Parse function.
The JSON representation of the texture
Return a string representation of the texture.
the texture as a string
Update Texture in the auto
mode. Does not do anything if settings.autoUpdateTexture
is false.
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 Texture in manual
mode. Does not do anything if not visible or paused.
Visibility state, detected by user using scene.getActiveMeshes()
or othervise.
Change video content. Changing video instance or setting multiple urls (as in constructor) is not supported.
New url.
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 video texture straight from a stream.
Define the scene the texture should be created in
Define the stream the texture should be created from
The created video texture as a promise
Creates a video texture straight from your WebCam video feed.
Define the scene the texture should be created in
Define a callback to triggered once the texture will be ready
Define the constraints to use to create the web cam feed from WebRTC
Define the audio constraints to use to create the web cam feed from WebRTC
Creates a video texture straight from your WebCam video feed.
Define the scene the texture should be created in
Define the constraints to use to create the web cam feed from WebRTC
Define the audio constraints to use to create the web cam feed from WebRTC
The created video texture as a promise
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
If you want to display a video in your scene, this is the special texture for that. This special texture works similar to other textures, with the exception of a few parameters.
https://doc.babylonjs.com/how_to/video_texture