Hello our dear friends! It's time to share the second part of our procedural sky article with you. In the first part we talked about more basic things of our technology and showed early screenshots of it. Now we describe what we actually got and why our techology is better than Source's default one.
New way to create sky.
In previous part we already pointed out that we are not using skyboxes anymore and working with skysphreres instead, but some people continued to think that all we showed in previous part it's all about skyboxes.
In reality, we completely refused to use skyboxes and switched to skyspheres. Now, to create static sky artist need to make spherical sky texture and choose it in hammer in map properties. Everything else is done automatically in shader.
For static sky we have two render modes:
- Render as static
- Render as static rotating
The first mode just renders sky texture while the second one also rotates it around player with adjustable speed. So it's possible to create dynamic sky with minimum perfomance cost.
In settings menu in game there will be an option to choose sky type between static rotating and procedural. This allows players even with low-end systems still obtain dynamic clouds.
Currently, our artists are working on remaking hl2's skybox textures to fit our new system.
To add procedural sky on a map, you just need to create 3D-skybox (or empty box with sky_camera inside if your map is not supposed to have any 3D background), then add entity env_sky and adjust it's parameters via in-game sky editor.
In previous part we described how difficult it is to create such sky, quality of which would allow us to use it on real maps in game. And it really is, but as it usually happens, at the moment when we were about to stop trying we got what you can see on image above. We got almost perfect "perfomance/quality" ratio, allowing players enjoy procedural sky without having any FPS drops.
Of course, people with low-end systems probably have to choose static rotating sky as an alternative, because procedural sky is still pretty much expensive thing.
The whole priciple behind this clouds is pretty common in game dev industry. A good example of utilizing it is Horizon Zero Dawn game, clouds of which inspired us during the creation of our own.
This method is pretty simple, but requires some optimization tricks. You just need to:
- Generate 3D noise texture, for example Perlin to form cloud shape
- Add lighting
- Add some options to control cloudiness, position, type and so on.
And don't forget about optimization. On image above you can see a little blur on clouds - optimization consequences, but by tweaking lots of settings you can hide this thing.
After we got through all that difficulties, we had to add some minor things like potision modes for clouds:
- Clouds only at distance near horizon and clear sky above player
- Clouds above player but clear horizon
- Random position
After that, we had to combine sky lighting we described in prevoius part with clouds to lit them properly.
As a result, we got beautiful reaslistic and fast clouds with lots of settings like:
- Poistion mode
- Speed and move direction
... and much more.
Let's take a look at short video demonstrating our clouds in motion:
An attempt to replicate static skybox, early test:
Attempt to replicate static skybox.
On which image sky is static and on which it's procedural - find out by yourself =)
Ok, the sky is super cool, awesome and amazing but we forgot one important thing: how our clouds woud interact with Citadel clouds? You know in HL2:Ep1 and Ep2 there are huge rotating clouds above the Citadel.
We did some testing and the result was pretty good:
To get better effect we improved our clouds so they can rotate with Citadel's. Here is short video of what we got:
We are still polishing effects and lighting but the hardest job is over. Our sky already can be used as a replacement for static version on every map at almost any scenes and conditions so we will be actively using it while creating levels.
Luckily (or unluckily), this update is getting too big, so our next update related to such thing called "Interval Mapping" (in other words: fast parallax shader) will be started with in-game sky editor demonstation and couple of other things.
The last thing we are showing today is a video demonstating full day/night cycle with dynamic shadows:
That's all for today! Hope you enjoyed and have a nice day!