Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

GL-Lines are too thick

Discussion in 'Scripting' started by Arcus, Sep 3, 2015.

  1. Arcus

    Arcus

    Joined:
    Jun 19, 2013
    Posts:
    3
    Hi,

    i want to draw some lines in my project. I usually used the LineRenderer but it has some wired problems with 90° edges ... you maybe know them ... However, this is not my problem.
    I want to use GL-Line because i want line with exactly 1px thickness no matter how far the camera is away.

    I think this has something to do with the antialiasing but even when i turn it off the lines are as thick as before.

    Is there any way to draw smaller lines?
    I attached a demo project below.

    gl_line_house.png
     

    Attached Files:

  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Not sure what's going on there, but you might investigate Vectrosity. I'm using it in High Frontier to draw orbit lines and a few other things, and it's working great.
     
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Looks like the thick line issue is probably just thin quads. I would ask Eric (author of vectrosity) what he thinks first. I don't know if vectrosity would solve this but it's so good it deserves to be in your toolbox anyway.
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You can use <1 pixel values for line widths in Vectrosity (such as 0.5). However you wouldn't be able to get pixel-perfect 1-pixel non-AA lines like that. I doubt that can be done with geometry (at least not efficiently); pretty much the only way I can think of would be with screen-sized textures, e.g. http://wiki.unity3d.com/index.php?title=TextureDrawLine.

    --Eric
     
  5. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Just wanted to say (off topic) that I enjoyed the ted talk! and the game looks very cool indeed.
     
    JoeStrout likes this.
  6. Arcus

    Arcus

    Joined:
    Jun 19, 2013
    Posts:
    3
    Thanks for your responses.
    @Eric5h5 The texture-draw is a good idea, but it looks very slow on 1920x1080. And i also want to use the depth test in the scene.
    For now i will keep using the GL lines. I'll try to modify the shader to get a better result.