I created a function that converts a scalar cavity factor into RGB, based on surface base color. It simulates the self reflections that happen inside cavities, producing shading that's closer to real life.
This is how cavity shading with simulated reflections looks like (shading options are: studio lighting, object color, “world” cavity valley set to 3.5):
And this is current master build shading:
The proposed shading is most appropriate for single color objects, since it assumes that a shaded point is occluded by surfaces of the same base color. Therefore, for scenes with many different colors, the current master build implementation might be more desirable.
I think it would be good to make this optional. In the shading popover, under cavity, there could be either a checkbox toggle or a slider that fades between the two methods.