I’m trying to get rid of weird white lines on the edges between metals and dielectrics using the Standard shader.
Sorry for just another topic about white artifacts. This is not the same case as anti-aliasing + specular workflow issues (anti-aliasing is turned off in my case), this is not the same as normal issues on the polygon edges (it’s happening in the middle of planar triangles), this is not Fresnel (it’s reproducible at any viewing angle).
How to reproduce:
Create a material with Standard shader in any incarnation (metallic, specular or roughness workflows are all affected). Assign it a texture that has some sharp black + white edges and assign it to both “Albedo” and “Specular” channels. Put the material on a cube.
The texture I used:
What appears after rendering:
The circles are 100% white and reflective - the upper one reflects the skybox. Note the white outline between black dielectric cube and metallic reflective circles.
I found one mention of this problem in slides from Unite 2015 in Japan - http://japan.unity3d.com/unite/unite2015/files/DAY1_1400_roomws_Wes.pdf on slide 7 (“Edge Artifacts”), that mentions fringes in transitional areas between materials, but no recommendations how to work around this issue.
This is definitely caused by texture interpolation - when I turn it off the issue disappears. Apparently on this line metallic is at 50% and color is at 50% gray, which results in some gray pixels with diffuse reflection.
Is there any way to get rid of those artifacts without turning off texture interpolation?
From a purely content side, there’s not much you can do to fix it 100%. You can add a dark line in the Albedo between changes between metal and non metal, but that only realily works for the largest mip. You can disable bilinear filtering, like you did, but the color is still being interpolated so there’s still an odd fringe. You can try disabling sRGB which can help in certain situations, but make others worse. You can increase the roughness or AO across the transition which is similar to darkening the Albedo but not as obvious.
The best option is don’t do it and always use hard mesh edges between metal and dielectric, but that’s not always feasible.
If you want to get into custom shaders you can do stuff like use a stepped edge which is cleaner than the point filtered option, and potentially use derivatives to push the color sample away from the interpolated region.