Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 6.6 — Texture Memory
3D Web · Example 1 of 2

File size is not GPU size

Real file sizes and pixel sizes of the course's textures, then the formula for common sizes. The last line is 300 × 200: odd sizes work, and cost what the formula says. A mipmap chain is about one third more (the exact value for odd sizes differs slightly).

A texture costs width × height × 4 bytes on the GPU, plus a third for mipmaps, whatever its file size. renderer.info.memory.textures counts them, and dispose() frees them.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 4 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Your showroom uses 12 textures of 2048 × 2048 with mipmaps. What is the total, and is it a problem?

02

Write the code that changes a mesh's colour map and frees the old one.

Explain it without notes

01

A texture is a 300 KB JPEG at 2048 × 2048. How much GPU memory does it take, and how do you cut it?

02

What does renderer.info.memory.textures tell you, and what does it not?

File size is not GPU size
Press Run to see the page.
idle

Console

Nothing logged yet.

Expected console output

file                             on disk   on the GPU
metal_plate_diff_1k.jpg           676 KiB      5.3 MiB
metal_plate_nor_gl_1k.jpg         752 KiB      5.3 MiB
rubber_tiles_diff_1k.jpg          343 KiB      5.3 MiB
concrete_floor_02_diff_1k.jpg     758 KiB      5.3 MiB

512 x 512       1.00 MiB without mipmaps |    1.33 MiB with
1024 x 1024     4.00 MiB without mipmaps |    5.33 MiB with
2048 x 2048    16.00 MiB without mipmaps |   21.33 MiB with
4096 x 4096    64.00 MiB without mipmaps |   85.33 MiB with
300 x 200       0.23 MiB without mipmaps |    0.31 MiB with