Outline mask texture?

Nice concept, could this be made more bulletproof for other shapes?

I tried adding more sampling, but I imagine using this method you would realy need like 360 texture samples?

I get this result with Star and hexagon