- [Martin] Hey everyone, Martin here for cgboost.com
and in this short video, part of the quick tip series
we are going to have a look
at constructing something very handy
for your environment shots, a starry night sky element.
I mean, you could just download an image
or shoot a night sky shot
and that can work very well in day shots
but once you start searching for night sky elements,
you will usually find out
that they are grainy or blurry,
usually unusable for 3D purposes, which means yes,
we shall make our own starry sky from scratch,
using just shader nodes
and layer on top of it,
various elements from a soft glow
to animated clouds and of course, the moon.
In the end, you'll be able to put it into any
of your night scenes
to serve as a backdrop
that you can easily adjust and animate.
This video is, by the way, closely connected
to my master 3D environments course in Blender
where you will learn, for example,
how to make deserts, mountains,
highlands, oceans, 3D clouds,
weather elements and more.
For a few weeks still,
this course will be in early access stage
with discounted prices.
So yeah, check it out if I peaked your interest.
Let's start this lesson by making a sphere
to serve as our sky dome.
Make it a rather large one, like 1,000 meters,
which you can set here.
Once you do, however,
it's best to raise the view clipping in here
to not have your viewport cutted off.
Apply the scale.
It's usually a good practice,
especially when you plan
on doing some texture mapping node work,
which we are.
And since I'm not planning to use the sphere
as my environment,
rather as a 2D background for my scene,
I will, in fact, delete most of it
and use just this half sphere,
which you should do that this point
for later use in your own scenes
is deactivating the shadows of this object.
I mean, if you make a really large sphere, like this,
it will, of course, cast a shadow,
obstructing parts of your terrain.
So to avoid this, right off the bat,
we need to go down here
and uncheck the shadow and ray visibility.
That is if you're in cycles.
If, like us, you will construct the sky for EEVEE,
and let's switch, in fact,
you will need to create a new material
and down here change this shadow mode to none.
With this done, name it Sky Dome,
make its shading smooth by right clicking
and choosing it here
and also, you can hit Control + 2
to add more subdivisions to it.
All right, and with that,
we are ready to map some starry sky onto this image.
So first, let's start working on our material here.
Open up the shader editor
and start plugging stuff into this color socket.
To start off, it's going to be this noise texture node.
And we can also fly inside of our sphere
to see it better.
If you activate the Node Wrangler add-on,
which I'm sure you know is among your built-in add-ons,
you just need to activate it in Preferences
and I don't even know why, at this point,
when clearly everybody is using it,
it's still not active by default.
But anyway, with it active,
you can just press Control + T with the noise selected
and you get this coordinate mapping setup.
And in here, just leave everything as is.
To be honest, you didn't even need to add it in
because Blender uses these generated coordinates by default,
anytime you don't plug anything into this vector socket.
But I wanted you to know the Control + T shortcut.
And you can also already jump into the render preview mode
and you can see something is happening.
It just doesn't look like stars.
But we'll work on that right now.
To achieve the starry sky backdrop,
set it to about 1,000 in scale
and detail of six or more
and leave the rest as is.
Now, let's see, you have this typical color noise,
which we don't really want.
Instead, we want to make it stars.
So first logical step would be to get rid
of the colors.
You can simply do that
by adding the trusty companion
to all shader editor edits,
the color ramp node.
Now, when you adjust the endpoints like this,
well, well, well, right away,
we have some nice-looking stars.
They are dim but when you plug them
into the emission shader as well,
they start emitting.
That was easier than you thought, right?
I settled at the values of 0.65 for the black point
and 0.7 to 75 for the white point,
depending on how bright you want your stars to be.
Okay, let's select the nodes,
hit Control + J to frame them
and name the frame here in the sidebar menu Stars.
You can even change the color and the size here.
So that's the starry field
and next up comes the bottom edge light glow.
The node you can use to create a gradient seeping
from below onto your starry field
is this gradient texture.
Let's, in fact, unplug the starry field first
to not see it, and plug in this gradient texture by itself.
First, into the color and then into the emission.
And here's a little trick.
If you hold down Shift and right mouse button drag,
you create this reroute node
and now, let's drive our connections from this point.
The advantage of this
is next time we want to plug something
into these two sockets,
you don't have to plug it in twice
but instead, you only plug it here.
Saving time like a pro.
Okay, back to the gradient texture.
By default, you can see it's positioned
from +x to -x going from white color to black.
I found the gradient to be kinda hard.
So in fact, let's switch to this quadratic one first.
Second, I want it to come from below,
not from the side.
So for that, let's hit that Control + T shortcut
and this time, we will use it.
By the way, leaving the coordinate method
to generate it has one advantage.
And that is if you later start scaling your sky dome,
the texture will stay the same.
So now for it to shine from below,
we just need to rotate the y-axis -90 degrees
and push it on x-axis until we see some result.
And you may need to hold down Shift
when manipulating with this x value
because it gets very sensitive.
Now would be a proper time
to add a camera to our shot.
So let's add one.
Position it wherever you want it.
Raise the end clipping, of course,
to avoid far distance clipping of our sky dome
and set up any resolution you want.
I will use the cinematic 21:9 aspect ratio
and a fairly wide lens.
And now with the better idea of the final shot,
you can play around with the mapping a bit more,
even with the x value.
A very fast way to control the color of this glow
is to simply add a mix RGB node here
and make it a color method with vector one.
Now you can just play with the color here,
making it slightly bluish,
or any other color you want really.
Finally, we want to blend it with the starry field.
So for that, you can, in fact, add one more mix RGB node
and leave it to mix.
Plug the stars to the first socket,
the globe to the second socket
and here we go.
And by the way, if at this point,
the globe is too soft at the edges for you,
you can always add a curves node here
to raise the intensity for the midpoint,
low points or high points
or make it more contrasty.
A really handy node this one.
You can also rotate this on y somewhat more
to make it coming more
from one side or the other.
Frame this network and call it Glow Bottom.
This one can function as anything really.
For example, an atmosphere layer
or a dimmed glow of the coming dawn.
Next up, we can start adding the moon.
I have found that by far the easiest solution
is to just use an image texture
and stick it onto your sky dome.
So you can search for a CC0 transparent moon texture,
download it and just import it
with this image as planes add-on.
Another one of those indispensable add-ons
that should be active by default.
So once you add it in,
make it larger and stick it onto your sky
with the snapping options activated.
Hit Center and Align Rotation
and then just move the plane across the dome
while holding Control.
Place it where you want the moon to be
and in the shader editor,
plug it into the emission as well.
To control the color of the moon,
you can again add the color mix node
with a similar color as we used for the glow,
only you don't have to make it as intense
in the factor here.
If you want the emission to be controlled
by this color mix too,
just plug this output into it.
Also, you can adjust the emission
if you plug in a curves node
in between the mix node
and the emission socket.
It's, in fact, better if you raise the dark point
and bring down the highlights
so that the emission more evenly spreads
across the moon.
Cool and you know what will make it even more cool?
Activating the bloom option in Eevee Render settings.
I ended up with this settings
of 0.6 in the threshold, larger intensity
and bluish color.
Now, to ensure the moon sticks to the surface
of our sky dome,
you can first parent it to the object,
and then you can also add the shrink wrap modifier
with default settings,
make the target our sky dome
and you can also add a bit of offset
so that the moon never intersects through the sky dome.
Very nice, but the moon is missing a bit more glow to it.
So that's what we'll do next.
The moon glow we could create in many ways.
For example, by sticking in a spherical gradient image
behind the moon image plane
but I wanted it to be part
of my sky dome material.
So instead, I duplicated the bottom glow network
and reused it to make a moon glow.
So first off, let's plug it in by itself
and change the gradient type to be spherical.
Then it will be just a matter of scaling down the glow
and positioning it here
so that it's where the moon is.
Before we do that, however,
we can change this mapping type to texture.
Without going too deep into how the texture type differs
from point type, what's important now
is that if you want to make your texture smaller,
in point type, you would have to go up
with the scale
while in texture type,
you can input numbers smaller than one,
which at least to me always makes more sense,
especially if I want to experiment with placement.
So after a bit of playing around with the scaling
and positioning, I arrived at these numbers.
This is, of course, not the most user-friendly solution.
The glow is traveling over a sphere kinda unreliably
but you can do that.
And mind you, the numbers here will, of course,
depend on the position of your sky dome
of the camera and also where you want the moon
to be in the shot.
And if you find a better solution for this,
definitely let me know in the comments.
Next up, there's the color node.
I left it at about 0.5.
I did not want it to be too colorful
and finally, I plugged it in with a very low factor
and mix blending type.
However, this glow wasn't good enough for me.
I want it to have a larger outside glow
and smaller inside glow.
For that, fortunately, there is an easier solution.
You just use this glow texture twice.
Before we do that, however, let's frame this new network.
And then duplicate this color node
and also, duplicate the mix node
and plug it behind the first one.
Finally, plug the new color node
into this new mix node.
Okay, that just blended in the very same glow
as the previous one.
Only making it more intense.
However, a node that will allow us
to play around with the shape
of the second glow is again this curves node.
By making a contrast curve like this,
I was able to bring down the less-intense parts
of the glow and bring up the highlights,
making a smaller, more intense shape
in the center of it.
Then just edit the factors up here,
blending them until you like the result
and you can also play around with the color
of the two glows here, of course.
Very good, this is getting us somewhere.
Final layer of detail we'll add
are going to be these clouds.
For that, we'll use a noise texture, a 3D type.
So again, plug this in here for now by itself.
Scale of four and we can make it quite detailed
and a level of 12.
Also add a bit of distortion.
Next, bring in a color ramp
to be able to make it black and white.
And increase the contrast like this
by bringing the two points together.
0.45 for black point
and 0.55 for white point looks about right.
To plug it into our network,
bring in a mix node
and plug our last mix output
into the first socket
and for now, let's leave the second one empty,
making the cloud white for a while
because now we're making only the shape of the clouds.
So we will plug this noise texture
into the factor.
That essentially mixes in the white color
to the spots defined by this cloud network.
Now we can see the cloud shape clearly
but of course, we don't want it to be this white.
Before we solve the color though,
let's figure out the mapping.
With Control + T, add the mapping network
to the texture but this time,
we'll choose this object method to drive our mapping.
However, we will not use the sky dome itself
but rather, let's add a new empty
and choose it down here in the object picker.
It's now very, very small
but if we scale it to the scale of our sky,
which was 1,000,
the clouds became the right size.
And you can even change the type of the empty
to be sphere.
Having a helper object like this
is a great method to have direct control
over the positioning, rotation
and scale of your textures,
especially textures you want to animate,
like these clouds.
If now you want to make them move,
you can simply keyframe the empty,
rotate it or move it, whatever looks best for you.
Now, there's a small downside to this
because when you scale your sky dome,
the clouds will not scale with it.
For that, there's a simple solution.
Just parent the empty to the sky dome.
See?
All good now.
Okay, it's time to adjust the color of our clouds.
I mean, I don't want to make anything elaborate here.
Basically just make the clouds darker
with a brighter spot around here
where the glow of the moon is.
And since we already have this glow position figured out,
you can just duplicate this network and push it here.
To see it better,
let's again plug it in by itself.
You can change the type here
to be this quadratic sphere
because that one gives you a smoother glow gradient
rather than the sharper sphere type.
Then just play around with the mapping node again
until you find a proper position for the glow
to be around this point where the moon is.
You can also plug in our favorite color ramp node
but this time, we can use it to color the thing.
By adding a dark blue to the darkest point
and soft blue to the brightest points,
you can color it in a much more believable fashion.
Like this, for example.
Now we want to use it in this cloud structure.
So instead of the plain white color,
plug in this color ramp into the second socket
and voila, we have achieved much better looking clouds.
And now you have this good looking sky dome
that you can easily scale, rotate
and pan around with your camera,
appending it to your night scenes.
Of course, this whole shading network
could be made much more elaborate,
adding more structure to the clouds
and overlaying even more elements.
However, I wanted this tip to be short and easy.
So that's where I'll leave it.
If you watch the previous video I've made,
focusing on weather effects,
you can, of course, add in, for example,
a falling snow simulation
and with a bit of work
and building a few other elements,
create a simple, yet good looking real-time scene in Eevee.
And of course,
if you want to make some more advanced environments,
you can join my master 3D environments in Blender course.
There I'll guide you through all the important steps.
And with that, I thank you for watching
and see you next time
in some of my other videos here at CG Boost
or at my personal YouTube channel.
Links are in the description.
Stay creative, my friends.
Martin out.