Texture Constants — Soft8Soft
Description: List of texture constants used in Verge3D.

# Texture Constants

These constants define formats and rendering modes for textures.

- Mapping Modes
- Wrapping Modes
- Magnification Filters
- Minification Filters
- Texture Types
- Texture Formats
- DDS / ST3C Compressed Texture Formats
- PVRTC Compressed Texture Formats
- ETC Compressed Texture Formats
- ASTC Compressed Texture Formats
- BPTC Compressed Texture Formats
- Encoding

#

## Mapping Modes

`v3d.UVMapping v3d.CubeReflectionMapping v3d.CubeUVReflectionMapping`

These define the texture's mapping mode. UVMapping is the default, and maps the texture using the mesh's UV coordinates.

The rest define environment mapping types.

CubeReflectionMapping is for use with a CubeTexture, which is made up of six textures, one for each face of the cube. CubeReflectionMapping is the default for a CubeTexture.

#

## Wrapping Modes

`v3d.RepeatWrapping v3d.ClampToEdgeWrapping v3d.MirroredRepeatWrapping`

These define the texture's wrapS and wrapT properties, which define horizontal and vertical texture wrapping.

With RepeatWrapping the texture will simply repeat to infinity.

ClampToEdgeWrapping is the default. The last pixel of the texture stretches to the edge of the mesh.

With MirroredRepeatWrapping the texture will repeats to infinity, mirroring on each repeat.

#

## Magnification Filters

`v3d.NearestFilter v3d.LinearFilter`

For use with a texture's magFilter property, these define the texture magnification function to be used when the pixel being textured maps to an area less than or equal to one texture element (texel).

NearestFilter returns the value of the texture element that is nearest (in Manhattan distance) to the specified texture coordinates.

LinearFilter is the default and returns the weighted average of the four texture elements that are closest to the specified texture coordinates, and can include items wrapped or repeated from other parts of a texture, depending on the values of wrapS and wrapT, and on the exact mapping.

#

## Minification Filters

`v3d.NearestFilter v3d.NearestMipmapNearestFilter v3d.NearestMipmapLinearFilter v3d.LinearFilter v3d.LinearMipmapNearestFilter v3d.LinearMipmapLinearFilter`

For use with a texture's minFilter property, these define the texture minifying function that is used whenever the pixel being textured maps to an area greater than one texture element (texel).

In addition to NearestFilter and LinearFilter, the following four functions can be used for minification:

NearestMipmapNearestFilter chooses the mipmap that most closely matches the size of the pixel being textured and uses the NearestFilter criterion (the texel nearest to the center of the pixel) to produce a texture value.

NearestMipmapLinearFilter chooses the two mipmaps that most closely match the size of the pixel being textured and uses the NearestFilter criterion to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.

LinearMipmapNearestFilter chooses the mipmap that most closely matches the size of the pixel being textured and uses the LinearFilter criterion (a weighted average of the four texels that are closest to the center of the pixel) to produce a texture value.

LinearMipmapLinearFilter is the default and chooses the two mipmaps that most closely match the size of the pixel being textured and uses the LinearFilter criterion to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.

#

## Texture Types

`v3d.UnsignedByteType v3d.ByteType v3d.ShortType v3d.UnsignedShortType v3d.IntType v3d.UnsignedIntType v3d.FloatType v3d.HalfFloatType v3d.UnsignedShort4444Type v3d.UnsignedShort5551Type v3d.UnsignedInt248Type`

For use with a texture's type property, which must correspond to the correct format.

UnsignedByteType is the default.

#

## Texture Formats

`v3d.AlphaFormat v3d.RedFormat v3d.RedIntegerFormat v3d.RGFormat v3d.RGIntegerFormat v3d.RGBAFormat v3d.RGBAIntegerFormat v3d.LuminanceFormat v3d.LuminanceAlphaFormat v3d.DepthFormat v3d.DepthStencilFormat`

For use with a texture's format property, these define how elements of a 2D texture, or "texels", are read by shaders.

AlphaFormat discards the red, green and blue components and reads just the alpha component.

RedFormat discards the green and blue components and reads just the red component (can only be used with a WebGL 2 rendering context).

RedIntegerFormat discards the green and blue components and reads just the red component. The texels are read as integers instead of floating point (can only be used with a WebGL 2 rendering context).

RGFormat discards the alpha, and blue components and reads the red, and green components. (can only be used with a WebGL 2 rendering context).

RGIntegerFormat discards the alpha, and blue components and reads the red, and green components. The texels are read as integers instead of floating point (can only be used with a WebGL 2 rendering context).

RGBAFormat is the default and reads the red, green, blue and alpha components.

RGBAIntegerFormat is the default and reads the red, green, blue and alpha components. The texels are read as integers instead of floating point. (can only be used with a WebGL 2 rendering context).

LuminanceFormat reads each element as a single luminance component. This is then converted to a floating point, clamped to the range [0,1], and then assembled into an RGBA element by placing the luminance value in the red, green and blue channels, and attaching 1.0 to the alpha channel.

LuminanceAlphaFormat reads each element as a luminance/alpha double. The same process occurs as for the LuminanceFormat, except that the alpha channel may have values other than `1.0`.

DepthFormat reads each element as a single depth value, converts it to floating point, and clamps to the range [0,1]. This is the default for DepthTexture.

DepthStencilFormat reads each element is a pair of depth and stencil values. The depth component of the pair is interpreted as in DepthFormat. The stencil component is interpreted based on the depth + stencil internal format.

Note that the texture must have the correct type set, as described above. See WebGLRenderingContext.texImage2D for details.

#

## DDS / ST3C Compressed Texture Formats

`v3d.RGB_S3TC_DXT1_Format v3d.RGBA_S3TC_DXT1_Format v3d.RGBA_S3TC_DXT3_Format v3d.RGBA_S3TC_DXT5_Format`

For use with a CompressedTexture's format property, these require support for the WEBGL_compressed_texture_s3tc extension.

There are four S3TC formats available via this extension. These are:

RGB_S3TC_DXT1_Format: A DXT1-compressed image in an RGB image format.
RGBA_S3TC_DXT1_Format: A DXT1-compressed image in an RGB image format with a simple on/off alpha value.
RGBA_S3TC_DXT3_Format: A DXT3-compressed image in an RGBA image format. Compared to a 32-bit RGBA texture, it offers 4:1 compression.
RGBA_S3TC_DXT5_Format: A DXT5-compressed image in an RGBA image format. It also provides a 4:1 compression, but differs to the DXT3 compression in how the alpha compression is done.

#

## PVRTC Compressed Texture Formats

`v3d.RGB_PVRTC_4BPPV1_Format v3d.RGB_PVRTC_2BPPV1_Format v3d.RGBA_PVRTC_4BPPV1_Format v3d.RGBA_PVRTC_2BPPV1_Format`

For use with a CompressedTexture's format property, these require support for the WEBGL_compressed_texture_pvrtc extension. PVRTC is typically only available on mobile devices with PowerVR chipsets, which are mainly Apple devices.

There are four PVRTC formats available via this extension. These are:

RGB_PVRTC_4BPPV1_Format: RGB compression in 4-bit mode. One block for each 4×4 pixels.
RGB_PVRTC_2BPPV1_Format: RGB compression in 2-bit mode. One block for each 8×4 pixels.
RGBA_PVRTC_4BPPV1_Format: RGBA compression in 4-bit mode. One block for each 4×4 pixels.
RGBA_PVRTC_2BPPV1_Format: RGBA compression in 2-bit mode. One block for each 8×4 pixels.

#

## ETC Compressed Texture Formats

`v3d.RGB_ETC1_Format v3d.RGB_ETC2_Format v3d.RGBA_ETC2_EAC_Format`

For use with a CompressedTexture's format property, these require support for the WEBGL_compressed_texture_etc1 (ETC1) or WEBGL_compressed_texture_etc (ETC2) extensions.

#

## ASTC Compressed Texture Formats

`v3d.RGBA_ASTC_4x4_Format v3d.RGBA_ASTC_5x4_Format v3d.RGBA_ASTC_5x5_Format v3d.RGBA_ASTC_6x5_Format v3d.RGBA_ASTC_6x6_Format v3d.RGBA_ASTC_8x5_Format v3d.RGBA_ASTC_8x6_Format v3d.RGBA_ASTC_8x8_Format v3d.RGBA_ASTC_10x5_Format v3d.RGBA_ASTC_10x6_Format v3d.RGBA_ASTC_10x8_Format v3d.RGBA_ASTC_10x10_Format v3d.RGBA_ASTC_12x10_Format v3d.RGBA_ASTC_12x12_Format`

For use with a CompressedTexture's format property, these require support for the WEBGL_compressed_texture_astc extension.

#

## BPTC Compressed Texture Formats

`v3d.RGBA_BPTC_Format`

For use with a CompressedTexture's format property, these require support for the EXT_texture_compression_bptc extension.

#

## Encoding

`v3d.LinearEncoding v3d.sRGBEncoding v3d.BasicDepthPacking v3d.RGBADepthPacking v3d.LinearDepthPacking v3d.RGBADistancePacking v3d.ESMDistancePacking`

For use with a Texture's encoding property.

If the encoding type is changed after the texture has already been used by a material, you will need to set Material.needsUpdate to `true` to make the material recompile.

LinearEncoding is the default. Values other than this are only valid for a material's `map`, `envMap` and `emissiveMap`.

## Source

For more info on how to obtain the source code of this module see this page.