Images that are ~100 KB being stored as 10MB in Memory

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By lakshaya

Hi all,

I have a character that has ~200 sprites for various animations.

Each sprite takes up 70kb or so according to Windows in the file system, but in Godot it shows the memory as ~ 8mb. What is the reason for this?

Just putting the character in a scene increases my VRAM usage to 12GB. Which is insane.

The character images are big ~ 1500 x 1500. With quite some alpha around them. Is that the reason? Is this normal?

1500×1500 frames are too much for sprite-based animation. You need to reduce the size of each sprite, or use atlases to optimally fit each frame within a minimally-sized image.

Calinou | 2022-11-04 21:06

This size will probably come down by half, but that will be at a later stage when we are clear on the resolutions we wish to support.

I’m using Atlases in Godot 4 now, but running into issues in the editor. Seems like I’ve replaced VRAM issues with slower development:

lakshaya | 2022-11-04 22:18

This size will probably come down by half, but that will be at a later stage when we are clear on the resolutions we wish to support.

I’m using Atlases in Godot 4 now, but running into issues in the editor. Seems like I’ve replaced VRAM issues with slower development:

Creating AtlasTextures in Godot 4.0 beta 4 causes re-imports every time we reload, and engine runs slower · Issue #68256 · godotengine/godot · GitHub

lakshaya | 2022-11-04 22:18

:bust_in_silhouette: Reply From: sash-rc

Yes, it’s very normal. First of all, learn the difference between “image” and “texture”, compression of both images and textures and mipmaps.

A normal RGBA pixel is 4 bytes, thus …
A simple calculation 1500 * 1500 * 4 gives 9000000 bytes (mipmaps not included).