OSL Improved Pointiness Shader adds Accuracy

The pointiness attribute in Cycles can be very useful for rendering worn edges and dirt maps. However, it is far from perfect. It offers little to no control over the thickness of edges, corners cause problems and, most importantly, if the size of any polygons in your model are different from each other or when they change, you can start over again with designing your materials. All of these problems are mainly caused by how Blender calculates pointiness: it simply interpolates values between vertices.

This OSL script does things in a completely different manner. It analyzes the geometry around a point that is being shaded. When rendering a point on a triangle, the script will calculate a short offset along the normal and then shoot random rays in a hemisphere around that offset point. Depending on whether it hits something, it will calculate the differences in angle (and will perform some more mathematical magic) between the normal of the point and the found hit point to determine whether it found a sharp edge, a corner or a flat face.

Advertisement