# Is there a way to get the vector to the closest UV seam?

I am looking for a way to get the distance to the closest UV map seam in UV-space as a vector in the node editor. Like this:

The blue dot is the current point of reference, i.e. the point where the current ray being evaluated has struck the object, converted to UV-space.

Ideally I want this value as a vector, but if that is impossible a scalar distance would work. Units should be in UV-space (bottom left corner of UV box is (0, 0), top right is (1, 1)). I am open to python solutions if needed.

One idea I have come up with is to somehow generate an image using Python which gives the vector per pixel (XYZ to RGB). I could then use this image in the node editor.

• By Python solution you mean it's okay to Python for the calculation, but you still need the result available to a node during rendering? I'm not sure if that's possible in general (mesh access while rendering). Even if, it would probably be quite slow without some smart algorithm to find the closest seem. Such things are better coded natively. – CodeManX Aug 29 '15 at 16:01
• @CoDEmanX I do need to get the result in the node editor. I am working on a node setup which automatically "clone brushes" across UV seams. – PGmath Aug 29 '15 at 16:05
• @CoDEmanX Currently, for testing my node setup, I am manually painting a texture around the seams, this has the disadvantage that it is only a scalar value (and that is super time consuming, bordering on impossible for some meshes). If it is possible to use Python to generate such a map that would work. – PGmath Aug 29 '15 at 16:08