This is a small tutorial to show how to get a simple Earth material.
This is mostly a response to a different thread but I figured it would be better as its own.
I also imagine this would be easier to search for as well.
I just want you guys to know before hand, I’m not a pro at UE4, I’ve only been using it for less than 2 months so my knowledge is still very limited.
So I don’t truly know the ins and outs, but I do have a rough idea.
I also don’t make tutorials often, so apologies if things aren’t really well explained, my own ignorance doesn’t help either.
In the end, I hope this helps
There are 4 main color components to the planet, 3 of which we make here.
These components are, daylight color, night time color and clouds.
In the following image we have the 3 textures, their UV inputs will be discussed further in the post.
First we use the “Add” node with the Earth and the cloud textures, this will pretty much paste the clouds onto the Earth texture with the darker parts being transparent and the white parts being opaque.
Now for night time, before we blend the Night time Earth and cloud textures we make the Night time texture darker by multiplying it with a number less than 1 using the “Multiply” node, doing so mathematically is the same as getting a percentage of the original.
Next we multiply the clouds by the night time texture using the “Multiply” node, this will darken and change the color of the clouds, so now they will be a dark blue-ish color.
After that we hook up both the multiplications to another “add”, adding the darkened clouds and the night time texture.
Finally we hook them up into a “Lerp” node or “LinearInterpolate” node. We’ll go over what goes into the Alpha further down.
Simply put, this node uses what ever is put into the alpha to blend between A and B.
Basic use of this would just have A and B blending together using a greyscale source, black only A shown, white only B, and grey, equally blending between both of them.
However you can blend any of the 4 channels should you wish (Red, Green, Blue, Alpha), so for example only red parts on the texture blends, but here we only use greyscale, which will be shown further down.
This next part will show how to do the atmosphere glow, the 4 color component.
The main component of this part is the “Fresnel” node, this is what is used to get it so that it changes color as the angle gets shallower between the camera and object.
I don’t know how exactly the effect work, nor do I understand the equations behind it, it looks good so I roll with it
Now once we have the “Fresnel” node in place we’re gonna need two values, one to go into ExponentIn and another to go into BaseReflectFractionIn.
The easiest way I can describe how ExponentIn works is that it changes how shallow of an angle you need for the effect to be seen.
Extra info (kinda): So a value of 0 would mean you don’t need an angle you would see the effect all the time, but a value of say, 7.5 means you need a fairly shallow angle, in the case of a sphere, you would only see it towards the edges of the sphere.
Now as for BaseReflectFractionIn, I’m not too sure, it seems that low to negative values makes the gradient from effect to no effect smaller, I find having positive values covers the whole object with the fresnel, so I stick with 0 as to me it looks nice. Extremely small positive values also look nice, they give a more atmospheric look to it, for example, using the value 0.04425.
Next we clamp it using a “Clamp” node, this makes it so that any value less that 0 becomes 0 and any values higher that 1 become 1, alternatively you can set what ever the minimum and maximum is, this can be useful for other effects to, but hear it’s just to make sure there aren’t any crazy high values as we also use some nodes in this section to the Emissive Color.
After that it’s time to set the color, to do this we take the result of the clamp and multiply it with a “Constant3Vector” node with the values of R:0, G:0.378, B:0.905 to give it a nice sky blue glow.
After that we put our result into A of another Lerp with “Constant” node with the value of 0 leading to B, what goes into the alpha will be shown in the next part.
So from the Lerp, we create another “Add” node, with the remain value being used from the end Lerp in the Base Color section.
This will past the fresnel effect onto the texture we already had, and now we just plug the result into the Base Color input.
In a separate line, multiply the result of the Lerp by 2 and plug the result into the Emissive Color input.
Alpha & Movement of the Textures
In this section we create the alpha that’s used to blend between night and day as well as how the clouds and main earth texture is moved.
Firstly lets start with the alpha.
We add a “WorldPosition” or as it’s seen in the image “Absolute World Position” node. (I have no idea why the names are different)
This will get the X,Y,Z coordinates of the object the material is applied to in world space.
Then we add a “Vector3Constant” node, this will add to it in world space, I’ve set the values to R:0, G:27.5, B:0, this is to offset the effect so it looks right at X:0, Y:0, Z:0 in world space.
Then we use the “Dot” node to dot(?) the result with a “Constant3Vector”, what this will do is rotate the value with R=X, G=Y, B=Z.
We set the vector with a value of R:0, G:1, B:0, so it is rotated to the Y axis. It doesn’t rotate the way you would think, instead it in a way, points towards the axis.
From here we use a “LinearGradient” function and plug the result of the dot node into the “UV Channel (V2)” parameter.
The value is a bit high, and the gradient is too sharp, to lower it, we multiply it by 0.05.
It’s now slightly further back than we need it to be, looking all silly like, so we add using the “Add” node with a value of 1.
We then clamp the result so things are in a reasonable range and plug the result into the Lerps form the Base Color and the More Color sections.
Now for the texture movement, there isn’t much here, first we have a “TextureCoordinate” node, or as it’s seen “TexCoord”. The result is then split off to two “Panner” nodes for the Coordinate variables.
Then we create a “Time” node and plug that into the Time variable of both panners.
What this will do is move the texture (& UVs?) according to what you set the Speed X/Y values.
To set these values simply click on the panner and set the values, in this tutorial, for the first Speed X = 0.001 and Speed Y = 0, for the bottom Speed X = -0.003 and Speed Y = 0.
The first panner result is plugged into the clouds UVs parameter used in the Main Color section and in the next Specular & Roughness section.
The second panner result is plugged into the earth day/night UVs paramer in the MainColor and next section.
Specular & Roughness
This could be considered a color component, but I think it being referred to as the reflectivity component would be more accurate.
So starting with the specular, we need two textures, the cloud texture we used earlier and a specular mask texture.
For the specular mask to work properly, the land masses of the image would need to be black with the oceans white as white, should you have the opposite, all you need to do is plug the texture into a “OneMinus” node or as it’s seen “1-x” node and it will invert the image, so white is now black and black is now white.
First we add the cloud texture with the specular map, or the “1-x” result.
Then plug this bad boy straight into the Specular input.
The reason we add the clouds to the spec map is because the clouds don’t reflect as much as the ocean.
Now for the roughness, this bit’s optional, however I don’t like how it looks without it.
We use the spec map (though note, this time we need it the opposite way round, where the oceans are black and land is white, so you may or may not need to use the “OneMinus” node) and the cloud texture and blend them together using the “Add” node.
From that, we use another add node to add a value of 0.3, this will make it so that the oceans aren’t perfectly reflective like a mirror, but not also super dull.
We plug the result of the add to the Roughness input.
And you should get similar results.
After a little of exposure change.
Would like mention the creator of the following video
UE4 Dissolve Materials
From that video I learned about the how to include world position data, of which I use in this tutorial.
The video is in, from what I can tell Russian, but the creator goes slow enough that you can easily add what he’s adding, plus he’s using the engine in English.