This is a basic tutorial on Texture Mapping, made with Blender version 4.3, in which we’ll see how to map a gradient Texture along one of an object’s axes. Specifically, we’ll map the gradient along the Z axis, that is, along the height of an object.
Video Transcript
Hello everyone! This is a basic tutorial on Texture Mapping, made with Blender version 4.3, in which we’ll see how to map a gradient Texture along one of an object’s axes. Specifically, we’ll map the gradient along the Z axis, that is, along the height of an object.

This type of mapping can be useful either to directly apply a gradient Texture to objects or to use the gradient as a Factor for blending different colors, Textures, or even Shaders. This way, you can make certain Textures appear or change the Shader starting from a specific height.

Mapping a gradient along an object’s Z axis isn’t a complicated operation in itself. All you need is a Texture Coordinate node, a Separate XYZ node, and a Color Ramp node.
The Generated output from the Texture Coordinate node should be connected to the Vector input of the Separate XYZ node. This output gives values between 0 and 1 in the three dimensions, based on the object’s original Bounding Box, not the deformed shape. This means that the Z coordinate will range from 0 to 1 from the lowest to the highest point of the object’s Bounding Box.
The Separate XYZ node allows us to extract the Z values, or in other words, the height of the object, which we can then send into a Color Ramp node to map a color from height 0 to height 1 of the object’s Bounding Box.
The Color output of the Color Ramp node can then be connected to the Base Color of a Shader. And of course, inside the Color Ramp, you can freely adjust the position, colors, and interpolation type of the markers to modify the gradient as you wish.

The Color Ramp, especially if set to grayscale, can also be used as a Mixing Factor to blend colors or Shaders.

As mentioned earlier, the mapping is based on the object’s Bounding Box, but you can also create a mapping based on the global Z values of the scene by using an external object to generate the Texture coordinates.

To do this, simply add an Empty at the center of the scene and use that object as the Object input in the Material’s Texture Coordinate node. In this case, the Separate XYZ node should be connected to the Object output, no longer to the Generated output.



Now, the Z axis mapping coordinates will refer to those of the Empty, so you’ll be able to scale the Empty along the Z axis to change the gradient’s range globally, for all objects using that Material.
You can also move the Empty upward in the scene to set a new starting height for the gradient.

Alright, that’s it for this short tutorial! Unlike most of my video tutorials, the PDF version of this one is currently not available for download. However, you’ll find a link in the description to a page containing the PDF versions of many of my other video tutorials. In any case, this is a great time to subscribe to the channel and turn on notifications! See you soon!