Inward distance gradient in Cycles?

I hope this wasn’t covered in some other post, but I was wondering if anyone had any ideas on how to make a gradient that changes value with inward distance from a mesh’s surface? The idea being that on the surface the value returned would be 0, but some threshold distance value inward from the surface the value returned would be 1. If this is possible, I know it would it would be very useful with volumetric materials.