API Reference · Materials and textures

TextureFormat

Namespace: Ava3D

public enum TextureFormat

A block-compressed texture format, as the hardware stores it.

Why this exists. A texel of RGBA8 is four bytes, and a third again for its mip chain. A consumer of this control measured 58.7 Mtexels of surface across one ship, which is 224 MB by that arithmetic — and the whole of it decompresses on the card for free in one of the formats below, at a quarter to a sixth of the size. It is the largest single memory saving available anywhere in this library, and it is entirely a matter of accepting bytes that are already in the right shape.

Which format is a device question, not a preference. None of these is universal. BC is desktop and console; ETC2 is the GL ES 3.0 and WebGL 2 baseline; ASTC is where mobile went. So a caller either ships the one its target has, or ships more than one and asks — and RenderInfo.Features reports what this device took.

A format the device cannot take is decoded on the CPU and uploaded as RGBA8: larger and slower, and it says so, but never a wrong picture.

Values

ValueDescription
Rgba8

Uncompressed RGBA, eight bits a channel. What Texture.FromPixels produces.

Bc1

BC1 / DXT1: colour and one bit of alpha, at half a byte a texel. Desktop and console.

Bc3

BC3 / DXT5: colour with interpolated alpha, one byte a texel.

Bc4

BC4: one channel, half a byte a texel. For a height field or a mask.

Bc5

BC5: two channels, one byte a texel. The usual home for a tangent-space normal map.

Bc7

BC7: colour and alpha at one byte a texel, and the best of these on desktop.

Etc2Rgb

ETC2 RGB: half a byte a texel. Core in GL ES 3.0, and the WebGL 2 baseline.

Etc2Rgba

ETC2 RGBA: one byte a texel.

Astc4x4

ASTC at 4×4 blocks: one byte a texel. Where mobile went.

Astc8x8

ASTC at 8×8 blocks: a quarter of a byte a texel.

See also