Search Unity

flickering procedural meshes (pixel perfect issue)

Discussion in 'General Graphics' started by OOLE, Jul 3, 2015.

  1. OOLE

    OOLE

    Joined:
    May 13, 2015
    Posts:
    14
    Hi,

    i try to visualize a kind of 2d architectural plan with unity.
    I receive the data of the plan by parsing xml-file which includes nodes for lines, circles, polylines, ...
    Then i draw the elements by generating procedural meshes. My problem is that the meshes begin to flicker when i start to zoom with the camera (changing the orthographicSize). I think this problem is caused by placing the meshes between pixel-rows (or half-pixel positions).

    I read the blog post (http://blogs.unity3d.com/2015/06/19/pixel-perfect-2d/) and several threads in the forum about pixel-perfect subject.

    But i got stuck there, because i'm not using sprites on the meshes (i'm using repetitive textures or material without texture), so i can't set the "Pixel Per Unit"-attribute. I also have no influence to set the thickness and positions of the meshes, because they are defined in the xml-file (e.g. a line can be positioned at Vector2(1.256f, 3.67f) to Vector2(6.38f, 0.456f) with a thickness of 0.127f).

    Is there any solution to solve this porblem or reduce the flickering effect?

    I have uploaded a minimal demo (WebGL) showing the problem:
    https://dl.dropboxusercontent.com/u/18527633/index.html

    I would like all lines to behave like the one in the middle (which is placed exactly at y=1).

    I have also uploaded the source of the code as unitypackage:
    https://dl.dropboxusercontent.com/u/18527633/MeshBuilder.unitypackage

    Any help is very appreciated!!!

    OOLE
     
    Last edited: Jul 3, 2015