Curvature Based Edge Wear
By Neil Blevins
Created On: Mar 15th 2008
Updated On: Jan 24th 2016

Go here to read this tutorial in Russian.

The edges of a hard surface frequently get bumped, scraped and otherwise beat up. This creates wear and tear, paint tends to flake off, metal tends to wear down to it's lower layers. Here's a paint example, notice how the edges of the paint worn off, exposing the metal underneath...

This is a nice detail to add realism to your textures. Basically, you create a paint material, you create a metal material, and then you hand paint a mask to blend between the two, exposing the metal around the edges of your object. But what if you have over 5000 objects in your scene? Painting masks by hand is slow and cumbersome, it's cool for 3 or 4 objects, but not for thousands. So this tutorial discusses the methods for producing details like these procedurally.

What Is A Curvature Map, And How Do I Apply Wear To It

A curvature map is a map that changes color based on the curvature of the surface. So if an area is concave (a valley), it will receive one color, if the area ia flat (the plains) is gets a second color, and if an area is convex (the tip of a mountain), it gets a third color.

You can use this map to select areas of your mesh where chipped paint and wear would occur naturally. Set the convex and concave areas to black, and flat to white.

Now you want your damage to look random and messy, so you modify the curvature with a noise.

Then you use this as a mask to blend between a metal material and a paint material. Black areas will reveal the metal, white areas will reveal the paint.

There are many different ways to make Curvature Based Edge Wear...

Max 2017.1 Data Channel Modifier

So Max 2017.1 adds a new modifier called the Data Channel. Using it, you can output Curvature to a map, blend noise into the map, and use that as your mask.

Here's a video showing the process...

This technique IMO is the best technique to use

• Your curvature can use Opensubdiv creases, or any other subdiv technique, since you can place the Data Channel on top of the modifier stack
• You can export the Curvature in all sorts of ways, to a map channel, to a vertex color map, etc
• Its not a map only, so if you apply the material to a new object, you also have to copy the modifier to the new object
• Requires max 2017.1
Vertex Map

Another technique is to bake your curvature to a vertex map. In 3dsmax, you can select any vertex and assign that vertex a color (most major 3d apps have similar functions). The resulting colors of all your vertexes are referred to as a vertex map. This can be really useful, because it lets you paint a map directly in the max viewport. The only issue is that since each vertex only has 1 color, you need a lot of vertexes to get small detail. Lets start with 2 cubes...

Notice the geometry I'm using. The first cube has 10 segments going in each direction. The second cube has extra edges very near the corners and a meshsmooth applied. To paint the worn areas by hand using vertex colors, we'd need maybe 4 or 5 times the amount of geometry we see here, which is way too much geometry to be practical. So instead, our technique is to produce lower res vertex paint, and then add the smaller details by warping the low res vertex paint with noise.

Now, we can manually pick the vertex colors, but again, for a huge number of objects, manually assigning colors is slow, so lets automate the process. Go to the Soulburn Scripts Page and download the latest script pack. It contains a script called curvatureMaker. NOTE for MAYA users: Chris Granados has been nice enough to write a version of this script for Maya using Python. Visit Chris' blog for more info.

Now back to max, when set to cornerEdgeToVertexMap mode, the curvatureMaker script selects all the corner edges, and then converts them to a Vertex Map. After running the script with it's default settings, this is the result we get...

Notice the way the vertex colors blend between each other. In the first cube, the edge is black, the vertexes closer to the center are white, so you get a smooth gradient between black and white. The same with the second cube, except the meshsmooth modifier is blending the vertex colors even further.

So now we have the corners baked into a vertex map, but they don't look much like wear and tear, do they. To do this, we'll distort the vertex map using the Warp Texture plugin (Please note, this map is not compatible with mentalray, although if you are using mentalray, there appears to be a similar plugin available here). Warp Texture was written by John Burnett, and what it does is takes any map and distorts it using another map. In this case, we place a Vertex Map map in slot1 of the Warp Texture (which accesses the vertex colors we baked into our mesh), and in slot 2 we place Noise. Also, while not always necessary, it may be good to check the "Clamp" checkbox in the Output rollout of the Warp Texture, to ensure the result is between a value of 0 and 1.

And here's the rendered result.

It's getting there, but the noise is too undefined, and doesn't hug the corners as much as we'd like. To do this, we need to clamp both the noise and the vertex map.

Open the Warp Texture map and click on the Vertex map. Now click on the map type button on the upper right (which currently says Vertex). In the maps list choose Output and choose "Keep old map as submaterial". Then adjust the output curve to look something like this...

Then go to the output curve of the noise and do something like this...

Now we render, much better

Note, for the purpose of this tutorial, I adjusted the noise and output map values on each cube to get a slightly different visual effect. But in practice, you'll generally want to use a single material applied to all your objects, since adjusting the maps for each object will take too long.

If you're using mentalray, or just don't want to use a 3rd party plugin, there is another way to distort your Vertex Map with Noise. Its identical to the technique I describe in my Occlusion Rust tutorial. Place a fractal noise in the first slot of a mix map, make the second slot white, and then in the mix slot place your Vertex Map. Then clamp the curve inside your mix map in the output area. It gets you almost identical results to the Warp Texture method.

Now lets use this mask to blend between two materials. Create a Blend material, make the first material look like paint, and make the other metal (for the example file, I'm making very simple materials, replace with something much nicer from your own material library). In the mask slot of the Blend material, place your Warp Texture (or mix map, if you used the second warping technique). Here's the rendered results...

A few disadvantages of the vertex color technique...
• Since this technique is so geometry based, if you need to edit your geometry, it will greatly affect the look of your shading effect. So if you expect a lot of geometry edits after you've run the curvatureMaker script, be aware that you may have to remake the vertex maps. And you may need to add some extra geometry beforehand to make sure you have enough geometry to get the results you want from the curvatureMaker script.
• As mentioned before, WarpTexture doesn't work with mentalray if that's the renderer you intend to use. In which case, use the clamped mix technique instead of the warp texture technique.
• Also, due to a limitation in the Vertex Color map, you cannot use this technique to do bump maps in standard max, only diffuse maps or displacement maps. If you really need a bump map, see the tutorial Texture Baking: Baking Patterns To Use In An Incompatible Render and use this workflow to bake your vertex map into a series of bitmaps that can be used as a bump map. Or, if you have vray, you can use vray's VrayColor2Bump to convert the warp texture into a bump...

Here's a video showing me using a vertex wear map on a robot tread...

CurveMap

Another way to produce similar results is using BoomerLab's Curvemap. Rather than baking the curvature into a vertex map, or getting the curvature in a modifier, this produces the curvature at rendertime as a map. Here's the interface...

As you can see, it will do black at concave and convex edges, flat areas are white. I turn up Gain and KFactor to get nice sharp edges. Then you can distort the map by placing your noise into the distortion slot, or by using a clamped Mix like described above.

• No baking step necessary to write the curve data to the vertex colors.
• Editing your geometry doesn't mess up your vertex map since the curve data is calculated at rendertime.
• Curvemap doesn't work with mentalray if that's the renderer you intend to use.
• Curvemap doesn't work with VrayRT.
• Costs \$60 for the plugin (although personally I consider this a must buy).

Here's a video showing me using the Boomer Labs Curvemap on the robot tread...

Vray's DirtMap or CurvatureMap

Another way to get curvature type effects is using the VrayDirt map with Invert Normal turned on, or the VrayCurvature map added in Vray 3.2. However, using these techniques have some major disadvantages, especially when dealing with objects that have both large details and tiny details. Watch the view below for more information on these 2 techniques...

Anyways, hopefully this gives you a number of different techniques to get some wear and tear on your geometry. Try them all and see which works best for you.

This site is ©2016 by Neil Blevins, All rights are reserved.
Back to NeilBlevins.com