Blender OSL Bevel Shader

Michel J. Anders had his interest piqued in reading a thread about ambient occlusion shaders that asked if the Open Shader Language could be used to create a bevel shader. Michel promptly got to work and the answer is a resounding “yes”. You can use OSL’s raytracing capabilities to bevel edges at render time.

the question was asked if OSL’s ray tracing capabilities coudl be used to create a bevel shader, i.e. a shader that mimics rounded edges on sharp meshes by manipulating the normalMichel J. Anders –

To create rounded edges at render time, you need to choose a point just below the surface of the object. This becomes the point where the rays will be cast from, slightly perturbed from the face’s normal. When you are close to an edge, the normals at the intersection of an face that is adjacent will be blended in. The code involved to implant the algorithm is surprisingly small.

Check out Michel’s post for OSL Bevel Shader for blender here, to read more and get the code.