Intermediate Blender user here. I am trying to create a procedural emission shader that only effects areas of an object of a given range of thickness (i.e. if applied to a character could make the characters fingers glow - because they are thinner, but not the arms)

At the end of this stack exchange someone seems to have developed a script that can vary materals according to thickness (the Uniform Depth, script).

Get Object Width In Cycles as Value

But taking the script into textedit and copy and pasting it into the internal script function on the node doesn’t do anything, and trying to link to the file as external script returns an error! Wondering if there are any general tutorials for implementing external python scripts as nodes in materials. Will be very grateful for any help!


1 Answer 1


The related post you mentioned is not in Python but in OSL. In order to enable OSL you must set your render device in CPU mode and enable the Open Shading Language Option. I tried the code and it was working quite good (except the last part which crashed my machine).

enter image description here


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .