Search Unity

White Dots On Prefabs

Discussion in 'General Graphics' started by Cubed-Studios, Feb 10, 2020.

  1. Cubed-Studios

    Cubed-Studios

    Joined:
    Mar 2, 2014
    Posts:
    3
    Hey everyone, I'm getting stumped as to the cause of this issue. I prototyped a scene to try some stuff out and it looks fine to me. But Another one in the same project when I go to play it had white dots all around the outside edges of my prefabs. Does anyone have any ideas on what is causing this and how I could fix it? I'm using the standard shader I haven't moved into HDRP yet.
     

    Attached Files:

  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    They're not white. They're blue. In fact they're exactly the same blue as the skybox ... because it is the skybox.

    The issue you're seeing is a limitation of floating point numbers and how rasterization works (how GPUs render stuff). If you've got two triangles that share an edge, the end points of those triangles need to be exactly the same or there's a change a crack will appear. And by exactly the same I mean they need to have the exact same positions in space and be transformed by the exact same matrices. If you have two quads and line them up side by side, there's a chance for a crack to show between them because each quad is using a different matrix.

    There are a couple of solutions to this:
    • Make the meshes overlap slightly. Can be a pain if your meshes are coplanar as it can lead to z-fighting.
    • Add small inset extrusions to the edges of your mesh to hide the holes. Works quite well, is much more common than you might expect, but can increase your vertex count by a non-insignificant amount depending on your use case.
    • Add big black solid black behind your objects in places where it's a problem. Can either be done on the prefab itself per object, or hand placed large ones that cover larger areas. Less vertices than the extruded edges, but now you get black lines instead of white (which is usually less noticeable).
    And yes, this is really what AAA games do too.
     
    corris_unity and SugoiDev like this.
  3. Deleted User

    Deleted User

    Guest

    Try to compress the mesh to medium or high in the model import settings.
    upload_2023-5-8_13-57-42.png