In this post we will have a look at a free maya plugin that generates a “curvature map”, from where you can extract edge/concavity masks. This plugin will create a vertex color set with red, green and blue information that you use to mask out parts of your model for procedural shading effects.
Downloading and installing the plugin
We will be using the plugin “r7_vertCurvature”, that you can download here. Just place both python files in your plugins directory and load the plugin in the plugin manager.
Vertex colors Setup
Before using the plugin, we should use an high rez version of our model, in order to extract the best texture possible and also to have enough resolution for the vertex paint, since we are using vertex color texturing. We can later bake the map and use it in the low rez (subdivided at render time) model.
In the mel command line execute “r7_vertCurvature”, and you should see a pop up window with the user interface for the tool. You can experiment with the options, but the default settings works just fine. Make sure you have the object selected and run the Calculate command. Depending on the polygon count this can take a few seconds, but it shouldn’t take too long.
In order to see the result you need to turn on vertex color display, under the shape node of your mesh open the Mesh Component Display tab and check Display Colors, and now you should be able to see the rgb colors in your object.
Using the maps
Now that you have all the channels available in the current color set, you need to extract the channels and maybe remap them to increase the contrast and falloff. In arnold you can use the aiUserDataColor node, and in the Color Attr name you need to enter the name of the curvature color set, you can easily find that name in the Maya main menu (polygons), Color > Rename Current color set. Copy that name and paste it in the aiUserDataColor field.
In order to render the vertex colors you also need to check Export Vertex Colors in the arnold tab of the shape node.
Back to the node editor, we can use the remapColor node to manipulate the resulting effect, in this example I removed the blue contribution and adjust the red channel also.
And you can see the result in the renderView. You can use the Ipr mode to adjust the colors in real time.
So after this is pretty simple, just extract(connect) the outColor R, G or B from the remapColor node and use it as a mask or multiplier in your shading networks. To avoid a “cg look”, multiply the result with a procedural noise or a grunge map.
As a final tip, you can also view the color changes in the viewport by editing the vertex colors under Color > Modify Current Color set. You will have similar controls to the remapColor node but with a viewport real time display.
Thanks for reading therenderblog. And if you like our articles you will probably enjoy our course, the CG Generalist Course.