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?