• Register
Post news RSS Lost Squad 2016 Update | Day Two | Procedural Sky Rendering with Source Engine Pt.1

It's day two of our 2016 update! Today we're talking Procedurally Generated skies.

Posted by on


Hello, our dear friends, today we are going to show the first part of our media update dedicated to procedural sky rendering. In this part we will talk about basic things of our new techonology. The whole material is very complicated, so we decided to split it in two parts.


We have been dreaming for a long time about making more dynamic sky with moving clouds and replace the static one. We had three options: make a rotating model with cloud texture and place it inside 3D skybox; make clouds using particle system; write a custom sky shader. The first two options are easy to implement, but we still can't create something that we can control in real-time and something that physically simulates with them, so we have chosen to write a shader.

Despite the fact that in Lost Squad we don't have day/night cycle, we have flashbacks where player gets teleported to a completely different location with different weather and time of day, so option to write a shader seemed for us the most convenient.

Same 3D-Skybox, but acting as a sky sphere.

The first thing we have done to improve current sky was an ability to use on 3D-skybox textures designed to be used on skysphere. That allows level designer, even if he doesn't want to use procedural features, create better sky without artifacts usually seen when using skybox.

Usually, people create 3D model of a sphere, place it inside 3D-skybox and use spherical texture on it. We wanted to make our technology as simple for use as possible, so everything happening automatically inside our shader.

An example of static sky with spherical texture.

No artifacts that usually seen in skybox.

Physically-based skylight model.

After that, we impemented procedural skylight model.

Sunset with Physically-Based skylight model.

We have tried a lot of different skylight models and very early implementations looked like this:

Very early and very simple skylight model.

More advanced model but still far from ideal.

As a result, we took "An Analytic Model for Full Spectral Sky-Dome Radiance by Hosek & Wilkie" as a base. Currently, this is the most realistic skylight model used in games and realtime renderers.

Sunset with Hosek & Wilkie skylight model.

Sun near zenith with specific light setting.


For nightsky we tried to generate stars procedurally, but results were far away from being good. After trying a lot of different techinques, we decided to simply use a starfield texture. We created spherical starfield texture and applied it to our "pseudo sphere".

Skylight model for night is much more simplier, but still gives good enough results.

Nightsky with static starfield texture.

Nightsky with static starfield texture.

So, we got seamless sky with realistic skylight model and day & night suppport. We are only lack of clouds here.

Procedural cloud generation.

Working prototype of our new sky was almost ready, but without clouds. Our task was to implement procedural, physically-based clouds for real-time.

One of early implementations of procedural clouds.

We quickly realised that this task is too complicated, almost impossible even on better next-gen engines.
Perfomance and quality were very poor, don't even think that something is "physically-based" here.

Another attempt to get realistic clouds.

But despite all the difficulties, we saw the potential in these clouds and tried to unlock it.

Not bad, but 26FPS.

The work was very slow, unproductive, but still there were some progress.

  1. FPS is OK and quality is good too, isn't it?

Recently, we managed to create something similar to what we wanted originally and with good perfomance.

More or less good result.

However, there was still a lot of problems, which prevented us to finish the work and forced to think about finding more simple alternative. Although the results have been impressive we still do not dare to use procedural clouds on real maps in the game.

Clouds test on one of old maps.

That's all for today. In the next part we explain functionality of our shader in more detail, demonstrate some dev-videos and finish with clouds.
Finally, let's look at this old sky demonstation video recorded when we have just implemented Hosek & Wilkie skylight model:

Thanks for reading,
Have a nice day!


A tutorial on this and the other stuff you've done would be great!

Reply Good karma Bad karma+6 votes

yes I am working on my own mod & would like to know how to do this

Reply Good karma Bad karma+1 vote

Looking beautiful! Keep it up! ;D

Reply Good karma Bad karma+3 votes

Wow that's a lot to soak in.

Reply Good karma Bad karma+2 votes

This is a whole new Half Life game, and i would pay money for it. In my Opinion.

Reply Good karma Bad karma+1 vote

I really like the way you've created the clouds. It could definitely still use some work but it's looking very nice so far. Have you guys considered adding Physically Based Rendering into the game and replacing the old standard shader or is that out of reach?

Reply Good karma Bad karma+1 vote
DmitRex Author

Adding Physically Based Rendering is very complicated task especially on Source, mostly because we don't have full engine source code. But I still have some ideas how to implement it (or something close to it) so will see. I am working hard to bring as most advanced rendering system as possible to Source.

Reply Good karma+1 vote

It would be very interesting to see the results. Are you planning to go the metalness/roughness route or the specular/gloss route?

Reply Good karma Bad karma+1 vote
DmitRex Author

I'd prefer metalness/roughness, because as far as I know it's more realistic approach.

Reply Good karma+1 vote

It's easier to work with yes. Although, it isn't perfect for everything, it works for 95% of objects quick nicely. ;D

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Post news
Related Games
Lost Squad
Lost Squad First Person Shooter
Related Engines
Source Commercial
Related Groups
Oak Gear
Oak Gear Developer & Publisher