- Home /
Can't copy skybox faces to a cubemap sized texture without huge quality loss
Tried writing a script that would automatize for me the conversion of 6-sided skyboxes to cubemaps. I already had a working method before that rendered the view to a cubemap and encode it as png. But it suffered some quality loss so I hoped if instead of rendering I directly take each face (1024x1024) of the 6-sided skybox and copy to a 6x1024x1024 cubemap in the right order and THEN save it as png, I'd avoid the quality loss. I don't know where's the problem, whether it's casting the 6 skybox face textures Texture2d (their Format import setting is greyed out, maybe because I'm optimized for mobile so I'm using ASTC textures) or perhaps GetPixels and SetPixels are at fault, but in any case after just these 2 operations my saved png comes out in extremely low resolution (pixel count is okay, but they look much worse resolution than a normal skybox of the same pixel count. Looks like some sort of image corruption).
I wanted this because I'm having about 40 6-sided skyboxes in my game and turned out cubemap is way better for mobile as they only cost 1 draw call (6 sided costs 6 draw calls). But I've ended up keeping the worse performance because the quality loss in the skyboxes was too noticable with any of the above mentioned approaches. Anyone knows about this, whether it's a bug or some trick I'm missing, let me know.