Format:Basis Universal (.basis)
| Magic | 73 42 ("sB") |
|---|---|
| Extensions | .basis |
| On this wiki | Facts · Code · Notes · Topics |
Binomial's Basis Universal supercompressed texture file (.basis): a packed header with the signature 'sB', a texture format (ETC1S, UASTC and later ASTC/XUASTC variants), codebook and slice tables, transcoded at load time to the GPU's native block format.
Identification
A .basis file starts with the 2-byte signature "sB" (bytes 73 42; the source defines cBASISSigValue = ('B' << 8) | 's'), a 2-byte version (first version 0x10) and the header size. The structure is packed with 1-byte alignment and its integers are 1 to 4 bytes wide (several are 3 bytes). Summing the declared fields gives 77 bytes (computed here, not stated by the source). Unverified: the integers are little-endian.
Header fields in order: sig u16, ver u16, header_size u16, header_crc16 u16, data_size u32, data_crc16 u16, total_slices u24, total_images u24, tex_format u8, flags u16, tex_type u8, us_per_frame u24, reserved u32, userdata0 u32, userdata1 u32, total_endpoints u16, endpoint_cb_file_ofs u32, endpoint_cb_file_size u24, total_selectors u16, selector_cb_file_ofs u32, selector_cb_file_size u24, tables_file_ofs u32, tables_file_size u32, slice_desc_file_ofs u32, extended_file_ofs u32, extended_file_size u32.
Texture format and flags
tex_format: 0 ETC1S, 1 UASTC LDR 4x4, 2 UASTC HDR 4x4, 3 ASTC HDR 6x6, 4 UASTC HDR 6x6 intermediate, 5-18 XUASTC LDR (4x4 through 12x12), 19-32 ASTC LDR (4x4 through 12x12), 33 XUBC7. Header flags: 1 ETC1S (always set for ETC1S, never for UASTC), 2 Y-flipped, 4 has alpha slices, 8 uses a global codebook from another file, 16 sRGB. Texture type: 0 2D, 1 2D array, 2 cubemap array, 3 video frames, 4 volume.
Slices
An array of slice descriptors (at slice_desc_file_ofs) gives for each slice: image index u24, level index u8, flags u8 (1 has alpha, 2 video I-frame), original width and height u16, block counts x and y u16, file offset u32, file size u32 and a CRC16. For ETC1S with alpha, the odd slices hold the alpha data.
In KTX 2
The same codecs are carried in Format:KTX and KTX2 (Khronos texture) (ETC1S with BasisLZ, or UASTC), the form most engines ship. Unverified: which engines accept raw .basis files at runtime.
Code & repositories
- https://github.com/BinomialLLC/basis_universal @
1706f948a2f0992d7a6dc2a909f35690b508571c· license: Apache-2.0
Basis Universal encoder/transcoder; transcoder/basisu_file_headers.h defines the .basis header; Apache-2.0
Tested on: source read, not run: source read, no build · checked 2026-10-19; last activity 2026-10-16