Skip to content

Texture Format

Color attachments, such as colortex and shadowcolor buffers, store values in a specific format. The default format is RGBA (which equates to RGBA8 on most systems), however a shader pack can specify the format and precision of each color attachment.

The format for any color attachement can be set using the <bufferName>Format directive.

The available texture formats and their meanings are described below:

Normalized

Normalized buffers can store “floating point” values in a fixed range, between 0.0 and 1.0 (inclusive). The values are not actually stored as floating point internally, but as an integer value. However, the result is converted to a floating point during read/write to a color attachment using a normalized format, so the shader will read/write floating point values to the attachments, however any values outside of the range will be clamped to fit in the range.

8-bit16-bitmixed
R8R16RGB5_A1
RG8RG16RGB10_A2
RGB8RGB16
RGBA8RGBA16

Signed Normalized

Signed Normalized buffers are identical to normalized buffers, however the range they can represent is expanded to -1 to 1 inclusive, allowing them to store negative values.

8-bit16-bit
R8_SNORMR16_SNORM
RG8_SNORMRG16_SNORM
RGB8_SNORMRGB16_SNORM
RGBA8_SNORMRGBA16_SNORM

Floating Point

Floating point buffers allow the attachment to store full floating point values. They are only available with larger than default precision due to the increased storage needed for floating point values. However they offer a significantly larger range of values, allowing the storing of HDR values.

16-bit32-bitmixed
R16FR32FRGB9_E5
RG16FRG32FR11F_G11F_B10F
RGB16FRGB32F
RGBA16FRGBA32F

The RGB9_E5 format uses a 5-bit exponent for all three terms (R, G, and B), where each component has a 9 bit mantissa. This allows significantly more precision than the R11F_G11F_B10F, which only has 6 to 5 bits of precision per component, however R11F_G11F_B10F has individual exponents for each component. For more information on these format types, see the OpenGL Wiki

Signed Integer

Signed Integer buffers allow storing signed integers, just like the tin says. These are standard two’s complement integers, which means they can store negative values.

8-bit16-bit32-bit
R8IR16IR32I
RG8IRG16IRG32I
RGB8IRGB16IRGB32I
RGBA8IRGBA16IRGBA32I

Unsigned Integer

Unsigned Integer buffers allow storing of unsigned integers, which will not be interpreted as negative values (although they can be cast to signed integers after being read). As such they do not directly allow the storage of negative integers, but have double the range of their signed cousins in the positive domain.

8-bit16-bit32-bit
R8UIR16UIR32UI
RG8UIRG16UIRG32UI
RGB8UIRGB16UIRGB32UI
RGBA8UIRGBA16UIRGBA32UI

Pixel Formats

Pixel formats are used to describe the layout of the data in a texture. These are used when defining custom textures and custom images. The following formats are available:

name
RED
RG
RGB
BGR
RGBA
BGRA

When using integer buffers, append _INTEGER to the format:

name
RED_INTEGER
RG_INTEGER
RGB_INTEGER
BGR_INTEGER
RGBA_INTEGER
BGRA_INTEGER

Pixel Types

Pixel types are used to describe the format/memory representation of each component of the data in a texture. These are used when defining custom textures and images. The following formats are available:

name
BYTE
SHORT
INT
HALF_FLOAT
FLOAT
UNSIGNED_BYTE
UNSIGNED_BYTE_3_3_2
UNSIGNED_BYTE_2_3_3_REV
UNSIGNED_SHORT
UNSIGNED_SHORT_5_6_5
UNSIGNED_SHORT_5_6_5_REV
UNSIGNED_SHORT_4_4_4_4
UNSIGNED_SHORT_4_4_4_4_REV
UNSIGNED_SHORT_5_5_5_1
UNSIGNED_SHORT_1_5_5_5_REV
UNSIGNED_INT
UNSIGNED_INT_8_8_8_8
UNSIGNED_INT_8_8_8_8_REV
UNSIGNED_INT_10_10_10_2
UNSIGNED_INT_2_10_10_10_REV