I would iterate over each triangle and calculate the intersection of the triangle with the surface. I would use a geometric shader that takes triangles as input and draws linear stripes. For each vertex in the triangle, calculate the sign distance to the surface. Then iterate over the edges: if there are two vertices where h has different signs, the edge between these vertices intersects with the surface. Although I am sure that the exact intersection can be calculated, the simplest solution would be to interpolate linearly, i.e.
vec3 intersection = (h0 * v1 + h1 * v0) / (h0 + h1);
Then print each intersection as the top of your line segment.
The code I posted here may help you. If you just want to draw the result, you are likely to run into the same problem that I described in this question. If you need vertices on the client, you can use convert feedback .
Edit: I just checked a little. As a function of distance, I used
float distToHelicoid(in vec3 p) { float theta = py / 5 + offset.x / 50; float a = mod(theta - atan(pz, px), 2*PI) - PI;
Since there is no inside / outside, and this distance function goes from -90 Β° to 90 Β°, you can only emit vertices if the sign goes from small negative to small positive or vice versa, and not when it flips from 90 Β° to -90 Β° . Here I just filtered out the distances where abs (dist)> 45 Β°:

A clean way would be to determine the index of the nearest rotation. For instance. [-pi, pi] is revolution 0, [pi, 3pi] = revolution 1, etc. You would then give up only if two distances belong to the same revolution.
source share