Curvature Based Edge Wear
By Neil Blevins
Created On: Mar 15th 2008
Updated On: Apr 9th 2024
Software: Blender or 3dsmax or 3dsmax (vray)

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.



Blender Example

Here's a method for doing Curvature Edge Wear in Blender, in fact, due to the interactive renderer cycles, it's even easier to dial than it is in 3dsmax.





3dsmax Data Channel Modifier Example

This is a method for doing edge wear in 3dsmax using the Data Channel modifier added in 3dsmax 2017.1. 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...



If using 3dsmax, this technique IMO is the best technique to use...

Advantages
Disadvantages
Here's a view of the test material in the video in the 3dsmax Slate Material Editor.



3dsmax Distorted Vertex Map Example

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.

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.. 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.



Here's the noise we add...



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.

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...




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



3dsmax CurveMap Example

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.



Advantages of this technique...
Disadvantages of the technique...

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



3dsmax (vray) Example

Another way to get curvature type effects if you have vray inside of 3dsmax 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...



Conclusion

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 ©2024 by Neil Blevins, All rights are reserved.
NeilBlevins.com TwitterMastodonBlueskyInstagram CaraBloggerFacebookLinkedIn ArtStationKickstarterGumroadYouTube IMDB