Mireneye detailed how they constructed the sky for their upcoming RPG, Dynasthir, explaining how the masks used were created in Substance 3D Designer and how the shader was put together in Unreal Engine's Material Editor.
Hello everyone! I’m Mireneye, the lead dev of a dark and abstract dark ages-inspired RPG called Dynasthir. In Dynasthir, you are faced with a dying world where Miasma tears at the fabric of existence, calling for a sky like no other.
In prototyping, we used hundreds of sky cards and more custom details, but deferred renderers will have performance problems because of overdrawing with translucent cards, so we knew that it was not going to be the way forward, but it gave us some form of a target visual.
Here’s a picture of what that used to look like:
It certainly had its charm, especially in its colors but it was very static, and it wasn't something I felt like looking at for hours and hours, and in some places, it lacked definition.
So I built a shader for the sky-dome and used a few cloud cards carefully scattered to accentuate some specific details. That is what I want to focus on with this article, the construction of the sky. In this article, I will cover how the masks used were created in Substance 3D Designer and how the shader was put together in Unreal Engine's Material Editor.
The steps will not be a 1:1 representation like a tutorial, however, it will give you some great insights that you can take with you as you author your own materials.
Here is the full material I will present to you as it exists in Unreal Engine 4.26.2, annotated for everyone's convenience:
The first thing we do is generate some parallaxed UV coordinates, there is a handy function for that in Unreal Engine so we are going to make use of it.
This essentially pushes the flow map back, from the camera's point of view, adjusting the way the camera views it to give a sense of depth in the way the sky moves. I did not need a lot of high-frequency details in my flow map so it was ok to sample a really small texture, generating its mipmaps with a blur:
From the Flowmap sample, I get two things.
The upper execution pin adds the flow map to the Zenith of the sky, while the lower feeds back into the UVs of the texture that holds the different authored masks I used for the sky.
On the upper execution, I’m doing some fairly standard flow map math. The important takeaway is to use two texture samples, the second an offset of the first, used to make it loop seamlessly as the UVs are pushed by the flow map. The above image, in truth, gives you the full setup for a relatively standard flow map. But that’s not what we are doing, well, not the full picture, as you have already seen.
Let us have a look at the lower execution pin:
The primary purpose here is to add tiling but also set up per-channel tiling because we want to be able to control how often the texture repeats across the sky. All good so far.
For the attentive eye, you can see that the Blue channel has some modulation coming in from the Flowmap directly. This serves to distort that layer differently from the others so that it stands out in its own way and is more of an aesthetic decision rather than one that makes perfect technical sense. This does give us a segway to go into how the texture masks were created in Substance 3D Designer.
We needed to quickly be able to adjust and try things and Substance 3D Designer is really good at mixing pixels, what follows is really just a big graph of Noise samples, blends, warps, and adjusting ranges. What you want is a mask that covers most of the texture, but avoids becoming too dominant so it makes space for the other masks to come through.
I also used the Alpha Channel to store something akin to Stars. They will be the furthest back in the Shader, so they don’t need the highest fidelity either, also we will be utilizing them with the Emissive property in the Shader which will smoothen them out.
I opted now and then to sample a bit of the other noises, to create some overlap in the shape they form together. Overall, when creating a unique sky, you can spend hours and hours with the authoring process of the cloud/noise textures that will feed into it.
Back in Unreal Engine, we are now blending in the Stars first:
And then we take the incoming Masks we got from Substance 3D Painter, and we blend and tweak them a bit, NoiseStrength will take all of the Sky "Noise" Masks together except for the Stars and boost their Brightness. We also have an Add and a Lerp to blend in the Stars properly. We actually use the same mask for the Stars as we do for the Alpha for the Lerp.
For the purpose of the article, we are essentially done at that point. But I will leave you with an extra tidbit.
Before handing this off to the Emissive output of the material. I’m running the tiniest bit of game logic. I plan to expand this in the future, for now, it’s pretty simple.
These are two different Material Param Collections, and their values are updated in real time when you play. Skyshift is governed by a timeline with linear interpolation and goes from 0-1 Meaning at times the sky will be fully emissive at 1 and not at all on 0. This makes it seem as if the whole sky flashes. This is used for lightning and in the future I want to mask out certain areas of the sky and shift the light inside the “clouds'', like lightning coming through.
The other modulates the Emissiveness based on Weather. In very foggy weather we do not want to see the Sky at all, so we turn down the Emissiveness to 0. Finally, we have an adjustment for FinalBrightness to give us a bit more artistic control over the output.
Behold, the fruits of our labor:
It turned out quite a bit different from our target, however, it is way more dynamic, the way some of the blackness sways inside of it and the way it fakes depth makes it look very alien. And truly unlike anything I have seen before. For the final look at our game Dynasthir, we ended up using some cloud cards to push it further, as well as keeping some of the other alien elements. It is now much easier to tweak as I can just try different textures with different noises and it’s easy for me to iterate on any channel I want.
I hope this ends up being a useful breakdown for others out there. As a lover of alien skies, I would love to see more takes that straight-up infuse our lives with the strange and wondrous.
If you want to experience this in action and on your own, I’m afraid you’ll have to wait until the game is finished or meticulously copy exactly from the images above which would be totally bonkers and I love it!
Every day the game is getting closer and closer to the finish line. If you want to be part of that story, you can now wishlist the game over on Steam, where you can also see a brand new teaser featuring the sky.