I wanted a quick procedural generated terrain. I generated it as a mesh and tried using a triplanar shader to texture it. It worked OK most of the time but I got really nasty smearing across primitives which where almost orthogonal. Eventually I worked out it was because of the interpolation in the vertex normals (which are used to control the blending for the texturing). Because the primitives are large this causes problems with the triplanar shader. The image below shows what I mean. note the stretching at the foot of the cliff and some of the vertical edges.
My fix is to syntesise the normals for the texturing in the fragment shader using the ddx and ddy functions. The image below shows the result/
I got the code for calculating the normal from this post by David Williams:
float3 surfaceNormal = normalize(cross(ddx(IN.worldPos.xyz), ddy(IN.worldPos.xyz)));
Seems to solve my problem anyway.