In this article we will take a look at what displacement is and how to use it in Blender. Since Blender 2.8 we have two methods of adding displacement, and we will cover them here.
How to use displacement in Blender? Select your object, add a displacement modifier. Press new and go to the texture tab. Here we select the kind of texture we want. For image textures browse for your texture then go back to the modifier stack and adjust the midlevel and strength.
We will dive deeper into displacement and look at this method in more detail as well as the second method we can use through the shader in Cycles.
Displacement is a way to add extra detail to an object by changing the position of the vertices in an object. There are primarily two ways we can do this. Traditional displacement and vector displacement.
We call the more traditional way just displacement. This is when we use a black and white image texture or procedural texture to change the position of the vertices up and down depending on the gray scale value in the texture.
A lighter value will move a vertex further up from the original position while a darker value will move the vertex less. In this way we can create real geometry changes with a texture and gain high level detail.
The second method is vector displacement. We will not cover it in detail in this article but the difference is that we use a color texture instead of a black and white texture.
Then we map the Red, Green and Blue channels to each of the axis in the 3D world. This way we can move any vertex in any direction instead of just up and down as is the case with traditional displacement.
The most common scenario where we use displacement is to give a surface a kind of mid level detail that would be too time-consuming to sculpt or model.
But displacement also requires a lot of geometry to be able to displace enough to create the detail. Therefore, if the detail we want to create is too small we may be better of using a normal map instead.
Displacement can also change the silhouette of an object and if that is our objective a normal map is not enough.
So you can see that a displacement texture lives somewhere in the mid level detail area and can be a good option if we want detail in the silhouette.
Since displacement needs a lot of geometry it is also heavy on performance. Therefore, you don't see displacement maps used as often for real-time applications or games.
In Blender, we have two different ways we can use displacement. The first one is through the displacement modifier.
If you are unfamiliar with modifiers I can recommend this article where I am explaining the basics.
Related content: How modifiers work in Blender, an overview
This is the traditional way of using displacement in Blender. It works with both Cycles and Eevee.
It is a bit limited in some regards while still flexible in other ways.
The benefit of using this method is that we displace beforehand as part of the modifier stack. This means that we can see the result in all view modes in the 3D viewport. We can also apply the modifier to have the displacement permanently committed to geometry.
We can also mask our object using weight paint and a vertex group to control where the displacement is applied on the object as well as the strength.
This is probably the easier method to use since it is more straight forward, and we get feedback in the viewport without having to render.
The second method is to use the displacement socket in the shader applied to the object. This only works in Cycles and since the displacement is calculated at render time we can only see the displacement in rendered viewport mode.
We are also unable to commit the displaced geometry to the object and, for example, export the displaced mesh.
However, we have a huge benefit with this method. We have access to all the nodes in the node editor to modify, combine and mask our displacement and essentially create the exact displacement we want.
Personally I most often use the second method thanks to the flexibility of the node editor but if I am using Eevee or if I am creating something where I don't need the extra flexibility the modifier route is also a good choice. They are just different options.
With the object we want to add displacement to selected we go to the modifier tab in the properties panel.
In the drop-down menu we select "displacement".
Keep in mind that as we work with the displacement modifer the object may take on very odd shapes, like being heavily inflated or become much larger or smaller. This is quite normal and the shape will adjust as we input the correct parameters and textures.
In the modifier we have a handful of settings. First we have the texture itself that we should add. Press new and then the icon with the two bars to the right.
This will take us to the texture tab. The texture tab is where we handle textures that have specific purposes. This can be brush textures, particle system textures and in this case, displacement textures.
From the "type" drop-down menu we can select one of multiple procedural textures. Each one of them has its own settings so if you want to go with a procedural texture you will have to experiment with the texture settings for that specific texture.
We can also choose "Image or move" if we have an image we want to use. This is the case most of the time.
In the image section find the settings subsection and press open and browse for the image you want to use for displacement.
Press the wrench tab again to go back to the modifier.
The mid level decides where the 0 point is of the object. Sometimes the size of the object can change quite drastically when using displacement. With this slider we can adjust the object back to the size we want.
The strength simply decides how intensive the displacement will be. In many cases we need to decrease this value. Sometimes significantly, like to a value of 0.05. Don't be afraid to try both very low or high numbers.
Sometimes we want to have the displacement added to just a certain portion of an object. In these cases we can use a vertex group. You can select one in the "vertex group" setting. The double arrow will invert the influence of the vertex group.
We can add a vertex group in the object data tab in the properties panel. This is the green upside down triangle icon.
Press the plus in the vertex group section to add a vertex group. Then switch the 3D viewport from object mode to weight paint mode. You can do this either with the object interaction mode menu or with Ctrl+Tab and choose weight paint.
You can find the settings for painting in the active tool tab in the properties panel.
Red represent full strength and blue is zero strength.
Once you are done painting you can select the vertex group in the displacement modifier settings and the areas you painted red will have full influence of the modifiers while the blue parts will be left without displacement.
The most common error with the displacement modifier is that we do not have enough geometry to support the displacement.
In many cases this can be solved by adding a subdivision surface modifier just above the displacement modifier in the modifier stack. Increase the level of subdivisions until you get the level you want.
Keep in mind that for every level you add you also add four times as much geometry from the previous level. This can quickly turn into an unusable viewport if we go overboard.
Another common error is that added the displacement image to the wrong texture. In the texture tab where we do all of our texture settings. Check at the very top and make sure that the correct texture is selected in the dropdown before you make changes to the texture settings.
I have lost count of the number of times I have accidentally changed a brush texture instead of the displacement texture that I originally intended to change.
The last common error we will cover is banding. Banding looks like this.
It appears as very distinct changes between different height levels. In this case the texture is 8k, very high resolution, still we get this issue. This is because the texture is also in 8 bits. This is common for most images and usually works fine. But for displacement there is too little information to have smooth transitions between the different heights.
If we come across this issue we need to use a 16bit texture for displacement in this case.
I have experienced many scenarios though where an 8 bit displacement map worked just fine, but if you see this and it is an issue, you need to use a 16 bit texture instead. Usually 16 bit displacement maps comes as TIF or EXR files instead of JPEG or PNG.
The shader displacement works a bit differently. Instead of using the modifier we use the displacement slot in the shader. However, this is limited to Cycles only for now.
The displacement socket in the material output node is configured to use bump mapping instead of displacement by default. We first need to change this.
In the properties panel, go to the shader tab and find the settings section. Here you will find a "surface" subsection with a dropdown setting called "displacement". Change this from "bump only" to "displacement only" or "displacement and bump" if you want to combine both effects.
Personally I always use "displacement only" and use the normal map for finer details.
If you can't see these settings, make sure that you are in Cycles render engine in the render tab.
Once we changed this setting we can go to the shading workspace. Also make sure that you go to rendered preview mode in the top right corner of the 3D viewport so that we can see the effect the displacement has.
In the node editor, we need a displacement node that we can find in the vector category in the add menu.
We also need either a displacement image texture or one of the procedural textures. Plug your texture into the height input of the displacement node and plug the displacement node to the material displacement output.
This is a minimal setup. But the good thing about the shader workflow is that we can combine multiple textures and if we need a manually painted mask we can use vertex paint to paint a back and white mask as opposed to a vertex group.
An easy way to control the strength and midlevel of a texture is to add two math nodes after the image texture. Set the first one to multiply and the second one to add.
Set the bottom value of the multiply node to 1 and the bottom value of the add node to 0 to nullify their effect then increase or decrease from there. The multiply node will be like a strength value or scale value while the add will act as an offset.
We looked at two different ways of using displacement in Blender 2.8 and later. Both methods are available in Earlier versions of Blender but displacement through the shader has been an experimental feature for quite some time.
In 2.8 this feature became part of the standard feature set.
If you think this content is useful please share with your friends. It means a lot to me.
Thanks for your time.