File: Texture.md | Updated: 11/15/2025
Base class for all textures.
Note: After the initial use of a texture, its dimensions, format, and type cannot be changed. Instead, call Texture#dispose on the texture and instantiate a new one.
Constructs a new texture.
image | The image holding the texture data. Default is Texture.DEFAULT_IMAGE.
---|---
mapping | The texture mapping. Default is Texture.DEFAULT_MAPPING.
wrapS | The wrapS value. Default is ClampToEdgeWrapping.
wrapT | The wrapT value. Default is ClampToEdgeWrapping.
magFilter | The mag filter value. Default is LinearFilter.
minFilter | The min filter value. Default is LinearMipmapLinearFilter.
format | The texture format. Default is RGBAFormat.
type | The texture type. Default is UnsignedByteType.
anisotropy | The anisotropy value. Default is Texture.DEFAULT_ANISOTROPY.
colorSpace | The color space. Default is NoColorSpace.
The number of samples taken along the axis through the pixel that has the highest density of texels. By default, this value is 1. A higher value gives a less blurry result than a basic mipmap, at the cost of more texture samples being used.
Default is 0.
The point around which rotation occurs. A value of (0.5, 0.5) corresponds to the center of the texture. Default is (0, 0), the lower left.
Default is (0,0).
Lets you select the uv attribute to map the texture to. 0 for uv, 1 for uv1, 2 for uv2 and 3 for uv3.
Default is 0.
Textures containing color data should be annotated with SRGBColorSpace or LinearSRGBColorSpace.
Default is NoColorSpace.
The depth of the texture in pixels.
If set to true, the texture is flipped along the vertical axis when uploaded to the GPU.
Note that this property has no effect when using ImageBitmap. You need to configure the flip on bitmap creation instead.
Default is true.
The format of the texture.
Default is RGBAFormat.
Whether to generate mipmaps (if possible) for a texture.
Set this to false if you are creating mipmaps manually.
Default is true.
The height of the texture in pixels.
The ID of the texture.
The image object holding the texture data.
The default internal format is derived from Texture#format and Texture#type and defines how the texture data is going to be stored on the GPU.
This property allows to overwrite the default format.
Default is null.
Indicates if a texture should be handled like a texture array.
Default is false.
Indicates whether a texture belongs to a render target or not.
Default is false.
This flag can be used for type testing.
Default is true.
How the texture is sampled when a texel covers more than one pixel.
Default is LinearFilter.
How the texture is applied to the object. The value UVMapping is the default, where texture or uv coordinates are used to apply the map.
Default is UVMapping.
The uv-transformation matrix of the texture.
Whether to update the texture's uv-transformation Texture#matrix from the properties Texture#offset, Texture#repeat, Texture#rotation, and Texture#center.
Set this to false if you are specifying the uv-transform matrix directly.
Default is true.
How the texture is sampled when a texel covers less than one pixel.
Default is LinearMipmapLinearFilter.
An array holding user-defined mipmaps.
The name of the material.
Setting this property to true indicates the engine the PMREM must be regenerated.
Default is false.
Setting this property to true indicates the engine the texture must be updated in the next render. This triggers a texture upload to the GPU and ensures correct texture parameter configuration.
Default is false.
How much a single repetition of the texture is offset from the beginning, in each direction U and V. Typical range is 0.0 to 1.0.
Default is (0,0).
A callback function, called when the texture is updated (e.g., when Texture#needsUpdate has been set to true and then the texture is used).
Default is null.
Indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures).
Default is 0.
If set to true, the alpha channel, if present, is multiplied into the color channels when the texture is uploaded to the GPU.
Note that this property has no effect when using ImageBitmap. You need to configure premultiply alpha on bitmap creation instead.
Default is false.
An optional back reference to the textures render target.
Default is null.
How many times the texture is repeated across the surface, in each direction U and V. If repeat is set greater than 1 in either direction, the corresponding wrap parameter should also be set to RepeatWrapping or MirroredRepeatWrapping to achieve the desired tiling effect.
Default is (1,1).
How much the texture is rotated around the center point, in radians. Positive values are counter-clockwise.
Default is 0.
The data definition of a texture. A reference to the data source can be shared across textures. This is often useful in context of spritesheets where multiple textures render the same data but with different texture transformations.
The data type of the texture.
Default is UnsignedByteType.
Specifies the alignment requirements for the start of each pixel row in memory. The allowable values are 1 (byte-alignment), 2 (rows aligned to even-numbered bytes), 4 (word-alignment), and 8 (rows start on double-word boundaries).
Default is 4.
This can be used to only update a subregion or specific rows of the texture (for example, just the first 3 rows). Use the addUpdateRange() function to add ranges to this array.
An object that can be used to store custom data about the texture. It should not hold references to functions as these will not be cloned.
The UUID of the material.
This starts at 0 and counts how many times Texture#needsUpdate is set to true.
Default is 0.
The width of the texture in pixels.
This defines how the texture is wrapped horizontally and corresponds to U in UV mapping.
Default is ClampToEdgeWrapping.
This defines how the texture is wrapped horizontally and corresponds to V in UV mapping.
Default is ClampToEdgeWrapping.
The default anisotropy value for all textures.
Default is 1.
The default image for all textures.
Default is null.
The default mapping for all textures.
Default is UVMapping.
Adds a range of data in the data texture to be updated on the GPU.
start | Position at which to start update.
---|---
count | The number of components to update.
Clears the update ranges.
Returns a new texture with copied values from this instance.
Returns: A clone of this instance.
Copies the values of the given texture to this instance.
source | The texture to copy.
---|---
Returns: A reference to this instance.
Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
Sets this texture's properties based on values.
values | A container with texture parameters.
---|---
Serializes the texture into JSON.
meta | An optional value holding meta information about the serialization.
---|---
See:
Returns: A JSON object representing the serialized texture.
Transforms the given uv vector with the textures uv transformation matrix.
uv | The uv vector.
---|---
Returns: The transformed uv vector.
Updates the texture transformation matrix from the from the properties Texture#offset, Texture#repeat, Texture#rotation, and Texture#center.
Fires when the texture has been disposed of.