Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Rendering artifacts with anti-aliasing

Discussion in 'General Graphics' started by drycactus, May 16, 2016.

  1. drycactus

    drycactus

    Joined:
    Sep 8, 2015
    Posts:
    19
    Hi there,
    I've been banging my head against the wall for a few days and I've run out of ideas.
    I'm having some rendering artifacts with a very simple vertex color shader, these artifacts only show up with AA enabled.

    I've verified the mesh multiple times (from Blender and within Unity) and there seems to be nothing weird.
    As you can imagine when I rotate the camera I get flickering white lines between some edges, but the edges/vertices are not split (at least if I select a vertex/edge it acts like one) and I have no idea why this is happening.

    This is especially noticeable when in Scene view, however it also happens (more intermittently and with a flickering nature) during play mode.

    Shader: http://pastebin.com/KJcpwzXC
    House FBX: https://www.dropbox.com/s/nq84ipcggkmwpqg/ASSET_HouseAlpine_01.fbx?dl=0

    Any help is greatly appreciated.

     
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Does the brown part of the house have top polygons? Because the artifacts don't look white, they look exactly like the same color of the sides of the house. Maybe z-fighting?
    You mentioned selecting the vertices to check for duplicated ones, but have you performed a weld operation? (Max artist) In Max after finishing a model I usually select the entire models vertices and perform a weld operation with the setting set real low .001 or something. Watching the vertex count - usually there is no change, but sometimes, very late at night - the vertex count might drop by 1 or 2.

    Could you possibly perform a turn edge operation on the areas that are being effected, then re-export? Not a solution, but might be able to see something else happening when in Unity.
     
  3. drycactus

    drycactus

    Joined:
    Sep 8, 2015
    Posts:
    19
    Yes, below the roof there is geometry which is brown, however it's a decent distance away so I don't think it's Z fighting.
    Also this happens on meshes that are one single "block" and don't have anything under them, I just picked the house to show an example.

    I've also tried welding vertices that are nearby and fixing up all the edges, but to no avail unfortunately :(

    Another example, this one is one a single mesh that has nothing "inside" it:
     
  4. drycactus

    drycactus

    Joined:
    Sep 8, 2015
    Posts:
    19
    Ok so after a few more hours of investigating I figured out the issue, posting here in the rare event someone is facing the same issue.
    I had a post-process script for .fbx files, it very simply would set a few basic parameters (smoothing angle, don't optimize mesh, etc), but somehow that seemed to break the .fbx import process and cause the above issue.
    Removing the post-processing script and re-importing all assets seems to have fixed the issue.
    Script is below for the curious.

    importer.generateAnimations = ModelImporterGenerateAnimations.None;
    importer.importMaterials = false;
    importer.normalImportMode = ModelImporterTangentSpaceMode.Calculate;
    importer.normalSmoothingAngle = 0;
    importer.optimizeMesh = false;
     
    theANMATOR2b likes this.