Creating a realistic Earth as seen from space
In this recipe, we will create a realistic Earth as shown in the following screenshot, using both image textures from the Web and some procedurals:
The image textures provided with this Cookbook have generally been heavily down-scaled and are good for demonstration purposes only (in this case, for a very distant Earth render). For better results with this recipe, replace these low-resolution images with high-resolution versions that you can find at these addresses:
Before you download anything, always take a look at the license of the images provided by any site you can find to ensure that they are released as freely usable, especially if you are going to use them for commercial work. All the preceding links should be okay, but on the Internet, things can change quite quickly, so double-check!
You will need at least five image maps for this recipe: Earth-color, the color of the land or sea in daylight; Earth-night, the color of the land or sea at night (usually provided with superimposed city lights); Earth-bump, a gray-scale, high map of the continents; Earth-spec, an outline with the continents in black and the water masses perfectly white; and Clouds, a gray-scale map of the clouds as shown in the following screenshot:
Actually, Cycles can handle very big textures pretty well, even 16 K images (that is, images made by 16.000 pixels for the longest side), so you can use them at the best resolution you can find. Be aware that the bigger the resolution of the textures, the longer the rendering times, especially if they are used as bump maps.
Now perform the following steps:
- Start Blender and switch to the Cycles Render engine.
- Delete the default Cube and add a UV Sphere (with the mouse arrow in the 3D view, press Shift + A and navigate to Mesh | UV Sphere). In the Outliner, rename it as
Earth_Surface
. - With the mouse arrow in the Camera view, press the 1 key on the numeric keypad to go to the Front view. Then press the 5 key to switch to Orthogonal. Next, press Tab to enter Edit Mode, followed by A to select all the vertices. Finally, press U. In the UV Mapping pop-up menu, select Sphere Projection. Then exit Edit Mode.
- Make sure you place the 3D Cursor at the center of the UV Sphere. Then add an Empty (press Shift + A and navigate to Empty | Arrows). In the Object data window, set its Size to
2.00
and rename it as Empty_terminator
. Go to the Object Constraints window and assign a Damped Track constraint to the Empty_terminator. In the Target field, select the Sun item (the Lamp), and in the To field, click on the X button. - Reselect the UV Sphere and go to the UV Maps subpanel under the Object data window. Click on the + icon button to add a new UV coordinates layer. Rename it as
UVMap_terminator
. - Go to the Object modifiers window and assign a Subdivision Surface modifier first, followed by a UVProject modifier. For this modifier, in the UV Map field, select the UVMap_terminator item. In the Object to use as projector transform field, select the Empty_terminator.
- Press Shift + D and press Enter to duplicate the Earth_Surface object. In the Transform subpanel under the Properties panel to the right (press N if this is not activated), set the Scale value for X, Y, and Z to
1.001
. Rename it as Earth_Clouds
. - Duplicate it again, set the Scale value to
1.002
, and rename it as Earth_Atmosphere
. - Add a new Empty (press Shift + A and navigate to Empty | Plain Axes) and rename it as
Empty_Earth
. In the Object data window, set its Size to 2.00
. Press Shift and select the Earth_Surface, Earth_Clouds, Earth_Atmosphere, and the Empty_Earth objects. Press Ctrl + P and click on Object to parent the three UV Spheres to Empty_Earth. - Select Empty_Earth, and in the Transform panel, set the Rotation values of X to
18.387°
, Y to 0.925°
, and Z to -4.122°
(you can obviously rotate the Empty_Earth as you wish, but this helps provide a nice point of view on the specular effect showing on the oceans). - Select the Camera, and in the Transform panel, set the Location values of X to
-0.64000
, Y to -4.70000
, and Z to 0.12000
. Then set the Rotation values of X to 89°
, Y to 0°
, and Z to -9°
. Go to the Object data window and change the Focal Length to 60.000
(millimeters). Press the 0 key on the numeric keypad to go to the Camera view. - Go to the World window and change the background Color to pure black.
- Select the Lamp and change it to a Sun. Set the Size to
0.050
and the Strength to 10.000
. Set the Color values for R to 1.000
, G to 0.902
, and B to 0.679
. In the Transform panel, set the Location values of X to 158.00000
, Y to -27.00000
, and Z to 107.00000
. For Rotation, set X to 1.5°
, Y to 56°
, and Z to -8°
(Sun lamps don't need a location, but in this case, we need it to establish a target for a later-to-come day/night terminator trick). - Go to the Render window. Under the Sampling subpanel, set the Clamp Direct and Clamp Indirect values to
1.00
, the Preview samples to 20
, and the Render samples to 50
. - Go to the Scene window. In the Color Management subpanel, click on the Use Curves item. Set the Exposure value to
1.000
. Then click inside the curve window to add a new point, and place it at position X as 0.61149
and Y as 0.71250
. Then set the value of the B channel for the White Level between 0.800
and 0.850
.
After the creation of the 3D scene and the setting of the lighting, let's go for the materials, starting with the planet's surface.
In the Outliner (just temporarily), hide the Earth_Clouds and Earth_Atmosphere objects by clicking on the little eye icons to the right side of the names. This is to see only the Earth_Surface in the viewport, rendered and updated in real time as we work on the material:
- Select the Earth_Surface object. Click on the New button in the Material window under the Properties panel or in the Node Editor toolbar. Rename the material as
Surface
. - In the Material window under the main Properties panel, switch the Diffuse BSDF shader with a Mix Shader node. In the first Shader slot, load a new Diffuse BSDF shader and set its Roughness value to
1.000
. In the second Shader slot, load a Glossy BSDF node. Then set its Roughness value to 0.700
and Distribution to Beckmann. Set the Fac value of the Mix Shader to 0.100
. - Press N in the Node Editor window to open the Active Node panel. Label the shaders as
Diffuse_Lands
and Glossy_Lands
and the Mix Shader as Mix Shader_Lands
. - Add an Image Texture node (press Shift + A and navigate to Texture | Image Texture) and connect its Color output to both the Color input sockets of the Diffuse_Lands and Glossy_Lands shaders. Click on the Open button on the Image Texture node, browse to your
textures
directory, and load the Earth-col_low.png
image (or a high-resolution version, if available). Label the image node as Color_Day
. - Add a new Image Texture node (press Shift + A and navigate to Texture | Image Texture) and a Bump node (press Shift + A and navigate to Vector | Bump). Connect the Color output of this Image Texture node to the Height input socket of the Bump node. Then connect the Normal output of the Bump node to the Normal input sockets of both the Diffuse_Lands and the Glossy_Lands nodes.
- Label the second Image Texture node as
Bump
. Then click on its Open button and load the Earth-bump_low.png
image. Set the Color Space to Non-Color Data. Label the Bump node as Bump_Lands
and set the Strength value to 0.020
. - Add a MixRGB node (press Shift + A and navigate to Color | MixRGB) and paste it between the Color_Day and the Diffuse_Lands nodes. Set the Blend Type to Color, the Fac value to
0.300
, and the Color2 value for R to 0.072
, G to 0.127
, and B to 0.578
. - Add a Frame (press Shift + A and navigate to Layout | Frame). Press Shift and select the two image texture nodes (Color_Day and Bump), the Color node, Bump_Lands node, Diffuse_Lands and Glossy_Lands shaders, and then the Frame. Press Ctrl + P to parent them. Label the Frame as
LANDS
as shown in the following screenshot: - Now add a Noise Texture node (press Shift + A and navigate to Texture | Noise Texture), a Bump node (press Shift + A and navigate to Vector | Bump), a Diffuse BSDF shader (press Shift + A and navigate to Shader | Diffuse BSDF), and a Glossy BSDF shader (press Shift + A and navigate to Shader | Glossy BSDF).
- Set the Noise Texture node's Scale value to
1000.000
and connect its Color output to the Height input socket of the Bump node. Label this node as Bump_Seas
, set the Strength value to 0.015
, and connect its Normal output to the Normal input sockets of the new Diffuse BSDF and Glossy BSDF shaders. Label them as Diffuse_Seas
and Glossy_Seas
and set the Glossy BSDF node's Roughness value to 0.150
. - Add a Frame (press Shift + A and navigate to Layout | Frame). Press Shift and select the new nodes and then the Frame. Press Ctrl + P to parent them. Rename the frame as
SEAS
. - Add a Mix Shader node (press Shift + A and navigate to Shader | Mix Shader), label it as
Mix Shader_Seas
, and place it just under the Mix Shader_Lands node. Set the Fac value to 0.100
. Connect the output of the Diffuse_Seas node to the first Shader input, and the output of the Glossy_Seas node to the second Shader input socket. - Press Shift + D to duplicate the Mix Shader_Seas node and paste it between the Mix Shader_Lands and the Material Output nodes. Label it as
Mix Shader_Surface
. Connect the output of the Mix Shader_Seas node to its second Shader input socket. - Add a new Image Texture node (press Shift + A and navigate to Texture | Image Texture) and rename it as
Spec/mask
. Connect its Color output to the Fac input socket of the Mix Shader_Surface node. Click on the Open button to load the Earth-spec_low.png
image. Set the Color Space to Non-Color Data. - Add a Frame (press Shift + A and navigate to Layout | Frame). Press Shift and select the Spec/mask node and then the Frame. Press Ctrl + P to parent them. Rename the frame as
SEPARATOR LANDS/SEAS
. - Now click on the Color output of the Color_Day image texture inside the LANDS frame, and drag it so that it is connected to the Color input of the Diffuse_Seas shader node inside the SEAS frame.
- Add a MixRGB node (press Shift + A and navigate to Color | MixRGB) to the SEAS frame (just add it and parent it to the frame). Paste it just before the Diffuse_Seas shader. Switch the Color1 connection to the Color2 input socket. Then set the Color1 values for R to
0.002
, G to 0.002
, and B to 0.022
. - Add a ColorRamp node (press Shift + A and navigate to Converter | ColorRamp) to the SEAS frame and label it as
ColorRamp01
. Connect the Color output to the Color input of the Glossy_Seas shader. Set Interpolation to B-Spline. Change the black color stop (index 0) to pure white and the white color stop values (index 1) for R to 0.072
, G to 0.127
, and B to 0.578
, with Alpha value set to 0.000
. Move it to 0.150
position. Click on the + icon button to add a new color stop. Change its Color values for R to 0.965
, G to 0.462
, B to 0.223
, and Alpha to 1.000
. Move it to 0.075
position. - Add a Layer Weight node (press Shift + A and navigate to Input | Layer Weight) to the SEAS frame. Connect the Facing output to the Fac input socket of the ColorRamp01 node and the Fac input socket of the MixRGB node. Set the Blend factor to
0.200
as shown in the following screenshot: - Add an Image Texture node (press Shift + A and navigate to Texture | Image Texture), a ColorRamp node (press Shift + A and navigate to Converter | ColorRamp), a MixRGB node (press Shift + A and navigate to Color | MixRGB), and an Emission shader (press Shift + A and navigate to Shader | Emission). Label the Image Texture node as
Color_Night
and the ColorRamp as ColorRamp02
. - Connect the Color_Night node's Color output to the Fac input socket of the ColorRamp02 node, and the Color output of this node to the Color1 input socket of the MixRGB node. Then connect the MixRGB node's output to the Color input of the Emission node.
- In the Color_Night image texture node, load the
Earth-night_low.png
image. Set the ColorRamp02 node's Interpolation to B-Spline and move the black color stop to 0.250
position. Then move the white color stop to the 0.495
position. Set the MixRGB node's Blend Type to Multiply, the Fac value to 0.700
and the Color2 values for R to 1.000
, G to 0.257
, and B to 0.090
. Set the Emission node's Strength value to 1.000
. - Add a Frame (press Shift + A and navigate to Layout | Frame). Press Shift to select these new nodes and then the Frame. Press Ctrl + P to parent them. Rename the frame as
NIGHT
. This is shown in the the following screenshot: - Add an Attribute node (press Shift + A and navigate to Input | Attribute), a Gradient Texture node (press Shift + A and navigate to Texture | Gradient Texture) and a ColorRamp node (press Shift + A and navigate to Converter | ColorRamp). Connect the Vector output socket of the Attribute node to the Vector input socket of the Gradient Texture node, and the Color output of this node to the Fac input socket of the ColorRamp node.
- In the Name slot of the Attribute node, write
UVMap_terminator
. Set the ColorRamp node's Interpolation to B-Spline. Then move the black color stop to 0.500
and the white color stop to the 0.000
position. Click on the + icon button to add a new color stop. Set its color to pure black as well. - Add a Frame (press Shift + A and navigate to Layout | Frame). Press Shift to select these three nodes and then the frame. Press Ctrl + P to parent them. Rename the frame as
TERMINATOR
. - Add a Mix Shader node (press Shift + A and navigate to Shader | Mix Shader), label it as
Mix Shader_Terminator
, and paste it just between the Mix Shader_Lands and the Mix Shader_Surface nodes. Connect the output of the Emission node inside the NIGHT frame to its second Shader input socket, and the Color output of the ColorRamp inside the TERMINATOR frame to its Fac input socket as shown in the following screenshot:
As second planet material, let's go with the clouds by performing the following steps:
- Now go to Outliner, unhide the Earth_Clouds sphere, and select it. Click on New in the Material window under the main Properties panel or in the Node Editor toolbar. Rename the material as
Clouds
. - In the Material window under the main Properties panel, switch the Diffuse BSDF shader with a Mix Shader node. Label it as
Mix Shader_Clouds
, and in the first Shader slot, load a Transparent BSDF shader. In the second Shader slot, load a new Diffuse BSDF shader. Set the color of both the shaders to pure white. - Add an Image Texture node (press Shift + A and navigate to Texture | Image Texture) and a Bump node (press Shift + A and navigate to Vector | Bump).
- Label the Image Texture node as
Clouds
and the Bump node as Bump_Clouds
. Connect the Bump node's output to the Normal input of the Diffuse_Clouds node. Set the Strength value to 0.020
. - Click on the Open button of the Clouds image texture node and load the
Clouds_low.png
image. Set the Color Space to Non-Color Data. - Press Shift + D to duplicate the Clouds image node. Then add a Texture Coordinate node (press Shift + A and navigate to Input | Texture Coordinate) and a Mapping node (press Shift + A and navigate to Vector | Mapping). Connect the UV output of the Texture Coordinate node to the Mapping node, and the output of this node to the Vector input socket of the duplicated Clouds image texture node.
- Add a MixRGB node (press Shift + A and navigate to Color | MixRGB) and connect the output of both the two Clouds image texture nodes to the Color1 and Color2 input sockets. Set the Blend Type to Add and the Fac value to
1.000
. Connect the Color output to the Height input socket of the Bump_Clouds node and to the Fac input socket of the Mix Shader_Clouds node. - In the Mapping node, set the Rotation values of X to
32°
, Y to 17°
, and Z to 5°
. - Add a Frame (press Shift + A and navigate to Layout | Frame). Press Shift to select the nodes and then the Frame. Then press Ctrl + P to parent them. Rename the frame as
CLOUDS
. This is shown in the screenshot:
The third planet material is the atmosphere layer:
- In Outliner, unhide the Earth_Atmosphere sphere and select it. Click on New in the Material window under the main Properties panel or in the Node Editor toolbar. Rename the new material as
Atmosphere
. - In the Material window on the right, under the main Properties panel, switch the Diffuse BSDF shader with a Mix Shader node. Label it as
Mix Shader_Atmos1
, and in the first Shader slot, load a Transparent BSDF shader (label it Transparent_Atmos1
). In the second Shader slot, load a Diffuse BSDF shader (label it Diffuse_Atmos1
). - Add a Layer Weight node (press Shift + A and navigate to Input | Layer Weight) and a ColorRamp node (press Shift + A and navigate to Converter | ColorRamp). Connect the Facing output of the Layer Weight node to the Fac input of the ColorRamp (label it
ColorRamp03
). Set the ColorRamp03 node's Interpolation to B-Spline, move the black color stop to the 0.395
position, and set the Alpha value to 0.000
. Set the color of the white color stop (index 1) for R to 0.072
, G to 0.127
, and B to 0.578
. - Connect the Color output of the ColorRamp03 node to the Color input socket of the Diffuse_Atmos1 node, and the Alpha output to the Fac input of the Mix Shader_Atmos1 node. Set the Layer Weight node's blend factor to
0.500
. - Add a Frame (press Shift + A and navigate to Layout | Frame). Press Shift to select these nodes and then the Frame. Then press Ctrl + P to parent them. Rename the frame as
ATMOSPHERE
. - Add an Attribute node (press Shift + A and navigate to Input | Attribute), a Gradient Texture node (press Shift + A and navigate to Texture | Gradient Texture), and a ColorRamp node (press Shift + A and navigate to Converter | ColorRamp). Connect the Vector output socket of the Attribute node to the Vector input socket of the Gradient Texture node, and then the Color output of this node to the Fac input socket of the ColorRamp (label it
ColorRamp04
). - In the Name slot of the Attribute node, type
UVMap_terminator
. Set the ColorRamp04 node's Interpolation to B-Spline. Then move the black color stop to the 0.400
position and the white color stop to the 0.600
position, but change this stop's color to black as well. Click on the + icon button to add a new color stop. Set its color to pure black and move it to the 0.450
position. Click on the + icon button again to add a new color stop. Set its color to pure black and move it to the 0.550
position. Set the Alpha of all the four black color stops to the 0.000
. Click once more on the + icon button to add a new color stop. Set its color values for R to 1.000
, G to 0.047
, and B to 0.005
. Set Alpha value to 0.100
and move it to the 0.500
position. - Add a Mix Shader node (press Shift + A and navigate to Shader | Mix Shader), a Transparent BSDF node (press Shift + A and navigate to Shader | Transparent BSDF), and an Emission node (press Shift + A and navigate to Shader | Emission). Label them as
Mix Shader_Atmos2
, Transparent_Atmos2
, and Diffuse_Atmos2
. - Connect the Transparent_Atmos2 node's output to the first Shader input socket of the Mix Shader_Atmos2 and the Diffuse_Atmos2 output to the second Shader input. Then connect the Color output of the ColorRamp04 node to the Color input socket of the Diffuse_Atmos2 node and the Alpha output to the Fac input socket of the Mix Shader_Atmos2 node.
- Add a Frame (press Shift + A and navigate to Layout | Frame). Press Shift to select these nodes and then the Frame. Then press Ctrl + P to parent them. Rename the frame as
RED_TERMINATOR
. - Add a final Mix Shader node (press Shift + A and navigate to Shader | Mix Shader), label it as
Mix Shader_Atmos3
, and set the Fac value to 0.950
. Connect the output of the RED_TERMINATOR frame to the first Shader input socket and the output of the ATMOSPHERE frame to the second Shader input socket. Then connect the output of the Mix Shader_Atmos3 node to the Surface input socket of the Material Output node as shown in the following screenshot:
The three overlapping UV Spheres technique is quite old, and (at least for what relates to Blender) dates back to almost 2004—more precisely to the How to make a realistic planet in Blender(2004) tutorial I wrote at that time for Blender version 2.23/2.30 (http://www.enricovalenza.com/rlpl.html). That tutorial is now outdated, but the technique and basic concepts still work, even in Cycles. Hence, we get the planet surface on the smaller of the spheres, a clouds layer on a slightly bigger sphere, and the enveloping atmospheric Fresnel effect on the biggest sphere.
We divided the material creation process into the three stages, corresponding to the three layers/spheres. First, we built the more complex of all the three shaders that is the Surface material:
- From step 1 to step 8, we built the shader for the continents—simple image textures connected as color factors to a Diffuse BSDF and Glossy BSDF shaders. From step 9 to step 13, we made the basic shader for the oceans.
- In steps 14 and 15, we split the continents component from the oceans using the
Earth-spec
map, a black-and-white image working as a stencil for the factor input of the Mix Shader_Surface node. We also connected the Earth-color
map to the SEAS diffuse shader to bring color back to the oceans. - From step 16 to step 19, we added a ColorRamp node to the SEAS frame, driven by a Facing fresnel node. This was done to enhance the color of the water's specularity (according to what NASA's satellite photos often show). A deep blue color was mixed with the color image map by a MixRGB node. Thanks to the Facing fresnel node, the blue color was mapped on the mesh faces perpendicular to the point of view, resulting in darker water masses towards the center of the Earth sphere.
- From step 20 to step 23, we built the night shader. The Earth-night image was clamped (contrasted) by a ColorRamp node, and the resulting brightness values were multiplied by a reddish color in the MixRGB node. All of this was then assigned to an Emission shader. The night side of the Earth surface shows only in the shadow part of the sphere thanks to the Empty_terminator trick.
- From step 24 to step 27, we built the day/night terminator stencil.
- Then, from step 28 to step 36, we built the
Clouds
layer on the second sphere. We added more variety to the single Clouds_low.png
image by superimposing and offsetting (the mapping rotation of) a copy of the same cloud image. - From step 37 to step 47, we built the
Atmosphere
layer on the third (bigger) sphere, with the Fresnel atmospheric effect and the reddish terminator.
As you have probably noticed, we didn't use any Texture Coordinate or Mapping nodes to map the image maps. This is because the UV Spheres had been unwrapped with Image Texture nodes. The existing UV coordinate layer was automatically taken into account by Cycles for the mapping.
For the ocean bump, which was obtained by the Noise procedural, the Generated mapping option was automatically used.
Thanks to the Damped Track constraints, which were targeted to the position of the Sun lamp, we could use the Empty_terminator object as a UV coordinates projector for the day/night division on the planet surface and for the red colored transition zone (the red terminator) in the Atmosphere
layer.