Fixed pixel thickness shader for MeshTopology.lines?

Hi!

I’m currently using Vectrosity for drawing some lines, but when I use a ton of verts, it kind of lags a little bit, so I’m looking for an alternative (Vectrosity is otherwise excellent!)

The MeshTopology.lines option is neat and super high-performing, but it only draws 1 pixel thickness. Is there some (shader?) trick I could use to just render the lines a little thicker, like 3-4 pixels rather than just 1 pixel?

I know about the geometry buffer in DX4 shaders, but as I understand it that’s only for PC so far, so I need something else (target platforms is mac + windows).

Tips appreciated!

Hi!
It’s not ideal (because multipass shaders break dynamic batching), but I write a shader with an extra pass, and push the lines very very slightly along their normals (like you would for a silhouette outline trick).

Essentially, do what you’d do with a pen. Draw twice. As you say, it’s pretty performant - it’s only going to draw very individual pixels (rather than large areas) so the frag is incredibly small. You can probably live with the overhead of drawing twice, but you might need a smarter solution to stop it from breaking dynamic batching.