Navigating nodes with a test material
Before designing good materials, we need to get comfy with the basic syntax of how nodes work on an exploratory play material that will eventually turn into wood. Open up Ch06_nodes_start.blend. This file contains an array of dragon models that we can use to view our materials side by side. It also comes with an interface set up to view our materials: a sun object for casting shadows, Viewport shading set to Material Preview mode, and the default shading interface. The Material Preview mode has placeholder settings for reflections, making it ideal for doing material studies without needing all of the scene's lighting in place. As you work, compare your results to Ch06_nodes.blend, which has the completed materials. The Properties panel has a tab for material settings and a tab for texture settings, but the real power in creating materials comes from nodes in the Shader editor.
We will spend 99% of our time in the Shader editor when making materials, so let's have a look at it now and learn about the nodes:
- Select the first dragon in the 3D Viewport.
- Look in the Shader editor to see its material nodes.
There are just two nodes: a Principled BSDF (input) and a Material Output, which can be seen in the following screenshot:
Nodes will generally read from left to right; the input nodes work together and develop into the final output node on the right. Many of the hotkeys from the 3D Viewport are also used in Blender's node interface, with individual nodes functioning like vertices, noodles (the lines connecting inputs and outputs) functioning like edges, node groups functioning like objects full of other data, and so forth. Let's try out some of our familiar hotkeys:
- Select the Principled BSDF node inside the Shader editor.
- Move it with G.
- Pan around the nodes with the middle mouse button.
- Zoom into the nodes with Shift + the middle mouse button.
The noodle connecting the Principled BSDF to Material Output can be connected or disconnected in multiple ways:
- Click and drag on the green dot of the Material Output's Surface output to disconnect it.
- Reconnect it by clicking and dragging the BSDF output back to the Surface output.
- Disconnect it again by slicing the noodle with Ctrl + right-click, and then clicking and dragging across it.
- Reconnect them by selecting both nodes and hitting F to make links. This is how we'll generally connect our nodes.
To supercharge our node workflow, we need to enable the Node Wrangler add-on:
- Go to Edit | Preferences.
- Go to the Add-Ons tab.
- Search node to quickly find the add-on, as seen here:
- Click the checkbox next to the Node Wrangler add-on to enable it.
- Click Show Hotkey List, and you'll find a massive amount of additional hotkeys to speed up your node interface.
The Node Wrangler is a fan favorite among Blender users who spend a lot of time working with materials, and you'll come to love many of the hotkeys that it provides. Now, let's try hooking up a texture to our Principled BSDF node with a Node Wrangler hotkey:
- Add a Wave node with Shift + A | Texture | Wave.
- Press Alt + right-click and drag from the Wave Texture node to the Principled BSDF node.
Thanks to Node Wrangler, the connection is highlighted in red, as seen in the following screenshot, and then it automatically connects the wave to the BSDF's assumed default input, which is Base Color. You can also specify the inputs and outputs when connecting nodes with Alt + Shift + right-click. This quick connection is shown here:
Another powerful Node Wrangler hotkey that comes in handy all of the time lets us create a "viewer" node that allows us to preview the node's output. Let's try this now:
Press Ctrl + Shift + left-click on Wave Texture. With Node Wrangler, the node is now hooked up to a Viewer node.
As we can see in the following screenshot, the Wave Texture output can be viewed on the dragon thanks to the Viewer node:
When we're ready to hook the Principled BSDF node back up to the material output node, we can use the same Node Wrangler hotkey but this time, we click on the Principled BSDF node:
Press Ctrl + Shift + left-click on the Principled BSDF node.
Now, let's add some color to that wave! We can add color with a ColorRamp node:
- Press Shift + A to open the add menu.
- Choose Convertor | Color Ramp.
- Connect the Wave output to the ColorRamp Factor input.
- Connect the ColorRamp Color output to the base color of the Principled BSDF node.
ColorRamp remaps the input to colors, distributed by stops along a ramp. We can adjust the colors by editing these stops:
- Click on a stop, then move it around to change its position. New stops can be added by pressing Ctrl + clicking on the ramp, and their color modified by clicking the swatch at the bottom of the node. Give it three stops with varying colors.
- Add a Texture Coordinate setup to your Wave node by selecting it, and then pressing Shift + T. This Node Wrangler shortcut adds a Texture Coordinate node and Mapping node quicker than the Add menu. Change the values in the Mapping node around to see the color move around on the dragon.
If you've been following along, your node setup should look like this:
Now, let's try mixing it up a bit with some more nodes:
- Box select the Mapping, Wave Texture, and ColorRamp nodes, and then duplicate them while maintaining connections by pressing Ctrl + Shift + D. Type in new mapping coordinates and check the results with Viewer Node. Next, select the ColorRamp, then change its node type by pressing Shift + S, and choosing Color | Hue Saturation Value. Connect the Wave Texture Color output to Hue, and change the HSV node's color to red. The red's hue now shifts based on the black and white waves.
- The ColorRamp and Hue Saturation Value nodes can be combined with a MixRGB node, found in Add | Color | MixRGB. Node Wrangler also lets you auto-mix nodes; press Ctrl + Shift + right-click and drag from the ColorRamp to the HSV node, and they're automatically hooked into the two color inputs. The factor adjusts how much Color2 influences Color1. The MixRGB blend mode can be changed to other options such as Multiply, which darkens Color1 based on Color2, or Hue, which replaces Color1's hue with that of Color2. Scroll through all of the blend modes by hovering your cursor over the dropdown and pressing Ctrl + middle mouse button scrolling, and then setting it back at Mix.
- Connect your first Wave Texture to the MixRGB's factor. Using a texture as a factor masks the effect of the Mix node, interpreting black as 0 and white as 1.
- Create a Math node with Add | Vector | Math. Drag and drop it onto the noodle connecting the Wave Texture to the Mix node's factor, and a connection is automatically established. Change the operation to Less Than. Adjusting the second value now determines where the Wave is clipped into black and white.
- Math nodes are often faster than MixRGB, and perform the same functions, such as Multiply. Node Wrangler offers some hotkeys, such as Ctrl, Shift, +, -, *, and /, which hooks two selected nodes into a Math node with that operation.
As you can see in the following screenshot, node trees get complicated really quickly, but they let us create some very interesting materials:
This interface of connecting inputs and outputs is how we'll continue building materials throughout this chapter. Although you can get by without Node Wrangler, it adds tons of functionality to an interface that, when noodling, you'll spend hours inside. Hold on to this play material; later, we'll make some more adjustments to turn it into wood.
The end goal of creating these node trees is, of course, to make our materials fit our needs. However, you'll frequently need to understand why a node works the way it does. Use these kinds of play materials often to teach yourself how inputs, nodes, and textures work.
Any time we work with a node tree, the final node before the Material Output node is called a shader node. The shader node determines what the surface of the material will render like in the final result. The most versatile shader node is called the Principled BSDF. Up next, we will take a closer look at how this node works to replicate real-life materials.