LineRenderer: how to draw line intersections?

I need to draw good looking line intersection. Like this:
191868-intersection.png

I understand how to draw such a line with LineRenderer. I should use a custom texture:
191869-texture.png

But I do not know how to draw good-looking lines intersection without ugly overlapping.

Is it possible to do it in Unity?

One way of doing this is multi-pass shaders.

Here, for example:

  • pass #1 draws black fill

  • pass #2 uses ZWrite Off BlendOp Max to mix the the overlapping b&w textures together.

But this is not an universal solution and works fine with very specific grayscale textures. That being said - other variants can be figured out too (given both time and shader knowledge).

191904-screenshot-2022-01-30-004736.gif