Game Development Updates

Unity Mobile Skybox

The default Unity (2019.2) skybox uses a sphere with 5,040 vertices, 1,680 triangles (you can confirm this in the stats and frame debugger. Thats a mesh with no shared vertices. This doesn’t really matter for most games unless you’re trying to squeeze all the performance drops out of an old mobile device (I am).

The skybox(sphere) mesh gets added in automatically whenever you have a skybox shader material in place for the skybox. To turn it off go into the Lighting tab and set the skybox material to none and on your camera set the Clear Flags to Solid Color.

This leaves you without a skybox and a solid color background. I’d grown quite attached to the procedural skybox during testing, nice gradients in the sky and it suited my cartoony look. I needed to find a replacement. I looked around on the Unity forums, asset store, git hub and Reddit. Lots of chatter but no great solutions, cube maps look awful compared to the procedural skybox.

I looked at a few of the older Unity projects https://unity3d.com/pages/the-chase and < ahref="https://unity3d.com/pages/the-chase">http://unity-chan.com/contents/the-phantom-knowledge-en/

Both used in scene geometry skyboxes, check those projects out they are both really impressive.

I came up with a simple solution also inspired by Nintendo (https://www.youtube.com/watch?v=8rCRsOLiO7k and the noclip website)

I created a UV sphere in Blender and vertex painted it (you could do this in Probuilder too) 222 verts, 360 tris. The shader is simply doing interpolation of the vertex colors, so no texture lookups lookups or complex calculations, and I get a reasonably similar out come as the procedural skybox, nice gradients in the sky.

The only real magic is “popping” the mesh out of being culled by the camera frustrum culling, its done in the vertex function by setting “o.vertex.z = 0;”

I'll add a link to it on github shortly