In this tutorial, we’ll be talking about Blender’s, in my opinion, one of the most useful nodes: the gradient texture node. By combining gradient and noise texture nodes together, it is possible to create different-looking surfaces even when you use the same textures on two different meshes! Without further ado, let’s get started and let me demonstrate what I mean!
Notes:
You can get access to the “Gradient Texture” node by: Shift + A > Texture > Gradient Texture (In Shader Editor).
As you can see in the screenshot above, I’ve set up a very basic scene that includes a plane, the default cube, and a sunlight. On the left side of the screen, we can see my basic shader setup. The “Background” and “World Output” nodes have been prepared for us by Blender automatically. I just added a “Gradient Texture” node into the editor. It’s not plugged into anything yet.
One thing to pay attention to is, I’ll be using the gradient texture node to change my sky color. To be able to do so, I switched to “World” shader type. Shader types can be accessed from the menu located at the top left corner of the screen. By default, it should be set to “Object” shader type. Keep in mind that though we can use this node for both sky and mesh colors, which I’ll also be demonstrating at the end of the tutorial.
I’m plugging my “Gradient Texture” node’s output pin to the “Background” node’s (which is the node that controls the sky color in Blender) input pin.
Gradient texture node’s output pin goes to the background node’s input pin.
While the gradient texture node is selected, we can press CTRL + T to summon a “Texture Coordinate” and a “Mapping” node.
Your advertisement can be placed here for $200 permanently. Suggested resolutions: 1800x663 or 1400x1400. Contact us.
Note: This shortcut is provided via a plugin called “Node Wrangler”. It comes with Blender by default but you might need to activate it by going to: Edit > Preferences > Add-ons > Node: Node Wrangler
The next step will be adding a “Color Ramp” node to the mixture. This is how we will tell Blender which colors we want to use in our scene. This node is perfect for adding multiple colors/creating gradients for our meshes.
By default, black and white colors are provided alongside it. By clicking on the little arrows inside of the rectangle (This rectangle should appear in black and white by default.) in the “Color Ramp” node, we can change the color values. Or by clicking the plus or minus buttons, we can add more colors or remove undesired ones easily.
Selecting different colors for my sky in the ColorRamp node.
“Texture Coordinate” node tells our “Mapping” node about, hence the name gives it away, texture coordination. I’ll be using the “Generated” option here since the sky coordinates are generated by Blender automatically. If you UV unwrapped your mesh and not editing your sky’s color, you can switch to UV method. More information on how “Texture Coordinate” node works can be found here, in Blender’s official documentation.
“Mapping” node lets us manipulate the location, rotation and scale of our textures. As you can see, the information given by “Texture Coordinate” node to “Mapping” node can be manipulated in X, Y and Z direction. Since I am trying to control my sky color, I want to limit the color direction to Z axis only. This step is completely optional but I wanted to share that you can do such thing in Blender very easily as well.
I’m bringing in a “Separate XYZ” node to lock the direction info to Z axis only. In other words, my sky color will be only adjustable in Z (vertical — bottom to top/top to bottom) direction.
Final Basic Setup
This is actually it. We can stop here or… We can try to have more control over our shader setup. Well, the issue with this setup is, it controls both our sky color and the scene lighting.
What if we want to give our sky a different and our scene light another color?
We can copy and paste (Shift + D) our node setup and connect these new two setups into a “MixRGB” node. What “MixRGB” or in other words “Mix” node does is combining two images or color together by averaging the two.
My Final Setup (So Far)
And this is how my scene looks in the moment:
My Scene (Reference)
If “MixRGB” node blends two colors/images together, how come it is useful in this case? Well, right now the blending factor is set to 0.5. By letting Blender to set this value for us depending on where the rays come from, we can separate our colors into two different categories. I am oversimplying the explanation for the sake of keeping the post short but I highly recommend reading this post by Blender Foundation to have a better grasp of it.
How do we make Blender calculate the light paths in the material editor? As you can see in the screenshot above, I already placed a node called “Light Path”. This node can be found by following this method: Shift + A > search for (Light Path) or Shift + A > Input > Light Path
I’ll take the “Is Camera Ray” condition pin and plug it into my “MixRGB” node’s factor pin so Blender can make the calculations we mentioned above.
Placing a camera to the scene and adjusting my colors values for my taste.
The node setup that is above controls the scene color, and the one below controls the sky color.
My Node Setup So Far (Reference)
Additional Tip (Optional Read): You can label/re-label your nodes by pressing N and finding the input area labeled as “Label”. Underneath this “Node” category, you’ll see a feature called “Color.” By using this feature, you can also re-color your nodes to make everything organized and clean.
If you’d like to, you could change your nodes’ blending options to test out different outcomes:
ColorRamp: Ease — Constant)
Gradient Texture: Quadratic Sphere
This is how my setup is looking so far:
My Setup So Far (Reference)
If you’re applying your gradient to a mesh or, it actually does not matter whether you apply it to a mesh or sky, we can get rid of “Separate XYZ” node if we want to be able to move our colors in any direction we want.
Removing “Separate XYZ” node and changing the “Mapping” values.
We can even go a step further and and bring in a “Noise Texture” node to make things interesting.
Bringing in a “Noise Texture” node.
Blending “Gradient Texture” and “Noise Texture” nodes together with the help of “MixRGB” node.
A closer look at the setup.
Tweaking “Noise Texture” node’s values to get different results.
Usages of “Gradient Texture” node are not limited to only “Base Color” input. By connecting it to for example; metal or roughness input, we can manipulate these values as well.
Black color represents glossines while white color representing roughness.
We can do the same thing that we did above and combine it with a “Noise Texture” node:
This is how my cube looks like from different angles:
I think this method is one of the most handy ways of using the “Gradient Texture” node. I’m giving a material to my plane and importing some textures.
A basic texture setup.
I am importing my AO texture and blending it with my base color texture with the help of “MixRGB” node. Setting the blend mode to overlay. The regular texture setup continues so far. Then I bring in a “Gradient Texture” node, connect it to “Color Ramp”, and my “ColorRamp” node to another “MixRGB” node. This “MixRGB” node’s pins should be occupied by our default texture’s base color which is grass in my case and the other slot should be occupied by the base color texture of whatever you want (Snow, in my case) to mix your original material with. Make sure of that your “ColorRamp” node’s “Color” input is plugged into “MixRGB” node’s “Factor” pin so we can control the blending intensity through our “ColorRamp” node.
This is how my setup and scene look. The “ColorRamp” node allows us to control the blending values.
Upclose version of the same setup.
You can keep your original texture’s (grass, in my case) and additional texture’s (snow, in my case) mapping info plugged into the same “Mapping” node. However, if you wish to control these textures’ rotation, scale, etc separately, you can divide them into two different setups as well:
My grass and snow textures can be controlled by different “Mapping” nodes.
Final Setup (Reference)
You can stop reading at this point because I won’t be telling you guys anything new but if you want to be able to blend your textures in a more detailed way, you can always add another “Noise Texture” and “MixRGB” nodes into the mixture.
Combining “Gradient” and “Noise” nodes to achieve a more detailed blending.
Different values give us different appearances:
If we wish, we could even throw another “ColorRamp” node in there and tweak our blending values even further:
“ColorRamp” node in action.
My Final Setup. (Reference)
That’s it. This time for real. I hope this tutorial cleared everything up about how one can use “Gradient Texture” node in Blender. If you think I missed a step or didn’t explain something enough, please let me know. I can always update this tutorial.