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

Bug LineRenderer cannot draw short lines

Discussion in 'General Graphics' started by triple_why, Sep 28, 2021.

  1. triple_why

    triple_why

    Joined:
    Jun 9, 2018
    Posts:
    47
    Hi,

    LineRenderer cannot draw short lines, specifically lines shorter than ~0.003165 unit (precisely 0.0031622776296, IEEE-754 0x3b4f3e37) My concept involves zooming in and out in large proportions, so this number is not that small for me. In any case, LineRenderer should be capable of drawing short lines.

    LineRenderer.png

    When shorter than -so called- threshold;
    * Line is drawn in a wrong/opposite direction. (can be seen by drawing end caps)
    * Alignment to the view doesn't happen. (can be seen when the line is drawn in opposite direction or viewed from the other side)

    This is LineRenderer-specific since "Simplify preview" and "Show wireframe" (in edit mode) draw preview line and wireframe correctly, and a simple square sprite of the same size renders fine. If the line is shorter than threshold, misalignment occurs. LineRenderer aligns only when the line is longer.

    I tried different shaders, different settings of line renderer (especially width and alignment to transform Z), material, camera, but no change on descripted behavior. Drawing line i.e. 100 times bigger and scaling 100 times down results the same. For 2-point lines, adding loop makes the line show up, since the closing line draws in opposite direction. We're not seeing the intended line but the closing line. This is obviously not a solution.

    Is this an internal limitation or a bug?
    (Unity version 2020.3.14)
     
  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,281
    Hi,

    it’s probably best to submit a bug report and then we will debug it.

    thanks!
     
    ThalesRARV likes this.
  3. triple_why

    triple_why

    Joined:
    Jun 9, 2018
    Posts:
    47
    Hi Richard,

    I've submitted a bug report. Thanks.
     
    ThalesRARV and richardkettlewell like this.
  4. ThalesRARV

    ThalesRARV

    Joined:
    Apr 6, 2021
    Posts:
    11
    Hello @triple_why and @richardkettlewell,
    I could not find the bug you submitted in the public bug tracker, could you share the link ? Also did you find a solution or a workaround ?

    Has anything changed about this issue ?
    We were using Unity 2020.3.2 and our LineRenderers were working fine.

    At some point back in the days, we wanted to upgrade to the latest LTS version of Unity 2020 (2020.3.18 at the time) but we had to post-pone it because we couldn't find an easy way to fix this issue.
    Now we have tried to upgrade to Unity LTS 2021.3.27 and the issue is still there.

    - As long as there are only 2 points in the LineRenderer, it will render fine, whatever the length is.
    - As soon as you add a 3rd point, and at least 2 points are separated by a distance that is smaller than ~0.003165, the alignment of the line will fail.

    I have added a screenshot to display some cases with different length.

    Best regards
     

    Attached Files:

  5. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,281
    Looks like it's this: https://issuetracker.unity3d.com/is...t-drawn-if-the-length-is-0-dot-003162-or-less
    Fixed in 2022.2 (which is now 2022.3)

    The issue tracker link is a bit messed up for this.. possibly because we switched to new bug tracking software before we did the backports, but, looking at our internal database, we did backport the fix to 2021, specifically 2021.3.16f1.

    So I can only conclude that what you are seeing is probably a slightly different issue to the OP.
    You can submit a bug report with your situation, but I should set expectations: the line renderer as a feature is pretty low priority at the moment, in terms of bug-fixing effort.
     
  6. triple_why

    triple_why

    Joined:
    Jun 9, 2018
    Posts:
    47
    Hello @ThalesRARV,

    Original bug [1] is for 2022.2 and backport bug [2] is for 2020.3.44f1, 2021.3.16f1, 2022.1.17f1.

    I'm using 2022.3.0, I just built the case in my first post, and result is the same, lines shorter than ~0.003165 unit are still cannot be drawn. Bug trackers say fixed, but the issue is still there, as you've also described.

    I couldn't find a workaround, so used sprite images with some fixed polygons in them as a solution. But if I were to use dynamic polylines, I would be stuck I guess.

    [1] https://issuetracker.unity3d.com/is...t-drawn-if-the-length-is-0-dot-003162-or-less
    [2] https://issuetracker.unity3d.com/is...t-drawn-if-the-length-is-0-dot-003162-or-less
     
  7. ThalesRARV

    ThalesRARV

    Joined:
    Apr 6, 2021
    Posts:
    11
    Well that's a shame.

    Apparently the bug is not fixed as triple_why said, and so not back-ported either.
    I also tested in 2022.3.5 and the bug is there, as in 2021.3.27.

    So it seems I have no way to do "Free / hand drawing" at this scale.. unfortunately I can't control the distance between the Camera and the lines since it is an AR Camera (Wikitude) and the Camera may get really close from the lines.
     
  8. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,281
    triple_why likes this.
  9. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,281
    QA agree and are reopening the bug!
     
    ThalesRARV and triple_why like this.
  10. triple_why

    triple_why

    Joined:
    Jun 9, 2018
    Posts:
    47
    Wow that's nice. Will old bug reports be updated/used or will there be a new one? If latter, putting a link here would be nice for the sake of completeness/traceability.
     
    ThalesRARV likes this.
  11. ThalesRARV

    ThalesRARV

    Joined:
    Apr 6, 2021
    Posts:
    11
    Hi, just checking if a new bug has been opened because the old ones are still marked as Fixed.
    Also, what should we expect for a resolution time frame ? Will this bug also be low priority ?
     
  12. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,281
  13. triple_why

    triple_why

    Joined:
    Jun 9, 2018
    Posts:
    47
    So, issue tracker now says "Won't Fix", and resolution note says "Low user pain issues are not adressed in Shuriken anymore".

    AFAIK, Shuriken is a very old particle system in Unity and not being used anymore. Even if I don't understand this bug's relation with an old particle system, I understand that this issue will not be fixed. So now everyone is on their own. I will either continue using pre-drawn sprites, or will use paid assets mentioned earlier in this thread.
     
  14. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,281
    Hi, sorry that looks like a general message that we've applied to a bunch of bugs on features that we have decided not to prioritise working on. The wording is incorrect, but the meaning is that we only have enough programmer resources to fix high user pain bugs in the old Particle System, Line Renderer and Trail Renderer. So all minor bugs will get closed.

    Apologies for the inconvenience - we wish we could try to fix everything.
     
  15. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    *cough* open source some parts of the engine or old engine for community to (help) fix *cough*
     
  16. ThalesRARV

    ThalesRARV

    Joined:
    Apr 6, 2021
    Posts:
    11
    Careful, maybe you would have to pay a runtime fee every time the code you fixed gets used in someone else application ;)
     
    triple_why and mgear like this.
  17. ThalesRARV

    ThalesRARV

    Joined:
    Apr 6, 2021
    Posts:
    11
    richardkettlewell and triple_why like this.
  18. triple_why

    triple_why

    Joined:
    Jun 9, 2018
    Posts:
    47
    Hey thanks for the info. I'm aware of that asset and I know it's beautiful and well-structured. I still can go with Unity LR, but in case of a blocking problem, I will do the same replacement ^^