LineRenderer cannot draw short lines

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.

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)

Hi,

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

thanks!

1 Like

Hi Richard,

I’ve submitted a bug report. Thanks.

2 Likes

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

Looks like it’s this: Unity Issue Tracker - LineRenderer is not drawn if the length is 0.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.

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] Unity Issue Tracker - LineRenderer is not drawn if the length is 0.003162 or less
[2] Unity Issue Tracker - [Backport] LineRenderer is not drawn if the length is 0.003162 or less

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.

Hey both - due to triple_why’s belief that the original case is not actually fixed, I’ve asked QA to re-test it and reopen if necessary.

FWIW there are other line drawing solutions on the asset store… i don’t think they are free, but, they may be worth checking out:

I’ve no personal experience of using either of these.

1 Like

QA agree and are reopening the bug!

2 Likes

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.

1 Like

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 ?

We moved to new bug tracking software since the original bug report, so QA have reopened it in a new ticket: Unity Issue Tracker - LineRenderer sometimes doesn't draw lines when lines are shorter than ~0.003165

It will be low priority, and sorry I don’t know of a time frame, but, my honest guess is not very fast.

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.

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.

cough open source some parts of the engine or old engine for community to (help) fix cough

Careful, maybe you would have to pay a runtime fee every time the code you fixed gets used in someone else application :wink:

2 Likes

Hey, just to let you know that we ended up replacing Unity’s LineRenderer by the Shapes asset (Shapes | Particles/Effects | Unity Asset Store).
It’s a bit expensive but at least has good documentation and is maintained regularly, and the Popylines are working perfectly for our need.

2 Likes

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 ^^