- Home /
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!
Answer by Bezzy · Apr 09, 2014 at 09:13 AM
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.
Your answer
Follow this Question
Related Questions
How to fix multiple camera clipping problem. 0 Answers
How to make border lines of mesh visible? 1 Answer
Glitchy shadow lines: Toon Lighted (screenshot) 0 Answers
Change Z offset of lines 1 Answer
How do I change GL LINES color? 1 Answer