Weird "ghost" texture issue with Transparent Texture/Shader

I have an issue with a transparent texture where when viewed at certain angles and distance some “ghost” texture appears on the caps of the cylinder. This happens in both the Game and Scene view.

The ghosting seems to be partially cured by increasing the Aniso Level on the texture import settings but doesn’t solve the problem at far distances. The problem gets worse as you zoom out (see second image) although it is much better with aniscropic filtering at 9 (full filtering). I have no idea if this is the root/actual problem because aniscropic solves blurriness at shallow angles it just seems to mitigate the ghosting a bit.

Note: Texture.anisoLevel levels pertain as so:

  • 1: No filtering
  • 9: Full filtering

Texture Ghosting with Transparent Texture according to Aniso level
Texture Ghosting vs Distance at both Aniso 1 and Aniso 9

I understand that this may be a LOD, MIP, or some other quality setting issue but I just have no clue. This problem is also weird because the caps (top, bottom) are not textured at all and those UV’s are basically out of the picture. Notice that when the caps are selected that the UV’s are not projected. If the texture touches those edges it does paint the surface but the texture used clearly doesn’t reach the top or bottom.

Cylinder with custom UV map

I am using a custom shader based off of the “Transparent/Diffuse” shader which still has this same issue. You can download the Unity Shaders source which includes “Transparent/Diffuse” here

Shader and Texture in use

Also as a tangent… If anybody knows how to make a texture auto-tile across many objects of different size that would be great. I have asked before but wanted to mention it again.

To make different size cylinders without stretching I think I will have to procedurally generate a cylinder mesh with the appropriate amount of radial segments based on scale. Here is a start someone made (normals are kinda messed up and the caps are a bit weird). But then I would still need to create a new material for every tilingX variation of the material.

I suspect you’re seeing the result of mipmapping. In case someone reading this doesn’t know, mipmapping is an automated reduction in texture detail when you view it on a surface from a distance or at a shallow angle.

Disable mipmapping on your texture asset and you should be fine.

I suspect the tris on the caps have UVs (otherwise you’d be getting errors reported by your material in the console). I also suspect your cap UVs are outside the UV map you’ve screenshot, rather than being deleted? If that’s the case, Unity will tesselate the texture across to where those UVs are and will map them anyway. The weird ghosting is probably just low-res mipmaps bleeding colour across to those UVs.

To disable mipmapping, select your texture in the Project tab, then in the Inspector tab, change its Texture Type to Advanced. Some new options will appear in the Inspector tab, amongst which will be Generate Mip Maps. Fiddle with those options - including turning them off - and see if that fixes it.

Mipmapping reduces texture detail size when you view it for distance or at a shallow angle.

Aniso Level value move back in distance when this low-res occurred.
Adding Aniso Level the blur reduction in texture detail is done farther back, you get more quality and is more computationally expensive.