Inputs (left), are the absolute world position (the world position of the pixel), WorldCenterPosition (Center point of the sky, this is the point where we project from, and ObjectVec (The sun or moon vector).

The calculation after the ObjectVec calculates the normal of the projected plane. With a simple Cross product with the up vector (0,0,1), we can extract the side vector of the Sun. After that, we can do another cross vector with both the forward and side vector to get the up vector. This should give us the plane normals that we were looking for (Up, side and forward). After this, we can check all incoming vectors and see where they would project on this plane.

The projection itself can be done with a function that Unreal already provides. It's called InverseTransformMatrix, but it's really just 3 dot products. The vector to Transform is the vector we want to project onto the plane. The BasisX, Y and Z vectors are the 3 direction vectors of the plane that we just calculated. The final part on the right is to scale the texture.

The last thing we need to do is make sure we only get the positive side of the Sun/Moon vector, so we do a simple dot product to calculate this. This can be seen at the top of the screenshot.

In a future update, I will move the plane calculation to the blueprint, because there is no need to calculate this for every pixel.

The cloud system is something I spent most of the time on. Clouds are very complicated, and one could spend months trying to create convincing, good looking clouds. I've tried multiple things myself here as well. First, I went for the flow map approach that Naughty Dog showed in the Last of Us. But it was not flexible enough. There was no way to increase or decrease the number of clouds, and it relied on a sky texture rather than procedural clouds.

I then started to experiment with panning textures. As I've written before, panning textures are nothing new. They were already there in the '90s, and have always worked well. But just a panning texture does not give you nice clouds. It's very static because the clouds never change.

One way to break this repetition is to mask away the clouds with a second panning texture, or even a third one. Although this works rather well, you can still see the texture tiling and repetition if you look at it for a longer period of time.

I ended up using a mixture of techniques. I was very intrigued by the flow map technique and started to use this for the cloud deformation. The end result looked great. Clouds were deforming in a natural way, and I was onto a great start here.