As the title says, i’m trying to connect a series of points with other nearby points using GLSL. I’m calculating the current point position in the vertex shader, and then looping through every other point position in the buffer using texelFetch() and a samplerBuffer until I find a nearby point. I’m then passing both of those positions to the geometry shader to connect them with a line_strip.
For some reason all of my nearby point positions seem to be in weird places and I can’t figure out why? Any help would be appreciated!
There’s a bit of confusion regarding transforms in your file.
Since you’re using instancing, P/pos in the vertex shader is vec3(0), TDDeform() has the instance transform.
So you actually want to compare the positions in the noise texture to TDDeform(pos).
As a side note you should avoid the topto (any copy from gpu mem to cpu mem is slow or 1 frame late) and send that as a samplerbuffer and instead directly read the position for the texture with texelfetch() (same as texture() but you pass pixel coordinates and there’s no filtering).
Hope it helps!
See Greg’s post for other solutions