Skip to content

WebP vs KTX2 Textures: Why a Bigger Download Can Use Less GPU Memory in Browser Games

abe ·

A WebP texture can make your 3D model smaller to download but four times heavier on the GPU. Here is how KTX2 flips that trade-off, with real numbers from 1,033 scanned objects.

VENO cover: a 3D texture card and GPU chip with the title WebP vs KTX2, less GPU memory

WebP vs KTX2 is really a question about two different budgets. WebP makes a texture small on the network, but the browser has to unpack it into raw pixels before the GPU can use it. KTX2 stays compressed on the graphics card, so a file that is slightly bigger to download can take about four times less video memory while your game is running.

That gap matters for every web game that shows 3D models, especially on phones with little memory. Below we walk through the numbers, the reason behind them and a practical setup you can copy.

Quick facts
Topic Texture formats for 3D models in browser games
Formats compared WebP (image format) vs KTX2 (GPU texture container)
Test data 1,033 scanned household objects, each in a WebP and a KTX2 version
Median GPU memory per object 21.5 MiB with WebP, 5.5 MiB with KTX2
Median file size per object 297 KiB with WebP, 336 KiB with KTX2
Measured on RTX 3060, headless Chrome, three.js r187 (phones and Safari not measured)
Licence of the models CC BY 4.0, scans by Google Research

Two budgets: bytes on the wire and bytes in VRAM

When a player opens your game, a texture costs you twice. First it travels over the network, and that is what tools like Lighthouse and your CDN bill show. Then it is uploaded to the GPU and sits in video memory (VRAM) for as long as the model is on screen. The two numbers answer different questions, and a format that wins the first one can lose the second.

The clearest public example right now is the Scanned Objects GLB collection on Hugging Face. It packs the 1,033 household products from Google Scanned Objects as web-ready .glb files, and it ships every object twice: once with 2048 px WebP textures and once with KTX2 textures.

A grid of more than a thousand 3D-scanned household products, from shoes to toys and board games; image: Google Research scans, CC BY 4.0

Take one object, a wooden block-stacking tower game. We downloaded both versions: the WebP file is 231,924 bytes and the KTX2 file is 309,316 bytes. On the wire, WebP wins by about a quarter.

A 3D-scanned wooden block tower rendered in three.js, the model used for the WebP vs KTX2 test; scan: Google Research, CC BY 4.0

Why WebP grows on the GPU

GPUs cannot read WebP, PNG or JPEG directly. The browser decodes the image into plain pixels first, usually RGBA8: 4 bytes for every pixel.

Here is the math for one 2048 × 2048 texture:

  1. 2048 × 2048 = 4,194,304 pixels.
  2. At 4 bytes per pixel, the full-size level takes 16 MiB.
  3. Games also need mipmaps (smaller copies for distant objects). The whole chain adds about one third, so roughly 21.3 MiB.

Notice what is missing: the WebP quality setting. Lowering it shrinks the download, but once decoded, the texture is still 2048 × 2048 × 4 bytes. Compression quality changes the network bill, not the VRAM bill.

How KTX2 stays small in VRAM

KTX2 is a texture container from the Khronos Group, the standards body behind glTF and WebGL. In 3D models it is used through the glTF extension KHR_texture_basisu. Its trick is Basis Universal “supercompression”: the file holds an intermediate format that the loader quickly transcodes into whatever block-compressed format the player’s GPU supports, such as BC7 on desktop graphics cards or ASTC and ETC2 on many phones.

Block compression stores every 4 × 4 group of pixels in a fixed number of bytes. With BC7 that is 16 bytes per block, compared with 64 bytes for the same 16 pixels in RGBA8.

A 4 by 4 pixel block stored as 64 bytes in RGBA8 versus 16 bytes in BC7 block compression

Apply that to the same 2048 px texture: the top level becomes 4 MiB, and with the full mip chain about 5.3 MiB. The GPU samples these blocks directly, so the texture never expands back to raw pixels.

Bar chart: the WebP model is smaller to download (227 KiB vs 302 KiB) but uses 21.3 MiB of GPU memory against 5.3 MiB for KTX2

The results across 1,033 objects

The collection’s authors measured every level on an RTX 3060 in headless Chrome with three.js r187, counting texture and geometry bytes as uploaded. On that GPU the KTX2 files were transcoded to BC7.

Version Triangles kept Texture GPU memory (median) File size (median)
WebP pack 100% 2048 px WebP 21.5 MiB 297 KiB
KTX2 lod0 100% 2048 px KTX2 5.5 MiB 336 KiB
KTX2 lod1 50% 1024 px 1.4 MiB 129 KiB
KTX2 lod2 20% 512 px 0.38 MiB 56 KiB
KTX2 lod3 6% 256 px 0.10 MiB 22 KiB

Loading was faster too. With three.js WebGPURenderer, the median object loaded in 41.3 ms as WebP and 23.2 ms as KTX2, and reached its first frame in 48.1 ms versus 27.0 ms. The authors note the GPU was shared with other jobs, so treat the ratios as more reliable than the exact milliseconds.

The download result is not fixed either. For the board-game box in the same set, the KTX2 file (559,180 bytes) is smaller than the WebP file (872,836 bytes). Which format downloads faster depends on the texture, so measure your own assets.

The same wooden tower loaded twice in three.js, WebP texture on the left and KTX2 texture on the right, looking almost identical

WebP vs KTX2 at a glance

WebP texture KTX2 texture
What the GPU stores Raw RGBA8 pixels Compressed blocks (BC7, ASTC, ETC2…)
GPU memory, 2048 px with mips about 21.3 MiB about 5.3 MiB (BC7)
Download size Often smaller Sometimes larger, sometimes smaller
Extra files to load None KTX2 loader + Basis transcoder
Encoder tools Any image editor KTX-Software toktx, Basis Universal
Best for 2D sprites, UI, a few small textures 3D models, many textures, mobile players

How to set up KTX2 in three.js

The collection’s KTX2 files were encoded with toktx from KTX-Software 4.4.2 in ETC1S mode with generated mipmaps. ETC1S gives the smallest files; UASTC keeps more detail and suits normal maps. In three.js, loading them takes three pieces:

  1. A KTX2Loader with setTranscoderPath() pointing at the Basis transcoder files (they ship with three.js in examples/jsm/libs/basis/).
  2. detectSupport(renderer) so the loader knows which GPU formats the device accepts. With WebGPURenderer, call await renderer.init() first.
  3. GLTFLoader with setKTX2Loader(), plus setMeshoptDecoder() if your geometry uses meshopt compression, as this collection does.

When you compare formats, count the transcoder and decoder files in a cold first visit, and keep the camera, lighting and canvas size fixed so the texture is the only thing that changes.

LODs: the second lever

Texture format is the first saving. The second is level of detail (LOD): simpler copies of a model that you swap in as it moves away from the camera. The KTX2 set includes three LODs per object with the same origin, scale and orientation, so switching is a plain swap. At lod3 an object keeps 6% of its triangles and uses about 0.10 MiB of GPU memory.

Four copies of the scanned block tower in wireframe, from the full model to the simplest level of detail

A simple rule for small web games: spend full texture detail on things the player picks up, reads or looks at closely, and drop distant shelf props to a lower LOD.

What this means for players

Players never see the words WebP or KTX2, but they feel the result. A game that keeps VRAM low is less likely to stutter, reload or crash when a phone browser runs short of memory, and it starts drawing sooner. That is why it is worth checking textures before you add another model to a scene.

One caution: the measurements above come from a desktop GPU. Phones transcode KTX2 to ASTC or ETC2 instead of BC7, and Safari was not tested, so profile on the devices your players actually use.

FAQ

Is KTX2 always smaller than WebP?

No. On the network, WebP is often smaller, though not always. In GPU memory, KTX2 is usually several times smaller because it stays block compressed.

Why does a WebP texture use so much GPU memory?

The GPU cannot read WebP, so the browser decodes it into raw RGBA8 pixels at 4 bytes each. A 2048 px texture with mipmaps needs about 21.3 MiB.

Do I need KTX2 for a 2D browser game?

Usually not. For a few sprites and UI images, PNG or WebP is simpler. KTX2 pays off with many large textures, 3D models or mobile players.

Which GPU format does KTX2 turn into?

It depends on the device. Desktop GPUs often get BC7, while many phones get ASTC or ETC2. The loader picks one after detectSupport().

ETC1S or UASTC: which one should I use?

ETC1S makes smaller files and works well for colour maps. UASTC keeps more quality and is the safer choice for normal maps and detailed textures.

Can I use these scanned models in my own game?

The scans are by Google Research under CC BY 4.0, so you can use them if you credit Google Research and link the source. Brand names printed on packaging still belong to their owners.

Related articles

Loading game…

VENOGAME / PLAYBOOK

My arena

Saved on this device. No account needed.

Tap a heart to build your own game collection.