the way you compute the mirroring might create too many inaccurate values, hence the artifacts. also you can further optimize the code by doing x and y at the same time outcoord.xy = lerp(incoord.xy,-incoord.xy,step(1,fmod(abs(incoord.xy),2))); what we do here is first: fmod(abs(incoord.xy),2) means we get values from 0-2…