Search Unity

Line Renderer, renderization issue

Discussion in 'General Graphics' started by Santako, Jun 23, 2019.

  1. Santako

    Santako

    Joined:
    Apr 13, 2018
    Posts:
    17
    Hello everybody,

    I'm sturggling with this problem in regards to the line renderer. I'm creating a line from different points taken from on mouse click. The problem is that on edges the line doesn't stay smooth and create those sharp edges. I've tried all Line Renderer combinations (corner vertices, end cap vertices...) but no one seems to solve this.

    Any idea?

    Thanks

    upload_2019-6-23_18-14-5.png
     
  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Hi, what does a shaded wireframe view look like?
     
  3. Santako

    Santako

    Joined:
    Apr 13, 2018
    Posts:
    17
    Like this: (this is another line)

    upload_2019-6-23_21-13-0.png

    Zoomed on top right:
    upload_2019-6-23_21-13-24.png
     
  4. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    I don’t think the built in Line Renderer is going to be able to draw these lines without problems.

    In general, if the width of the line is greater than the distance of the points from each other, then you are likely to get these kinds of errors. You are welcome to submit a bug report but we already have similar reports and we don’t know of a robust solution yet.
     
    Santako likes this.
  5. Santako

    Santako

    Joined:
    Apr 13, 2018
    Posts:
    17
    (Sorry for the late reply). Thanks Richard, at least now I know that the issue is related with the line width. Maybe I can modify some stuff to make it looks better.
     
    richardkettlewell likes this.
  6. Santako

    Santako

    Joined:
    Apr 13, 2018
    Posts:
    17
    Hi again, just in case it's usefull for you, unity team or anybody with the same problem:

    I've solved this issue by converting the line into small 2-point segments and then group all of them in the same parent. This way the rendering looks smooth without any sharp edge like before and the performance of the whole thing is the same.

    This is how it looks now (I've tried to replicate my previous line):

    upload_2019-7-28_20-27-34.png

    Wireframe view + hierarchy
    upload_2019-7-28_20-28-24.png
     
  7. cihadturhan_unity

    cihadturhan_unity

    Joined:
    Apr 19, 2021
    Posts:
    65
    Looks like a solid solution! I wish a similar feature existed in Unity.
    May I ask if you tried this under huge load, at least a few thousands of points? I think there will be some performance issues as these are individual object instead of a triangle mesh (I'm guessing linerenderer uses it)