Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In this movie, I'm going to talk about some common problems that you may encounter when applying displacement maps that have been created in other programs. For example, I'd like to apply a displacement map that I created in ZBrush to this character that I'm rendering here in Maya. So, let's take a look at first how we can do this. Here's is a character right now with his skin shading network almost complete. I've got a subsurface scattering going, add a little bit of an ambient inclusion, I have a normal map applied, but to really make the details pop out and look more realistic, I'm going to add a displacement map to the surface.
So, the first thing I'm going to do is I'm going to select the surface and I'm going to create what's known as an Approximation node. So I'm going to go to Windows > Rendering > Editors > mental ray > Approximation Editor. And what this does is the approximation node actually subdivides the surface at render time allowing for more detail that can be used for displacements, so when the displacement texture is applied to the surface, so that at render time the surface is subdivided allowing for more detail to come through from the displacement texture.
So to create the node, I'll go to the mental ray Approximation Editor and under Subdivision I'm going to press the Create button. As long as I have the surface selected here in the scene, it's going to automatically apply this node to the surface, so I'll just choose Create and then it creates the node and it opens up in the Attribute Editor. There are several methods for creating a subdivision approximation. I'll just leave it at Parametric because that usually works pretty well for me and I am going to leave N Subdivisions at 2. What this setting basically determines is how many times a surface is going to be subdivided during the rendering process.
So I actually start with a value 2, and then if I need more, I can adjust it upwards. So now that has been applied, the next thing I need to do is hook up the displacement texture to my shading network. So I'll select the surface and open up the skinShader and what I need to do is I need to get to the shading group node above the skinShader, so I am going to Hypershade, right-click over the skinShader, and choose graph network. Let's take a look at the work area, so I am going to zoom in here and I'll select the skinShader and choose Graph, Input and Output Connections, and now I can see there is the shading group node right there.
So, I'm going to click on the checkerboard icon next to Displacement material in the misss_fast_skin_maya_2SG node. Actually what I might do is rename that real quick. Let's call this skinShaderSG. There we go. Now I'm going to click on the checkerboard icon next to Displacement. I'll choose File. I don't need to do anything here. I'll go to the file node and I'm going to click on the folder next to Image Name, and I'm going to use the madHatter1-DM.tif. This is a file that was created in ZBrush, where I also created the character. So I'll choose Open and this applies it.
I'm going to turn the Filtering to off, and since displacement maps take a while to render, let's just select a region and render just part of the image. Okay, this looks pretty good. Let's render the whole image. There we go. It looks pretty good. What happens when things go wrong? Let's take a look at a few things that might go wrong with that displacement textures. Now for one thing, if you don't have Alpha Is Luminance checked, this can sometimes cause problem, so I'm going to deselect Alpha Is Luminance and render a region again.
So you can see now what we have is something that looks like from a medical oddities textbook, so definitely a problem, and this is something that you can frequently encounter when you're rendering with displacement maps especially if they have been created in other programs. Now if Alpha Is Luminance is off, then it doesn't know how to interpret the alpha values to create the amount of displacements. You want to make sure that Alpha Is Luminance is turned on. Another common problem can be the settings with the Alpha Gain and the Alpha Offset.
In this case a value of 1 and a value of 0 works just fine. But depending on how the displacement map is made some programs interpret the light and dark values of displacement textures differently from Maya. ZBrush has been updated so that a value of 1 and a value of 0 usually work fine, but if you're using an older version of ZBrush, you might also encounter a similar type of bloating when you render even when Alpha Is Luminance is turned on. So in this case, what you want to do is set the Alpha Offset to minus one-half of the Alpha Gain, so this would be - 0.5 and this would be a value of 5.
In this case, it's working just fine, so I don't need to adjust those. So that's another frequent problem that you have. You might want to check how your program interprets displacement values. The way Maya works is that a value of black, in other words a zero value, means no displacement. A positive values means displacement outward, so lighter values means displacement outwards and negative values mean displacement inwards. Some programs create displacement maps where a value of gray is no displacement, values lighter than gray displays outwards, and values darker than gray displays inwards.
So in this situation if you're using a displacement map created in a program such as this and this is how ZBrush used to interpret displacement maps, you'd have to adjust the Alpha Offset so it's minus one-half of the Alpha Gain. Therefore I'm putting adjusting the values so that they go into the negative range. The other thing you need to look out for is a displacement map is affected by scale. So in other words, if this is a character that I needed to scale later on for some reason, like let's say it decided to grow really large in scene or I needed to adjust to scale to fit him into another scene, you'll need to adjust the Alpha Gain.
An easy way to do that is to set the Alpha Gain equal to the scale X of the object. So in other words the object itself is called oldMan. This is the name of the character in this version of the scene. So what I would need to do is go into the file texture used for the displacement, this texture right here, and one way you could do this is I could type in =oldMan.scaleX;.
And you can see this turns purple, meaning there is an expression. So that means that if I start to scale the oldMan up or down, the displacement texture automatically updates. So now that the oldMan is scaled up to 1.77 in X. The Alpha Gain is adjusted as well. So that's something that you need to be aware of. And then finally if you've find that your displacement map is lacking the detail that you think it should have, you can adjust the number of subdivisions, so I can pump this up to 3 and do another render. This will add to render time so you have to be careful, and if you make the value too high it can also cause mental ray to crash, so be careful when you start to crank that up.
And there's the final textured and displaced character and it looks pretty good. I frequently get this warning here that says Failed to open texture file displacement map.tif. I believe this is mental ray. It does not like the TIF format, so you get this warning because it's having a hard time creating a little preview icon for the displacement map. However, you know if I get this warning, usually displacement works just fine, especially if you remember to go into Settings/Preferences and under the Rendering menu activate Use optimized textures.
If you turn this on then displacement map should work just fine, even if you do get that warning. There you have it, a nice textured looking character, and he probably could go for some animation at this point.
Get unlimited access to all courses for just $25/month.Become a member
107 Video lessons · 31739 Viewers
90 Video lessons · 21986 Viewers
78 Video lessons · 8084 Viewers
83 Video lessons · 7764 Viewers