The problem is that where the texture coordinates change very quickly between pixels I get horrid artifacts. See the thin, broken purple lines in the image below.

Ignore the texture magnification blur in the middle bottom of the image - it's just a low res texture!
Here's an image of the UVs, ( u in red, v in green, blue=0 ) - hopefully that points out where the artifacts would occur, even if you can't immediately see them in the first image

Now, some of you are probably already reaching for a link to docs on sampleGrad. I've tried playing with it, but so far have only managed to bias the problem one way or the other - one side or other of the round features is still 'bad'. I may not fully understand what I'm doing though, and I'd be very grateful for an explanation if anyone thinks this is the right route to go down.
Another possible solution which I'm working on is to render the UVs to a texture and smooth them out with a box filter. I'll lose detail in the UV map, but I don't think that will make much difference to the final image.
I've also tried just painting over the artefacts - as they occur at the very edge of the 'trapping circle' I guessed they would fall between ~0.99 and 1.0. It turns out that the artefacts are actually on pixels next to (but sufficiently different in UV value from) the pixels with values 0.9...1.0. This is what led me to believe I couldn't solve this with knowledge of only one pixel - I need to use ddx/ddy/sampleGrad or another pass.
Any suggestions?








