为什么 Texture2D.PackTextures() 在 atlas 中创建了这么多空的 space?

Why Texture2D.PackTextures() creates so much empty space in atlas?

我正在通过脚本创建纹理图集。我使用 6 张图像来完成,代码如下所示:

    atlasTextures = new Texture2D[6] {frontTexture, topTexture, backTexture, bottomTexture, leftTexture, rightTexture };

    Texture2D atlas = new Texture2D(1024, 1024);
    Rect[] UVs = atlas.PackTextures(atlasTextures, 2, 1024);

    GetComponent<Renderer>().material.mainTexture = atlas;

打包后的结果是这样的:

问题是,为什么这段代码会产生这么多空space?由于我将始终只使用 6 个纹理,是否可以将图集缩小一点?

图形硬件喜欢处理具有二次方维度的纹理,例如 128x1024 (2^7 x 2^10)。他们也可以处理其他纹理尺寸,但效率较低。这就是为什么引擎通常会尝试导入或生成具有二次方大小的纹理,即使它会留下一些未使用的纹理 space。何时覆盖此设置由开发人员决定。