Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well as prefiltered data.
the cube texture
defines the url of the texture or the root name of the six images
defines the scene or engine the texture is attached to
Optional
extensions: Nullable<string[]>defines the suffixes add to the picture name in case six images are in use like _px.jpg...
Optional
noMipmap: booleandefines if mipmaps should be created or not
Optional
files: Nullable<string[]>defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz
Optional
onLoad: Nullable<(() => void)>defines a callback triggered at the end of the file load if no errors occurred
Optional
onError: Nullable<((message?: string, exception?: any) => void)>defines a callback triggered in case of error during load
Optional
format: numberdefines the internal format to use for the texture once loaded
Optional
prefiltered: booleandefines whether or not the texture is created from prefiltered data
Optional
forcedExtension: anydefines the extensions to use (force a special type of file to load) in case it is different from the file name
Optional
createPolynomials: booleandefines whether or not to create polynomial harmonics from the texture data if necessary
Optional
lodScale: numberdefines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness
Optional
lodOffset: numberdefines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness
Optional
loaderOptions: anyoptions to be passed to the loader
Optional
useSRGBBuffer: booleanDefines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false)
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 cube texture. It must define where the camera used to render the texture was set
Define the current state of the loading sequence when in delayed load mode.
Is Z inverted in the texture (useful in a cube texture).
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
Gets or sets an object used to store user defined information.
Define the name of the texture.
An event triggered when the texture is disposed.
Observable triggered once the texture has been loaded.
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)
For internal use only. Please do not use.
Get the polynomial representation of the texture data. This is mainly use as a fast way to recover IBL Diffuse irradiance data.
Gets or sets the unique id of the texture
The url of the texture
Value | Type | Description |
---|---|---|
0 | CLAMP_ADDRESSMODE | |
1 | WRAP_ADDRESSMODE | |
2 | MIRROR_ADDRESSMODE |
Static
DEFAULT_Default anisotropic filtering level for the application. It is set to 4 as a good tradeoff between perf and quality.
Returns the bounding box size
Gets or sets the size of the bounding box associated with the cube texture When defined, the cubemap will switch to local mode
https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity
https://www.babylonjs-playground.com/#RNASML
Get if the texture can rescale.
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.
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 |
If a loading error occurred this object will be populated with information about the error.
Gets the forced extension (if any)
Define if the texture contains data in gamma space (most of the png/jpg aside bump). HDR texture are usually stored in linear space. This only impacts the PBR and Background materials
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).
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 2d array texture (webgl 2) or if false a 2d texture.
Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.
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.
Define if the texture is a cube texture or if false a 2d texture.
Gets or sets whether or not the texture contains RGBD data.
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.
Was there any loading error?
With prefiltered texture, defined the offset used during the prefiltering steps.
With prefiltered texture, defined the scale used during the prefiltering steps.
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.
Gets texture matrix rotation angle around Y axis radians.
Sets texture matrix rotation angle around Y axis in radians.
Get the current sampling mode associated with the texture.
Get the texture underlying format (RGB, RGBA...)
Get the texture underlying type (INT, FLOAT...)
Define the unique id of the texture in the scene.
Value | Type | Description |
---|---|---|
0 | CLAMP_ADDRESSMODE | |
1 | WRAP_ADDRESSMODE | |
2 | MIRROR_ADDRESSMODE |
Value | Type | Description |
---|---|---|
0 | CLAMP_ADDRESSMODE | |
1 | WRAP_ADDRESSMODE | |
2 | MIRROR_ADDRESSMODE |
Makes a clone, or deep copy, of the cube texture
a new cube texture
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.
The refraction matrix
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.
The Array buffer promise containing the pixels data.
Optional
faceIndex: numberdefines the face of the texture to read (in case of cube texture)
Optional
level: numberdefines 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: booleantrue to flush the renderer from the pending commands before reading the pixels
Optional
noDataConversion: booleanfalse 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: numberdefines the region x coordinates to start reading from (default to 0)
Optional
y: numberdefines the region y coordinates to start reading from (default to 0)
Optional
width: numberdefines the region width to read from (default to the texture size at level)
Optional
height: numberdefines the region width to read from (default to the texture size at level)
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
Optional
forcedExtension: stringdefines the extension to use
Optional
onLoad: Nullable<(() => void)>callback called when the texture is loaded (defaults to null)
Optional
prefiltered: booleanDefines whether the updated texture is prefiltered or not
Optional
onError: Nullable<((message?: string, exception?: any) => void)>callback called if there was an error during the loading process (defaults to null)
Optional
extensions: Nullable<string[]>defines the suffixes add to the picture name in case six images are in use like _px.jpg...
Optional
delayLoad: booleandefines if the texture should be loaded now (false by default)
Optional
files: Nullable<string[]>defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz
Static
CreateCreates a cube texture from an array of image urls
a cube texture
defines an array of image urls
defines the hosting scene
Optional
noMipmap: booleanspecifies if mip maps are not used
Static
CreateCreates and return a texture created from prefilterd data by tools like IBL Baker or Lys.
the prefiltered texture
defines the url of the prefiltered texture
defines the scene the texture is attached to
Optional
forcedExtension: anydefines the extension of the file if different from the url
Optional
createPolynomials: booleandefines whether or not to create polynomial harmonics from the texture data if necessary
Static
ParseParses text to create a cube texture
a cube texture
define the serialized text to read from
defines the hosting scene
defines the root url of the cube texture
Static
WhenHelper 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
Class for creating a cube texture