I'm doing a medical research in which it is necessary to analyse the wall thickness of this Object. I used the mesh analysis which automatically colorized the meshes. Unfortunately I can't find a way to add a color legend in order to indicate the wall thickness of the colors. I'm looking for something like that:


Is there a way to solve this problem?enter image description here

I watched for something like this.

enter image description here

The objekt remains blue with this settings.

enter image description here

As I'm quite new to Blender it was not that easy for me to figure out the shading editor and using scripts but slowly I get comportable with it. When I tried to rebuild the settings in the shading editor I could not connect the script to the group ,,MaptThickness". I copied the NormalDepth text from your test_Thickness from volume projekt @vklidu and saved it as (.py) in order to install it as an add on but it didn't work out. When I save it as (.osl) Blender don't even show it to me. I guess it is quite easy but how do I actually implement the script?

enter image description here

  • 1
    $\begingroup$ Go to File > Append navigate to my file double click to open and append Material. Don't forget to switch to Cycles and enable "Open Shading Language" three rows bellow. BTW don't save as .py and don't install as add-on (it is not an add-on) copy/paste text into a Text Editor of blender (if you want to save externally use .osl type file. But in this case I also got an error to run the script when pasted separately. Any reason for that @RobinBetts ? Thank you $\endgroup$
    – vklidu
    Aug 20, 2020 at 21:56

2 Answers 2


What about Ambient Oclussion node with Inside feature enabled?
I'm not sure how precise result is, but seems to work much better than Mesh Analysis.

enter image description here (Bar in screen is just a 2D gradient.)

Compare to Mesh Analysis, this shader:

  • can be rendered (with Cycles engine)
  • color is assigned to vertex (not a face)


  • To share same ColorRamp node in both material close this node into Node Group in one material and add this Node Group into second material.
  • Color Management switch from Filmic to Standard

Note: Eevee with AO enabled produce colours, but there is not "Inside" feature we use for thickness.


quite interesting Q since a thickness depends on direction of meassure. Like plate of glass that we use to say and meassure a thickness in depth direction, that is thin. But you can also meassure thickness in width direction that would ve very thick in this case.

That is what Mesh Analysis measure. If you check @RobinBetts blend with OSL shaders, inside is one material called NormalDepth and that does exactly the same thing as Mesh Analysis - it shoots a single ray in face normal direction up to another face. This distance is represented by corresponding color assigned to a face. So if you open node group and check Map Range node - the first two values defines start / end of Color Ramp.

Example - From Min = 0 means red starts on distance zero and From Max = 1 means blue ends on distance 1 m. Playing with these two values you can exactly specify what distance ColorRamp represents. So this material seems to be the best for you.

But same as Mesh Analysis it generates "weird" colored faces that Are mathematically correct. Like when you check bottom part of Monkey's jaw, there is dark blue even that part of mesh is not such thick, but ray shooted from face goes all the way up to eyebrows, that make distance correspond to dark blue for that face.

There are other methods how to calculate thickness, where is not used a single ray direction. Like AO shooted many in hemisphere directions. Final colors represents average od these distances.

Comparison - Normal Depth (OSL)/ Ambient Occlusion / Lambert Depth (OSL) enter image description here Bar object is 1m high and 1m depth shaped as wedge object. Bar on the left uses Normal Depth shader and works just because distance is measured ONLY from one direction. Cube is 0.5 m so pure green in correct color for distance in a middle of bar. But as you can see other two shadery let you know that corners of Cube are thinner in 3d observation than Middle Mass of cube.

NormalDepth shader seems to be accurate ... with values of Ambient Occlusion and Lambert I had to play, to get similar colors. And I don't have a clue how to control.

  • $\begingroup$ @A.S I might follow up anyway, when time, but meanwhile, the Normal thickness should be the same result as Mesh Analysis. $\endgroup$
    – Robin Betts
    Aug 19, 2020 at 12:44
  • $\begingroup$ This became more as chatting (that is not allowed here) please to continue to chat room chat.stackexchange.com/rooms/111973/thickness if needed. Thank you. And please delete all comments here (that I asked already) I don't think they are helpful to anyone now. Thank you @RobinBetts for help :) $\endgroup$
    – vklidu
    Aug 19, 2020 at 14:28

This is just a supplement to @vklidu's answer.. AO seems the right way to go. There may be other measures of 'thickness', to consider, though, depending on your application..

I was going to write a quick OSL shader, taking the length of a ray from the normal, but the whole territory has been covered very comprehensively by @Robert Pali, here. So no credit here for this answer please, the scripts are his.

Using @Pali's Lambertian thickness ( biased to the normal, but sampling around it ) for the model, and his simple Normal thickness for the color wedge from 0-1, yields this:

enter image description here

As @vklidu mentioned, you can ensure the mappings stay in sync. between the materials by putting the range-mapping into a group, and editing the group, in one place for all materials:

enter image description here

The only difference between @Pali's shaders and AO, is that AO sends 'Samples' sampling rays out in the hemisphere around the shading point's normal, and he sends just one, biased in the ways he describes in his answer.

  • $\begingroup$ @RobinBetts You didnt ask for, but you deserve it :) Thanks for pointing, it is so cool. Im not so techie, so I don't have a clue what is correct, but from artistic side I have a new toy :) Also triangle bar is much clever way :) $\endgroup$
    – vklidu
    Aug 17, 2020 at 22:35

You must log in to answer this question.

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