This is something I’ve been very excited about, having sunk a lot of time and effort. Today I think it’s far enough along that I can start sharing WIPs here and talk about what this is.
SkyRay is a next-gen dynamic sky system for Unity. The sky is 100% volumetric, procedural, and totally dynamic. It was painstakingly designed to borrow as much inspiration from real world clouds as possible. Several cloud layers - cumulus, cumulonimbus, and cirrus clouds - work in tandem to provide a convincing sky rendering. At the same time, great care has been taken to ensure that SkyRay has a minimal framecost while looking the best it possibly can.
In addition to cloud rendering, SkyRay features a dynamic weather engine which allows new weather conditions to roll in from the horizon in real time. You can literally watch storms approach from the distance.
Weather events are world-persistent too, so you could theoretically follow a storm through your game world. Additionally, SkyRay allows a configurable climate to be defined which affects the weather patterns. Climate can change throughout the year with the seasons, or even in different areas of your game world for maximum realism and control.
Screenshot of large stormclouds rolling in. Players can watch these events happen in real time.
The weather over the player is also used to drive a highly configurable set of effects encompassing particle and sound effects, driven by a variety of curves such as moisture, cloud coverage, temperature, etc.
They’re volumetric in that you can fly around underneath them and they appear fully 3D rather than being a flat cloud plane. But, for a number of reasons relating to how they’re being rendered and how I’m keeping the frame cost down, you can’t fly through them. They’re designed to be used like skybox clouds for when you’re on the ground.
Just a little update. Today I just about finished the rewrite of atmospheric scattering. SkyRay features a full time-of-day cycle too, and I want the sky to look just as good as the clouds do!
Previously I had basically reused Unity’s skybox code, but now I’m using precomputed atmospheric scattering based on Eric Bruneton’s work, known to be one of the better looking methods available. Essentially it prerenders what the sky looks like at different sun angles and times of day directly into a 3D texture which is stored as an asset - then sky rendering can just be sampled with an angle in a shader.
A utility will ship with SkyRay which lets you render these LUTs yourself:
It allows you to play with atmosphere/sun color, moon color, atmosphere density, planet radius, etc so you can create physically plausible and/or artistically tweaked alien or fantasy worlds. Of course an earth-based LUT set will ship out of the box.
Additionally, I’ve changed how I’m doing sun color calculation. You can either have SkyRay calculate sun color automatically using rayleigh scattering, or you can enable a custom sun gradient for full artistic control. You can have SkyRay auto-fill the gradient with rayleigh-based values and then tweak to your heart’s content. For example, I captured this dramatic shot which was the result of tweaking the sun gradient:
I would also like to point out that already built in is a feature that SkyRay can auto-generate global spherical harmonics lighting for your scene based on rayleigh scattering and on cloud coverage so that no matter the time of day or the weather your lighting looks consistent and plausible.
And what are your plans for celestial positioning? In other words: are you going for a more realistic approach (i.e. Time of Day), or a simple sun/moon rotation?
I’ll see if I can get a video together!
Currently the sun is positioned realistically, based on latitude, longitude, and date. The star layer rotates with the sun. The moon is not yet realistically positioned, but I’m looking to change that prior to release.
When will it be available?
I actually cannot say. I’ve got a good amount of work ahead of me just for V1, such as getting in all of the features I want v1.0 to have, polishing and cleaning up the existing features so that it’s as clean and user friendly as possible, and also documenting everything properly.
Price point?
I’m thinking around $60-$70.
Aircraft / Flight sim?
I know that wasn’t a question, but I’d like to point out again as I did in an earlier post - at the moment, you cannot fly through the clouds. They’re highly optimized around the case of being on the ground. As long as you’re OK with this, then it should be fine. But if you want to be able to fly through the clouds, at least the first version is probably not what you’re looking for. Luckily, there are other solutions which do support this - TrueSky, for example (though as far as I’m aware at the moment TrueSky’s Unity plugin is still DX11/Windows only).
As promised, here’s a video of the clouds in action, including footage of that storm front rolling in! Also showing off the cloud shadows feature which allows the cloud layer to modify the screen space shadow mask to add global cloud shadows.
Looks very nice indeed, what is the CPU cost for the clouds and other effects, and I am guessing this would not work on mobile devices? Finally can you just generate a static sky without animation so a cube map could be rendered for example.
You are correct, the GPU cost makes this prohibitively expensive for mobile, and it is geared towards consoles and gaming PCs. The CPU cost is extremely minimal, however (most of the work is on the GPU). There’s no support for cubemap rendering at the moment, but it shouldn’t be too hard to implement.
Spent today getting exponential height fog up and running. Now the AtmosphereFog effect which will ship with SkyRay features a nice height-based falloff you can tweak
More, slightly less exciting probably, news.
I’ve now got realistic moon positions in. So both sun and moon are calculated based on date, latitude, and longitude, accurate to real world positions. BUT!
That’s not all. Internally, I’ve refactored the code so that the codepath for sun and moon are actually one and the same, just with different values. In fact, not just the sun and moon, but any arbitrary celestial body too. You’d have to work out a whole table of values for a custom planet (or just borrow one of our solar system’s planets, from Computing planetary positions), but it is possible and is capable of taking the earth’s rotation, the earth’s orbit around the sun, AND that planet’s orbit around the sun as well
Correct me if I’m wrong, but your system doesn’t seem to account for haze/fog when displaying the clouds. When it was raining (around 40 seconds into the video), in the distance I could see patches of light clouds. Or is there a way for the user to overcome that?
Also…what do you think it would take to enable clouds that are are “fully” 3D, or what performance impact would it have?