artifacts on texture transition (lerp)

I’m making my own triplanar, everything is almost what I need, but one-pixel transitions haunt me, I show the problem in the screenshots, and also show how I roughly make transitions in the script, I’ll leave only the essence…

float3 blend = abs(i.normal);

float step = 1.0 / 3.0;

// SelectDataFromSide() - this function prepares the texture and normal for the desired side
// the first argument is the requested side
// 0 - Top, 1 - Left Right, 2 - Forward Backward

if(blend.y >= (step * 2.0)){
    SelectDataFromSide(0, TextureNum, albedoTS, normalTS, TextureSize, i);
   }
else if(blend.y >= step && blend.y < (step * 2.0)){
   SelectDataFromSide(0, TextureNum, albedo1, normal1, TextureSize, i);
   if(blend.x > blend.z){
      SelectDataFromSide(1, TextureNum, albedo2, normal2, TextureSize, i);
      }
   else{
      SelectDataFromSide(2, TextureNum, albedo2, normal2, TextureSize, i);
      }

   float lrp = (blend.y - step) * 3.0;

   albedoTS = lerp(albedo2, albedo1, lrp);
   normalTS = lerp(normal2, normal1, lrp);
   }
else if(blend.x > blend.z){
   SelectDataFromSide(1, TextureNum, albedoTS, normalTS, TextureSize, i);
   }
else if(blend.x < blend.z){
   SelectDataFromSide(2, TextureNum, albedoTS, normalTS, TextureSize, i);
   }

How to get rid of these pixel transitions?




after some experiments I did the following

float3 blend;
float3 normalGeo = normalize(cross(ddy(i.positionWS), ddx(i.positionWS)));
float3 normalDiff = abs(i.normal - normalGeo);
if(normalDiff.x <= 0 || normalDiff.y <= 0 || normalDiff.z <= 0){ blend = abs(normalGeo); }else{ blend = abs(i.normal); }

this gave the best results, examples are in the screenshots, but there are still some artifacts or sharp transitions, I haven’t figured out how to get rid of them yet…