Corner Material

Hey, been trying to create a material that shows the corners on object for days now and I just cant figure it out. I only managed to make it work on a cube but once its stretched the material gets stretched also and changing every scalar doesnt make it even in either one or another axis. No idea if its possible with material or if I have to use a static mesh and put on each corner. Any help is appreciated.