本文暂无简体中文版本,以下为英文版。

(文章)

When a GLB Is Too Large: Start With Textures, Not Geometry

An oversized GLB usually comes down to textures, not geometry. A small file does not mean a small GPU footprint either: a solid-color texture that compresses to about 1 KB is the typical counterexample.

Polish Design engineering team・2026-08-26

Contents

When a GLB file is too large, look at the textures first and the geometry second. The oversized files the development team has met in 3D configurator projects were usually oversized because of textures. One more premise is easy to miss: file size and GPU footprint are two different numbers. An audit that reads file size cannot catch a texture that compresses to a few kilobytes and still fills its full resolution once decoded.

glTF is the open, interoperable transmission format for 3D assets defined by the Khronos Group (Khronos Group, 2021). GLB files belong to that format, and the texture compression and geometry compression discussed below are both extensions of it.

Why Textures Come First

A texture's weight comes from its pixel count. Cutting the edge length from 4096 to 1024 leaves one sixteenth of the pixels, and GPU memory shrinks in the same proportion. For a batch of 14 body-color textures, dropping to 1024 took GPU usage from about 160 MB to about 10 MB. Of those 14, 12 were solid colors from the start. The other 2 were two-color textures, and scaling those two down and back up to full resolution produced a difference of 0, so the image lost nothing.

A person on a step stool places a colored block on top of three others.

Reducing the resolution of a solid-color texture costs nothing in image quality, so 3D model slimming starts with the textures. The order runs as follows.

  1. Decode each texture at full resolution and compute the per-channel standard deviation to find the solid-color ones.
  2. Shrink solid-color textures to 4×4 and convert the rest to KTX2.
  3. After compression, decode the files back and compare the results with the original values, across the full set.
  4. Only then look at the geometry, meaning the choice of compression format.
Fig. 1Scaling down the body-color textures removed about 150 MB of GPU usage, and verification afterward changes nothing further
  1. Original texturesAbout 160 MB14 textures at 4096, 12 of those solid color
  2. Pixels dropped by the scale-downAbout 150 MBNo loss in the image
  3. Scale down to 1024About 10 MBTwo-color textures scaled back up differ from the original by 0
  4. Decode back and compare in fullAbout 10 MBAll 14 checked one by one, no sampling

One batch of 14 body-color textures. Figures are approximate.

File Size and GPU Footprint Are Different Numbers

The file size of a compressed texture depends on the content of the image and the compression method. The memory a texture occupies on the GPU depends on its resolution. The two do not move together, so a solid-color texture can be the smallest file and the largest waste at once.

The development team once worked on a batch of models in which solid-color materials were exported as 2048² textures, with the same image repeated across 8 GLB files. Compressed, that image came to only about 1 KB, so no audit based on file size would flag it. Across the 8 GLB files, though, it wasted about 43 MB of GPU memory.

Fig. 2A solid-color texture of about 1 KB wastes about 43 MB of GPU memory across 8 GLB files
File sizeGPU footprint
  • About 1 KB
    Solid-color texture, originally 2048²Wasted GPU memory
    About 43 MB
  • File size unchanged
    The same texture shrunk to 4×4Image unchanged
    Near zero

The same 2048² solid-color texture placed in 8 GLB files; GPU usage is the total for all 8. Shrinking to 4×4 is an in-place rewrite, so the file size of each GLB stays the same.

The judging quantity therefore cannot be file size. It has to be the standard deviation after decoding. The method is to decode the texture at full resolution and compute the standard deviation per channel, alpha included. A standard deviation of 0 means a solid color: shrink it to 4×4 and the image does not change. The reverse also holds, since a small file does not mean a texture can be shrunk. One decal texture was only about 110 KB, yet its standard deviation was in the tens. It is a real image and has to stay as it is.

One pitfall sits in the decoding step: read only the RGBA32 output from basisu. The RGBA4444 copy quantizes 18 to 17, so a solid color comes out one step off across the whole image.

When a texture is edited in place, the geometry must not be touched. The method works at the byte level: the new image is written back into the original bufferView, only the length is changed, the file size stays the same, and every other byte is left alone. Reading and writing the whole file through a graphics library re-encodes the geometry. After that treatment, three GLB files grew to about 1.4 to 2.9 times the original size.

LIDROP's 3D configurator puts this test into the release process. Once a texture is confirmed to be a solid color, it is shrunk to 4×4, the image does not change, and the first screen of each vehicle uses about 16 MB less GPU memory.

What to Compress Textures Into

Textures that carry real content are compressed into KTX2 with Basis Universal. The KTX v2 container with Basis Universal supercompression ships the texture in a universal format, and the engine then transcodes it into a block-compressed format that the platform supports (Callow et al., 2020). After transcoding, GPU footprint is still set by resolution, so download size and GPU footprint have to be measured separately.

The MDN documentation lists texture memory as a category of its own, with advice that includes allocating only the mipmap levels that are needed and using GPU-compressed formats (MDN Web Docs, 2026).

Basis Universal offers two encodings: ETC1S at a low bit rate and UASTC at high quality. ETC1S produces small files, but the colors of individual textures can be pulled toward gray. Re-encoding the same source with UASTC restores the colors, at a cost of only about 27 to 29 KB per texture. Any texture with transparency always goes to UASTC, because ETC1S encodes alpha as a separate slice and the edges of cutouts break apart.

Fig. 3Decide by the standard deviation after decoding: shrink to 4×4, or compress into KTX2
  1. Decode at full resolutionRead RGBA32, every channel including alpha
  2. Compute the standard deviation
  • Standard deviation is 0
    Shrink to 4×4Solid color, image unchanged
  • Standard deviation is high, with transparency
    High quality UASTCKeeps cutout edges intact
  • Standard deviation is high, no transparency
    Low bit rate ETC1SDecode and compare; re-encode any gray one with UASTC

Geometry in One Paragraph

Geometry has two compression specifications of its own: Draco (Zhang et al., 2013–2017) and meshopt, which is built around fast decoding (Kapoulkine et al., EXT_meshopt_compression).

The choice between the two flips with network speed: below about 46 Mbps, Draco is faster, and above it, meshopt is faster. The full comparison is in web 3D performance engineering and is not repeated here.

Parts That Cannot Be Compressed: Skinned Meshes

Skinned meshes, which deform with a skeleton, cannot be compressed by force. Quantization replaces the 32-bit floating-point numbers commonly used for vertex attributes with smaller component types, trading precision for memory and bandwidth (Kapoulkine et al., 2018–2020). If a file from the modeling side is already compressed and the pipeline compresses it again at the default bit depth, that is double quantization. Normals are pushed onto a different set of grid points, and the skinned part visibly deforms, as if it were not bound to the skeleton.

The handling is that skinned parts never go through a second quantization. The original file is served as is, and the compression script excludes such parts. Verification also cannot rely on the bounding box of the mesh, which reflects the flattened bind pose. The world coordinates of the bones have to be measured instead.

Verify Every Compressed File

Verifying a conversion means decoding the compressed file back and comparing the result with the original values, and doing so for the full set. When colors look gray after compression, compare the source with the decoded values first, and do not blame the asset first.

A person turns a large gear with a wrench, with a smaller gear beside it.

A common case: body-color textures converted to a GPU-compressed format can look gray, and the instinct is to judge the asset broken and ask the modeler for a new export. Decoding the source image and the compressed file at full resolution and comparing average colors shows that ETC1S has pulled the endpoints of individual textures toward gray. Re-encoding the same source with UASTC restored the colors. The other colors in the same batch were completely fine with ETC1S, so the effect appears texture by texture.

  • Decode in a clean, separate folder and take the largest mip level. Grabbing files by filename glob can pull the wrong level and produce false numbers.
  • The decompression command emits several variants. Feeding in the alpha one makes a whole set of colors check out as white-gray.

Do not sample: checking only a handful of textures can miss the one with the problem. A full comparison is only a loop, so there is no reason to sample.

Specification validation is a separate check. glTF-Validator checks JSON, GLB, buffers and textures against the glTF 2.0 specification, and comes as a browser version, a command-line tool and an npm package (Khronos Group, glTF-Validator). A validator answers whether the file conforms to the specification. Whether the colors drifted has to be checked against the source image.

A shipped file also has to be reproducible from its source: each file records its source, output and parameters, and nothing is copied straight into production. Before recompressing, compare the material flags of the live version against the original file. Recompressing from the original washes out blend modes that had been fixed by hand. The item-by-item elimination used at intake is covered in 3D model intake acceptance.

Self-Host the Decoders, Skip the Overseas CDN

The Draco and Basis decoders load from a public CDN by default. On restricted networks or in regions where that CDN is blocked, the decoders cannot be fetched and the 3D content fails to load at all. Two projects use self-hosted decoders, kept on servers the projects control, with no remaining dependency on an overseas CDN.

When This Does Not Fit

  • The texture is a real image: its standard deviation is high, so it cannot be shrunk to 4×4, and only the trade-off between compression format and resolution remains, decided texture by texture by looking at the image.
  • Only a compressed file exists and the original from the modeling side does not: a skinned part deforms if it is compressed again, so obtain the original first.
  • Textures turn out to be a small share once measured: the problem is in the geometry, so read the process and format choices in web 3D performance engineering instead.
  • File size and GPU footprint are already within the budget of the target device: there is no need to process anything just to make it smaller, and every extra step adds one more thing to verify.

Next Step: What to Prepare

To decide where to start with a given GLB, prepare three things: the GLB to be shipped together with the original file from the modeling side, the target devices and network conditions, and whether first-load download size or phone memory matters more right now. When aligning specifications with a modeling vendor, the asset creation guidelines that Khronos defines for e-commerce product 3D content are a useful reference (Khronos Group 3D Commerce, 2025); this article does not cite the modeling details. Once those are ready, contact the development team to discuss.

(联系)

Start a project.

三个步骤,取得可判断的做法与预算区间。

  1. 01预约第一场会议:选择时段,不需要完整规格。
  2. 02在线咨询 15 至 30 分钟:取得做法方向、预算区间与时程草案。
  3. 03查看素材后,约 3 至 5 个工作日提供报价单暨交付规格明细表。
邮箱
hello@polish-design.com.tw
通讯地址
(104) 台北市中山区植福路191-1号3F

预约第一场会议

周一至周五 16:00–18:00线上 30 分钟

先选时段,再用 Google 账号或邮箱确认,预约完成可加入日历。

选择时段

或先提交资料

还没想好时段,可以先留下项目内容,专人以邮箱回复。提交后也能接着预约。

补充资料(选填):服务项目、目前阶段、现有链接、得知渠道

数据仅用于本次项目评估。

ISO/IEC 27001:2022 证书

(Certificate)

ISO/IEC 27001:2022

认证机构
ARES International Certification
认证范围
互动沉浸式 3D 系统之开发流程,及网络与基础设施之运维与管理。

到认证机构网站查证