[Beginner Tutorial] Blender 2.79+Cycles - Create a full space environment with shaders (procedural).

edited November 2017 in XPlore Modding

Disclaimer:

These series of tutorials does not claim at all to be the ultimate solution and are based on my own experiments during the development of the project. So are annotated there reflections and remarks for which I am solely responsible.If they were inappropriate and/or wrong, in this case, do not hesitate to contact me via pm for corrections or comment under this article, but, please, do not forget to mention the source of your information.
To be honnest, these articles was firstly for my own use as reminder for the whole process. It is so more a synthesis of methods and references than a real tutorial, methods and references that are, the most of the time, adaptations of video tutorials I found on YouTube. In no cases I pretend be the author of these video tutorials, the involved authors are always credited and the needed links added.

Requirements:

  • Blender 2.7x
  • … Well, a basic knowledge of the Blender interface: How to select and move objects, remove them, save, load, etc...
  • And by the way: <troll mode>Be sure running an OS which rocks and does not disable the keyboard once the latest update installed, make not freeze your screen(s), or which does not rot your system with junk and sh*twares of all sorts.</troll mode>

But why procedural?

A few explanations:

Yes, the classical method was: Seams marking on the model -> UV mapping -> texture drawing -> texture mapping -> rendering -> ...this-is-not-good-we-start-over ... Neeext !
well, even if the process is relatively easy with Blender, it remains awfull, an opinion I share with the most part of modelers whose I'v read the topics.
Concerning procedural, it is another story. First, keep in mind that the most part of modern game engines, if not all, propose it, and concerning studios themselves, they seems use it more and more. Certainly by simplification of the process at first, but also for a possible saving of loading times, as well for the artist(s) as for future possible players (briefly explained here). Regarding Blender itself: We have the chance to get a direct result on the screen via the renderings. Yes, by this method, you can see in real time the modification of each parameter, which is already in itself a considerable saving of time!
We will take this opportunity to talk about the rendering settings with this video by Andrew Price (at Blender Guru) I recommend it:

All of this to say that finally, with a bit of imagination, and (lot of) work, we can easily imaginate texturing about anything without any use of picture.

Part 1

We will start by creating a star, which will be the central axis of a future animation simulating orbits.

Note: This section is an adaptation from a video tutorial realized by Sardi Pax. The difference is that in the present tutorial, and for reasons of brevity and subject (the procedural textures), the part concerning the particle system will not be mentioned. Furthermore, the compositing part into the video won't fit for a whole scene, and I simplified it a lot in the current tut.
For the whole thing, please check here:


Sardi's YouTube channel

  • Open Blender
  • Enable Cycles render on the top bar, instead of the internal one. The old Blender render won't be used anymore in future versions
  • Let's begin by setting the main view and let's face the thing: → On numeric keypad, hit « 1 »
  • Then remove the base cube : Hit « x », then validate (mouse left click or « Enter »... just in case)

Click on pictures to enlarge

  • Create a base mesh: Here, an Ico Sphere -> Shift + A :

  • 1 : In the panel at the bottom left, set the subdivisions to 6, validate
  • 2 : Then smooth your mesh :

But why an Ico Sphere instead of an UV Sphere?
Extract from an answer from Dave Jarvis on Blender Stack Exchange:

UV spheres are best used in situations where you require a very smooth, symmetrical surface (the more subdivisions the better). However, they do relatively poorly when realistic topology is your key goal. UV spheres are not the best for organic natural shapes, because of their symmetry and the use of quads.

ICO spheres are best used for objects such as:

Geodesic Domes
Planets with realistic terrain
Rough surfaces, such as golf balls.

Source: https://blender.stackexchange.com/questions/72/what-is-the-difference-between-a-uv-sphere-and-an-icosphere

Copy that. But even if a star is not a planet, we maybe would want simulate, later, some reliefs such than solar spots or explosions on its surface (non developed in this tut). So let's go for Ico Sphere.

  • Create the base texture :

  • 1 : Select your mesh.

  • 2 : Select the materials tab, create a new one, then rename it (here: yellow.sun.mat). By the way, rename also your mesh (Yellow Sun here)


Why this name? Choosing a resource name is not as trivial as it sounds: All artists, and game developers say it and repeat it: Reuse your materials to save system resources. So, being able to choose a name that will be found for a similar situation later might seem wise.
For my part, I always put a little extra extension to always find my resources (* .mat = material, an old habit). Just to not add to the ambient mess. Indeed, the more you will advance in the tutorials, the more you will see that your final scene will bring together an impressive number of diverse and varied elements (the resources).

  • 3 : Drag and drop the bottom view to the top to split your workspace in two
  • 4 : Change the bottom view to the node editor


You should have this:
Scroll up or down into the view to zoom in or out

Into the node editor hit :

Shift + A → Textures → Voronoi Texture - left click to anchor
+
Shift + A → Color → Invert - left click to anchor

Plug all shaders (drag and drop from a shader dot to another) before the BSDF diffuse, like this:

Back to our main screen: Now go at the bottom of the 3D view, to the Viewport Shading and select "Rendered"

You should have something like this:

Ugly isn't it? Be patient:

Look at the "Scale" parameter on the first node (Voronoi Texture), and enter different values to test it. The bigger the values is, the smaller the white dots are, so the lower the value is the bigger the dots are.
These white dots will simulate basic solar spots, and the darker areas, the solar crust, so play it until your like. For myself I did set it to 100.

Now let's put colors on this, hit:

Shift + A → Color → MixRGB - left click to anchor and plug it between the Invert and Diffuse BSDF nodes like this:

Then choose a color for the spots (brighter) and the crust (darker), Here are the proposed hexadecimal values for a yellow star:

Bright Yellow : E7E287
Orange : C36615


Okay, save this if it is not already done

...to be continued. Next: The sun atmosphere and a bit compositing.

"Earth is the craddle of humanity. But we don't live in a craddle forever" Konstentin Tsiolkovski 1857-1935

Tagged:

Comments

  • edited December 2017

    Get back in "Solid" view for now, Then hit : Ctrl + Shift + Zero to center the camera on the view.
    And first of all, to make our mesh look like a bit more like a star, replace the BSDF diffuse shader by an Emission one (a forgetting from my part, sorry).

    -1 : Select the Ico Sphere then hit Shift + D to duplicate the mesh. Hit Esc to let this new mesh centered to the previous one.
    Type S to enlarge slightly. On the left side of the viewport, set the transformation vectors X, Y, and Z to 1,010, so very close to the original Ico Sphere.
    - 2 : Rename this new sphere « Yellow Sun Atmosphere ».
    - 3 : Select the material tab, disable « yellow.sun.mat » by clicking on « - »
    - 4 : Create a new one we will call, for example « yellow.sun.atm.mat ».


    Before continuing, we will improve the rendering by creating a darker background:
    Into the right panel :
    - 1 : Select the World tab
    - 2 : Color the background in black (hex=000000)

    Get back to our texture and select the material tab
    Into the viewport of the node editor :
    Shift+A → Shaders → Transparent BSDF
    +
    Shift+A → Shaders → Mix Shader
    Then connect the nodes and color the Diffuse BSDF (here : hex= FFC774), then into the Viewport Shading, switch to « Rendered »

    Still into the node editor :
    Shift+A → Input → Layer Weight
    Here, the Blend value will be set to 0,350 to distinguish the atmosphere without too much blur the texture of the star.
    And to rebalance the brightness, we add an Emission shader between the layer weight and the mix shader :
    Shift+A → Shader → Emission

    Now, click on the Compositing button and check «Use nodes »


    Hit F12 to make a rendering, then :
    Shift+A → Converter → ID Mask
    - Then re-connect from the Depth instead of Image
    - To select our star, set the index on 3 into the ID Mask :

    Then :
    Shift+A → Color → Mix
    Connect the output of the ID Mask as factor, then connect the Render Layers from the image output to both image inputs of the Mixer

    Let’s add now a glare effect :
    Shift+A → Filter → Glare
    Replace « Streaks » by « Fog Glow » then set the Treshold to zero and change the size to clearly distinguish the effect.
    Note : Be careful with this parameter, it must be kept in mind that compositing will affect the whole scene. For my part, I kept it to 8.

    To finnish, duplicate the mix node (Shift+D), then replace « Mix » by « Screen » and connect the node like this :

    Downloadable PDF Version

    Next part :
    Create a nebula as background

    "Earth is the craddle of humanity. But we don't live in a craddle forever" Konstentin Tsiolkovski 1857-1935

  • Part 2 : Create a nebula

    • 1 : Click on the Shaders button :

    • 2 : Click on World
    • 3 : Switch to the 3D view into the upper viewport.

    • 4 : Into the 3D viewport, switch to a larger view for the scene, then set the camera (Ctrl+Alt+Zero)
    • 5 : Switch to rendered mode into the 3D viewport

    Back to the node editor :
    Shift+A → Texture → Noise texture
    +
    Shift+A → Converter → Color ramp

    • 1 : Into the color ramp, select the right cursor then assign the color of your choice. Then move the left cursor to center to clearly distinguish the background
    • 2 : Into the noise texture, set the Detail value to 16, then play with the size value, in order to obtain the desired effect.

    • Duplicate the first two nodes (Shift+D), then add a mix node :
      Shift+A → Color → Mix RGB
      Change « Mix » to « Screen » and set the factor on 1
    • Assign the color of your choice
    • Review all parameters again to get the desired effect

    Let’s add now brighter areas to our nebula :
    Shift+A → Texture → Noise texture + Shift+A → Converter → Color ramp + Shift+A → Color → Mix RGB
    Switch the mix node to dodge mode and set the factor on 1. Set the parameters to your like
    Note : Regularly check that there are not too saturated areas into the 3D view

    That's it, our nebula is ready. Of course, it is possible to add other colors by duplicating parts of the above configuration, but it will increase the number of parameters to manage, and therefore, will greatly complicate the task to obtain a harmonious view.

    Part 2 - Downloadable PDF Version

    Next in part 3 : « My God ! It’s full of stars ! »

    "Earth is the craddle of humanity. But we don't live in a craddle forever" Konstentin Tsiolkovski 1857-1935

  • edited December 2017

    Part 3 : Create Star fields

    We will first group our nebula shader into one set. Indeed, afterwards, we could have trouble to manage the whole thing..

    • 1 : Into the node editor, hit N to display the tool panel
    • 2 : Shift+A → Layout → Frame
    • Adjust the size of this set according to the layout of the shader nodes
    • 3 : Select the whole nebula shader (Shift+B)
    • Left click to anchor

    • 4 : Into the tool panel, rename the frame, in our case : Nebula

    • 5 : By the way, we could add a color.

    Let’s start by disconnecting the nebula shader (we will reconnect it later). Indeed, it will be more easy to see our star fields, then :

    • Shift+A → Texture → Noise Texture
    • Shift+A → Color → Color ramp

    Some explanations of the parameters on Blender Stack Exchange :

    Noise Texture Scale. This controls the size and amount of stars. Higher scale means more, smaller stars; smaller scale means less, larger stars.
    Noise Texture Detail. This will adjust the shape and variation in brightness in the stars. Higher value will mean more irregularly shaped stars, but there will be a greater variation in the brightness of the stars.
    Color Ramp Swatches. Adjusting the color swatches on the Color Ramp will change the size and shape of the stars. The farther apart the swatches are the bigger and more irregularly shaped the stars will be.

    Source : https://blender.stackexchange.com/questions/44773/stars-background-in-cycles


    We could stop right here, after all, we have the main thing, a star background that fits. But we will add another star field we will colorize:

    Duplicate the two previous nodes (Shift+D), then add a mixer :

    • Shift+A → Color → Mix RGB
    • Change « Mix » for « Add » and set the factor on 1.
    • Choose the color into the color ramp, then set different values into the noise texture, as previously indicated, to change the amount and size :

    We will now increase the brightness of this second star field :

    • Shift+A → Color → RGB Curves
    • Shift+A → Color → Bright/Contrast

    Set the parameters again if needed

    Let’s go crazy by adding a third field
    - Duplicate the fourth previous nodes then add an additional mixer :

    Let's group this shader together :

    We will now mix our two set of nodes :
    - Shift+A → Color → Mix RGB

    Here we are, of course, this is far from being perfect and some parameters would have to be reviewed to harmonize the whole thing. It’s up to you.

    Part 3 - Downloadable PDF Version

    Next in part 4 : Create a planet

    "Earth is the craddle of humanity. But we don't live in a craddle forever" Konstentin Tsiolkovski 1857-1935

  • edited December 2017

    Part 4 : Create a planet

    We will first disable the background previously created, just to have a non-polluted rendering by the various colors used. So, unplug the nebula and stars shaders (we will reconnect later), then adopt a resolutely black background, so we will have a rendering as fair as possible about the colors for our planet.

    Then select the lamp, check "Use Nodes" and set the force to 500. This will distinguish the colors of our future planet. Of course, this setting is largely exaggerated and we will take care of the final lighting of our scene later.

    Once done, return to the 3D viewport and adopt a front view (1 on the numeric keypad).

    • 1) Center the pivot point on the 3D cursor. Everyone will do as he wants, but for me, I find it more convenient.
    • 2) Lower the sidebar in the viewport 3D tool panel until you see the cursor position. Adjust it to not generate our future mesh right in the star (here x = 8)

    • 3) Create an Ico Sphere (Shift+A → Mesh → Ico Sphere)

    • 4) Set subdivisions to 5 (and not 6 as in Part 1), then smooth

    • 5) Once generated, create a new material for our planet (here : planet.mat)

    • 6) Go to the node editor, making sure to select the appropriate buttons.

    From all the video tutorials on the subject that I could see on the Internet, the basic practice remains the same, so the use of a noise texture + color ramp(s)

    Let’s start by adding a noise texture :
    Shift+A → Texture → Noise Texture
    Then connect the factor output of this node to the displacement input of the material output node:

    Switch to the rendering mode and align the view on the mesh to distinguish the changes made.

    It is now time of carving the basic reliefs of our planet (here: terrestrial type), so for the parameters of the texture noise and for our example:

    • Scale = 6
    • Detail = 16 (maximum)
    • Distortion = 0.500

    These values are of course given as an indication, we still can change these parameters to our like, in this case, it will create an Earth type planet with oceans.

    • The higher the scale value will be, more the generated forms will be small and numerous.
    • The higher the detail value will be, the higher the level of detail will obviously be.
    • The higher the distortion value will be, more the shapes generated will be curved and elongated.

    Add now a color ramp and insert it between the noise texture and the material output :
    Shift+A → Converter → Color Ramp
    Play now with the left cursor to delineate ocean surfaces and land strips. In our example, the value will be set to 0.450 :

    Now let’s add some colors :
    Shift+A → Converter → Color Ramp
    Connect this new node from the factor output of the noise texture to the color input of the Diffuse BSDF node, then set the left cursor to 0.500 :

    Set a blue color (here hex=000E8F) instead of black, so to the left cursor :

    Bring the right cursor (white color) very close to the previous one (0.501).

    Add a third cursor with the + button that we will set this time to 0.502 with a hex value of 8E7F5B. Then a fourth one around 0.520 with an hex value of 0E4600 :

    Note: We could completely nuance colors (ocean depths, beaches, mountains, glaciers, etc.) by multiplying the previous operation. But the purpose was to keep this tutorial as simple as possible and to master the procedure. So, feel free to improve the texture of this planet according to your artistic taste or sense of realism.

    Create an atmosphere :

    • 1) Switch to solid view
    • 2) Select the planet if not already done
    • 3) Then set the cursor to the center: Shift+S → Cursor to Selected :

    • Duplicate the Ico Sphere (Shift+D), then hit « Esc » to not deviate from the center
    • Switch to the wireframe view (Z) then enlarge slightly (S) this new mesh (validate by left click or Enter) we will rename, for example, Planet Atmosphere :

    • Switch again to solid view (Z), then create a new material we will name planet.atm.mat
      Into the node editor :
    • Shift+A → Shader → Emission
    • Shift+A → Shader → Mix Shader
    • Set the colors of the Diffuse BSDF and Emission nodes (hex=C9FFFE), then set the factor of the mix shader on a very low value (here : 0.002)
      Connect the whole thing and switch to the rendered mode :

    Add 2 Transparent Shaders + 2 Mix Shaders + a Fresnel node + a Color Ramp, so :

    • Shift+A → Shader → Transparent BSDF (x2)
    • Shift+A → Shader → Mix Shader (x2)
    • Shift+A → Input → Fresnel
    • Shift+A → Converter → Color Ramp

    • Set the 2nd mix shader to 0.415, then invert both white and black cursors.

    • Set the left cursor (white) on 0.045 and the right cursor (black) to 0.120. Add a 3rd cursor, white this time (hex=FFFFFF) with the + button and set it to 0.250
    • Change Linear to B-spline :

    Before moving on, some explanations:

    Fresnel?
    https://en.wikipedia.org/wiki/Augustin-Jean_Fresnel
    IOR?
    Means: Index Of Refraction
    https://en.wikipedia.org/wiki/Refractive_index
    A list of these indexes:
    https://pixelandpoly.com/ior.html

    Personally, I left the default value.

    Create clouds :

    Repeat the creation operations of new mesh and new material described into the previous paragraph for the clouds :

    Then into the node editor :

    • Shift+A → Texture → Noise Texture

      • Scale = 4.5
      • Details = 16
      • Distortion = 0
    • Shift+A → Converter → Color Ramp

      • Left cursor = 0.470
      • Right cursor = 0.785
    • Shift+A → Shader → Transparent BSDF

    • Shift+A → Converter → Math
      Instead of « Add », set it to « Multiply »
    • Value = 3
    • Shift+A → Converter → Math
      Instead of « Add », set it to « Multiply »
    • Value = 2
      Then connect like this :

    Here we are !

    Part 4 - Downloadable PDF Version

    Next and last part: Lighting and animation

    "Earth is the craddle of humanity. But we don't live in a craddle forever" Konstentin Tsiolkovski 1857-1935

Sign In or Register to comment.