I’m trying to calculate the signed distance field of a horizontal dashed line using a shader.
I managed a line well enough, by measuring the distance of a given uv coordinate from the y position of the line. I turned that into a line segment by clamping the x coordinate.
Now I need to add the line dashes.
I’m pretty sure I need to plot somthing like this
where the line flattens out at regular intervals, jumps to the next line position when it gets closer to it and then continues on the regular slope after a set dash width.
I’m not sure how to plot this function, I tried using modulo, but I didn’t get very far.
Any help is appreciated.