- Home /
How to make smoother lines - LineRenderer
I'm making a drawing application and also very much broke, so please don't suggest purchasing plugins! Currently, I'm using the Beizer quadratic formula but my lines aren't very smooth and the way I'm doing it causes some issues at "corners".
Is there anything in Unity that does anti-aliasing? Or would I have to switch to creating Textures and applying Xiaolin Wu's line algorithm before saving my line as a Sprite? I'm leaning towards this option because of my issues with "corners". Currently, I make my script wait till I have three points because creating a curve. However, this occasionally causes the issue which I've circled in red.
For context/extra info: Width = 1.6, Orthographic Camera = 10
Answer by MPHYS · Jul 01, 2020 at 10:22 PM
I couldn't figure out a clean way to resolve the weird stuff happening at the red circled area. My current solution is just a bunch of else-if clauses that sort of check of certain scenarios.
However, I did find a good solution to the aliasing issue. Unity has something called a Post-Processing stack package which has options for types of anti-aliasing. You can watch this to see more of it's capabilites. This video isn't completely valid because it was made two years ago, before Unity started including it automatically. However, just scroll to the comments and follow the instructions provided there.
Once you've imported the package, go to your camera -> Add Component -> Post-Processing Layer. From there choose the layers you want it to affect and the type of anti-aliasing you want.
Your answer
Follow this Question
Related Questions
Refreshing the Polygon Collider (2D) upon sprite change? 1 Answer
Line render shows only vertexes when using unity recorder 0 Answers
Detecting if the object is hit by LineRenderer 1 Answer
Draw out Line in C# 0 Answers
Why does a line renderer component messup the editing handles? (stealth tutorial) 0 Answers