Your best bet would be doing it in pre-processing step in your content creation package by encoding distance to nearest edge into additional UV channel.
Your best bet would be doing it in pre-processing step in your content creation package by encoding distance to nearest edge into additional UV channel.