Wednesday, October 3, 2012
I hate making skybox textures. That’s probably why GMod has been using HL2’s cloudy, stormy skyboxes since it was born. With the new flatgrass I decided to make a new skybox.
This works - but it’s not without its problems. The biggest problem is that the corners of the skybox are clearly visible when you spin around. You can tell the skybox is a skybox. That ain’t good.
So instead of making another texture I started to think.. this is just a simple gradient. I can do that in a shader. And make it configurable.
When I looked into it there’s some really complicated shaders around that simulate the atmosphere to give accurate looking sky. But I’m not patient or smart enough to do anything like that. So I decided it would be a good idea if I just kept it as simple as possible - that way it could be used for unrealistic alien skies and stuff too.
This is what I got.
In the screenshot above there’s two effects. First we have the sky colour gradient - which is deep blue to a light weak cyan colour. Then we have the horizon effect - which is orange/red. This effect hugs the horizon - but intensifies near the sun. You can see that effect on the screenshot below.. the horizon effect is stronger on the right.
In the screenshot above you can also see a star weak effect (you might need to open it in a tab and zoom in). The stars are just a texture you choose (any texture) - which gets scrolled across the sky. In flatgrass we use them for subtle clouds, like this.
But of course you can make the clouds look as awful as you want by controlling scale, fade and position.
Or change them to stars, and change the colour of the sky. This would obviously look a lot better if the map used night-time fog and lighting.
Or use clouds and colour to make it look stormy!
Here’s a video of the cloud movement:
The important thing to keep in mind with this stuff is that it’s all totally dynamic, on the fly. It’s all controlled using a material proxy. So even though by default there’s no transitions - a good gamemode coder could use this system to make a really nice day/night cycle, or a weather mod.
If you’re making a map and want to try it out - the entity is in the fgd in the next GMod Beta update - it’s called env_skypaint. I’m hoping to get an in-game tool to fiddle with the settings done.