advanced_shading - ptabriz/geodesign_with_blender GitHub Wiki


my alt text


Contents:

I. Introduction
II. Draping the satellite imagery
III. Creating the earth surface roughness
IV. Illuminating the earth at night
V. Creating the day/night division
VI. Creating the clouds

Required software and materials

  • Download and install latest version of Blender from here.
  • Download and unpack sample_data folder from here

Blender Viewport NASA satellite imagery used in this tutorial: daytime imager (above left), elevation (above right), nightime imagery (bottom left), and cloud imagery (bottom right)

I. Introduction

In the tutorial, we model and render earth surface and clouds using advanced shading methods available in Blender Cycle Render Engine. The tutorial will proceed in five steps each of which integrate new shaders and texture maps: 1) using daytime satellite imagery to represent the earth texture during the day; 2) using elevation map to represent surface roughness; 3) using satellite imagery to represent the nighttime texture; 4) splitting the earth surface to represent both night and day texture; 5) using the cloud imagery to represent the clouds.

We will implement all steps using the Blender's Node Editor where shaders and textures are represented as interconnecting nodes. Each step includes workflows for adding new nodes (figure below, left), linking the nodes (figure below, middle), and adjusting the parameters of each node (figure below, right). All, texture maps are retrieved from NASA satellite imagery (figure above).

Blender Viewport adding a new node Blender Viewport linking two nodes Blender Viewport changing node parameters

I. Preparing the Blender scene

  • Run Blender and open the file "shading_earth.blend".
  • Set render engine to "Cycles". You can find it in the top header, the default is "Blender Render"
  • IMPORTANT: hide the “cloud” object, so the changes to the sphere object is visible. You can hide the object by deactivating the Eye(hide) and Camera(render) icon in outliner.
  • Select the Earth_sphere object (using right_click).
  • Go to Properties tab > Material > press + New button to create a new Material. Rename the Material to Globe.
  • Upon material creation a Diffuse Shader is automatically added which can be seen in the Node_editor (see figure below, left).

II. Draping the satellite imagery

In this step, we drape the satellite imagery as a Image Texture node connected to Diffuse BSDF shader Node. We will use Texture Coordinate node to assign the equirectangular texture to the spherical surface of the earth object. Since the globe does not have a flat surface, we need to adjust the texture dimensions so that it drapes to the globe surface. For that purpose we use a Texture Coordinate node.

  • Node additions:

    • To add the satellite image as a texture image:
      • In the Node editor, bottom header click on Add menu and go to Texture > Image Texture.
      • In the Texture node Click on the folder icon to browse a new image.
      • Navigate to the folder sample_data > Select Albedo.jpg.
    • To add the Texture Coordinate node:
      • From the Node editor, bottom header click on Add menu and go to Input > Texture Coordinate.
  • Node links:

    • Connect the Generated output to the Vector input of the Image Texture node. You will see that the globe image is nicely draped onto the sphere surface
    • Connect the Color output of the Image Texture node to Color output of the Diffuse node.
  • Node parameters:

    • In the Image Texture, third dropdown option change Flat to Sphere
  • Select Viewport Shading to Render to see the sphere object rendered.

Note: Generated option in texture coordinate node creates automatically-generated texture coordinates from the vertex positions of the mesh without deformation, keeping them sticking to the surface. see Blender Manual for more info

Blender Viewport Node editor after adding the new nodes (in red)
Blender Viewport Viewport rendering of the sphere object


III. Creating the earth surface roughness

In this step, we use the elevation image map to represent the roughness of earth surface. For doing that we create a Bump node and assign the elevation map as a Height parameter using an Image texture Node.

  • Change Viewport Shading mode back to Material

  • Node additions:

    • To add the Bump Node:
      • In the Node editor, bottom header click on Add menu and go to Vector > Bump.
    • To add the elevation image as bump map:
      • Add a new Image Texture node (described in step II).
      • Click on the folder icon to browse a new image
      • Navigate to the folder sample_data > Select Bump.jpg.
  • Node links :

    • color output of the Image texture node -> height input of the Bump node.
    • Generated output of the Texture Coordinate node -> Vector input of the Image Texture node.
    • Connect Normal output of the Bump node to Normal input of the Diffuse node.
  • Node parameters :

    • Set the Strength parameter of the Bump node to 1000
    • In the Image Texture, third dropdown option change Flat to Sphere
  • Set 3D Viewport Shading to Render to explore the new surface.

Blender Viewport Node editor after adding the new nodes (in red)
Blender ViewportViewport rendering of the sphere object

IV. Illuminating the earth at night

In this step, we illuminate the earth using the night time satellite imagery. First, we use Emission node and Image Texture node to assign the night-time imagery. Then, we use Mix Shader node to combine the Emission and Diffuse (created in step II and III) nodes.

  • Change Viewport Shading mode back to Material

  • Node additions:

    • To create the Emission node :
      • In the Node editor, bottom header click on Add menu and go to Shader > Emission.
      • In the node panel, set the Strength parameter to 10
    • To add the elevation image as bump map:
      • Add a new Image Texture node (described in step II).
      • Click on the folder icon to browse a new image.
      • Navigate to the folder sample_data > Select night_lights.png.
      • In the third dropdown option of the node, change Flat to Sphere.
    • To create the Mix Shader node:
      • From the bottom header select Add menu and go to Shader > Mix Shader.
  • Node links:

    • Generated output of the Texture Coordinate node -> Vector input of the new Image Texture node.
    • Color output of the Image Texture-> Color input of the new Emission node.
    • Disconnect Surface input of the Material Output node and replace it with the Shader output of the Mix Shader node.
    • BSDF and Emission outputs of the Diffuse and Emission nodes -> upper and lower Shader inputs of the Mix Shader, respectively.
  • Node parameters:

    • In the Mix shader node panel, adjust the Fac (factor) parameter to adjust the mixture level. e.g., 0.500 means that both shaders are equally mixed (figure below, left).
Blender Viewport Node editor after adding the new nodes
Blender Viewport Viewport rendering of the sphere object with fac level 0 Blender Viewport Viewport rendering of the sphere object with fac level 0.5

V. Creating the day/night division

Blender Viewport Camera view (left) and perspective view (right) of the sphere object. The day/night division line is locked to the camera rotation.

In this step we use the Color Ramp node to partly mask the earth surface to day and night portions. Then, we will link the position of the division line to the scene camera position using Camera data node so that the day/nigh division change dynamically as camera rotates around the earth. We will add extra control over the position and rotation of division line using a Mapping node. From previous step we learned how the Factor (Fac) parameter of Mix Shader node adjusts the contribution degree of each of the two shaders. The factor can also be controlled by a map such as a gradient map to control the mixture spatially.

  • Change Viewport Shading mode back to Material

  • Node additions:

    • To add the Color Ramp Mode:
      • From the Node editor, bottom header click on Add menu and go to Convertor > ColorRamp(figure below).
    • To add the Mapping node:
      • From the Node editor, bottom header click on Add menu and go to Vector > Mapping.
    • To add the Mapping node:
      • From the bottom header click on Add menu and go to Input > Camera Data.
  • Node links:

    • Color output of the ColorRamp -> Fac input of the Mix Shader.
    • Vector output of the Mapping node -> Fac input of the ColorRamp node.
    • View Vector output of the Camera Data node -> Vector input of the Mapping node.
  • Node parameters:

    • In the ColorRamp node:
      • you can see a gradient slider with a black and white knob on the right and a left ends, respectively. Click and drag the black controller to the left and the and the white to the right until the darkness cuts through the middle of the sphere (see figure below).
      • From the drop-down options right above the gradient slider change linear to spline so that the division line becomes smoother representing the twilight area.
    • In the Mapping node:
      • In the Scale section, change X parameter to 10, Y to 0.5 and Z to 1.0.
      • In the Rotation section, change Y parameter to -20.
  • In 3D view, hold down the scroll button and drag the mouse to rotate around the sphere. You can see the darkness line moves as camera orbits around the sphere.

  • Set 3D Viewport Shading to Render to explore the new surface.

Blender Viewport Node editor after adding the new nodes
Blender Viewport Viewport rendering of the sphere object

VI. Creating the clouds

In this step, we assign Volume scatter node to a separate sphere to render the clouds. The cloud sphere is slightly larger to represent the atmosphere around earth. Similar to the first step, we use Image Texture and Texture Coordinate nodes to drape the clouds image (NASA imagery) on to the cloud sphere.

Blender Viewport Outliner Editor showing the list of objects Blender Viewport 3D viewport in wireframe shading mode showing the earth sphere (highlighted in orange) inside the cloud sphere
  • Change Viewport Shading mode back to Material

  • In the Outliner editor you can see an object called Cloud_sphere.

  • Click on the eye icon to unhide the object and the camera icon to make it renderable (figure above, left). In 3d view you should see the earth sphere object buried under the cloud sphere object which is rendered as a white solid object.

  • Add a new material and name it Clouds (see step II for creation of new material)

  • In the node editor click on Diffuse BSDF node and press delete to remove the node.

  • Node additions:

    • To add the Volume Scatter node:

      • From the Node editor, bottom header click on Add menu and go to Shader > Volume Scatter.
    • To add the cloud image as a texture for the volume shader:

      • Add a new Image Texture node (described in step II).
      • Click on the folder icon to browse a new image.
      • Navigate to the folder sample_data > Select clouds.png.
    • To add the Texture Coordinate:

      • From the Node editor, bottom header click on Add menu and go to Input > Texture Coordinate.
  • Node links:

    • Generate output of the Texture Coordinate node -> Vector input of the Image Texture node.
    • Color output of the Image Texture node -> Color input of the Volume Scatter.
    • Volume output of the Volume Scatter node -> Volume input of the Material Output Node.
  • Node parameters:

    • Image Texture node, third dropdown option of the node, change Flat to Sphere.
    • In Volume Scatter node, set Density to 20 and Anistropic to 0.6.
  • Set 3D Viewport Shading to Render to explore the new material.

Blender Viewport Node editor after adding the volumetric nodes
Blender Viewport
Rendering of the earth sphere object
⚠️ **GitHub.com Fallback** ⚠️