self:compress

Client

Compresses the texture using GPU block-compression, significantly reducing VRAM usage


Syntax

local status = self:compress(
    mode
)

Compression is irreversible. Unlike self:convert, once a texture is compressed with GPU block-compression it cannot be converted or compressed again.

  • Use convert — for quick, reversible VRAM savings, or a specific channel layout.
  • Use compress — for maximum VRAM savings on a finished asset that won't need further format changes.
  • Combining both — convert first if you need a specific format, then compress; compression locks the texture afterward.

Parameters

TypeNameDescription
core.texture.compression_modemodeTarget compression mode

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Compress a desktop texture with S3TC
local entity = core.texture.create("assets/diffuse.png")

entity:compress(core.texture.compression_mode.S3TC)
Compress an alpha texture with high quality BPTC
local entity = core.texture.create("assets/sprite.png")

entity:compress(core.texture.compression_mode.BPTC)
Compress an HDR sky texture with BPTC
local entity = core.texture.create("assets/sky/panorama.hdr")

entity:compress(core.texture.compression_mode.BPTC)

On this page