Line with custom width and texturing support

I mean the last update did add support for the line with some pixel size but it was really basic,
The edges don’t have proper corners, there isn’t any option to have a line with constant world-space width either, and also the is no proper support for screenspace drawing, or having the meshes drawn with material support, like adding a gradient, or maybe a dotted pattern
For ex, check this asset,Linefy
This is cheaper but has a lot more features than this(like feather, texturing, Dots, etc and probably better AO from what I saw in the demo provided) and probably more efficient since it’s GPU based
Are there any of these features planned on the roadmap, because they really are very essential for my project

Hi

ALINE and Linefy have very different design goals. The goal of ALINE is to be a very fast and very convenient API for debug drawing and also simpler in-game drawing. It is not a goal to be a more general vector graphics toolkit and all the features that imply. You can see this in the API differences. Linefy has no large list of built-in primitives, but instead requires you to build your own. It is also much less convenient to use for debugging as you need to set up a Lines object with a given max capacity and add all lines individually to that while keeping track of indices. In contrast with ALINE you can just call Draw.Line(a, b, color) from pretty much anywhere.

Regarding performance. GPU-based is just a fancy way of saying “it’s rendered on the GPU” in this case, ALINE uses the GPU to pretty much the same extent. I have benchmarked Linefy against my package, and while Linefy can almost reach the performance of my package if I let Linefy use a pre-allocated buffer with a fixed number of lines that I just update each frame, it’s a lot slower once you start adding things like circles or other primivites (to a large part because you have to make them yourself in C# code instead of in a very high performance Burst job that ALINE uses).
Here is a screenshot of the profiler from when I benchmarked “drawing 10000 circles with random colors”. On the left side you can see Linefy and on the right side you can see ALINE. I’m even nice to Linefy and let it render only about a third of the number of vertices that ALINE renders (i.e. I render each circle with a lower resolution for Linefy. ALINE renders each circle with a resolution that is based on the distance to the camera).

In any case. If you need these features and Linefy fits that, go ahead and use it :slight_smile: In my opinion these two packages fill different niches, so use the best tool for the job.
I have no plans to add materials, gradients and texturing to ALINE. I might add dashed/dotted lines because they can be useful when debugging too.

Screen-space drawing can be done with https://arongranberg.com/aline/docs/draw.html#InScreenSpace. It’s not a perfect implementation right now though, but it will work for most things.

1 Like