Is it really so hard to draw smooth lines in Oneness?

I tried for some time to draw smooth lines in Unity, but with Line Renderer I only got jagged lines with rounded corners, in particular when the angle of curvature is really small. I turned on the anti-aliasing value in the quality settings and tried different materials, but nothing changed. I also tried to instantiate a sphere every time the mouse moves, but it creates some gaps between different spheres, in particular when the mouse goes fast. I know there is a plugin called Vectrosity for this, but is there a way to achieve this without it?

+6
source share
3 answers

I got only jagged lines with corners not rounded, especially when the angle of curvature is really small.

This was a problem in Unity 5.4 and below. This issue has been fixed in Unity 5.5 and higher after it has LineRendererbeen completely redesigned.

All you have to do is upgrade to Unity 5.5 or higher, and this problem should go away.

There is a new variable called LineRenderer.numCornerVertices. You can use this to set how smooth your line should be. A value of 5 seems good for this.

There is also another new variable called LineRenderer.numCapVerticesthat can be used to determine how smooth the end of the line will be.

This is a screenshot showing between 5.4 and 5.5 changes:

enter image description here

+5
source

, .

:

  • , .

enter image description here

  1. v = (p2 - p1) ( ). 90 normal = v.y, -v.x, .

enter image description here

  1. , . .

enter image description here

  1. .

enter image description here

  1. . - [i, w/2 + i, w/2 + i + 1], i - , w - .

enter image description here

  1. . - [i, w/2 * i + 1, i + 1]

enter image description here

  1. . , .

enter image description here

+16

Unity 2017.2. AA , . , .

My solution solved the issue of disabling MSAA on the camera because the rendering was delayed. The camera has a setting for "using graphic settings" that should never have been mixed up, but I'm new - I don't know much. I changed the setting to "forward" and my buttocks disappeared into the fog.

If I were more hardworking, I would post it before and after the images.

0
source

Source: https://habr.com/ru/post/1016684/


All Articles