Analyze unevenness with polygon

I have a DEM / tiff and would like to find the unevenness with a polygon, for example the roof of a house. So, I draw a polygon and the unevenness is displayed in 5, 10 and 15cm steps in color. somehow I can’t find a solution for it. in QGIS it is relatively easy to do. see picture.
do you have an approach for the cesium js or is there a git?

Thank you very much for any input.

Hi @hans_meier, this looks like an interesting display. Can you explain a little more how this “unevenness” is defined? Is it based on the value of the second derivative?

Some possible approaches might be: