rendering a point cloud from a texture sampler

I’m not sure if this is practical to do in Touch or not, but I’m trying to create a glsl shader that can generate point sprites based on information encoded in the pixels of a texture. I figured I could build this on top of the glsl mat point sprite code that Malcolm posted. What I’m not sure I understand is how to actually feed the vertex shader with the points, since mats have to apply to geometry. Is this something I should use a geometry shader for? (I don’t actually understand how geometry shaders work or how they fit into the pipeline). Am I totally off base? Perhaps there’s some simpler way? I know I could do all this by converting my top to a chop and using that to instance geometry, but I’d rather not use the CPU if I don’t have to.
Has anyone attempted anything like this and am I on the right path?

You are on the right track, but you wont need the geometry shader unless you want to get really crazy.

The best way I’ve found to do this sort of thing is to create a set of points by using a grid > CHOP to DAT > DAT to CHOP in ‘particle system’ mode. This will give you a set of isolated, non polygonal points that work well with point sprite materials. Then you can just use texture lookups in the vertex shader to do what you will. It may also help to texture the points so that you can just use their UV attributes to lookup your textures just like you would in a normal shader.

Thanks. This sounds similar to the solution I eventually came up with. I basically made a test case with a 256x256 4d noise TOP. I also made (256 *256)particles with a DAT to SOP. THe coordinates I’ve assigned them are unimportant… I couldn’t figure out a way to know which iteration of the vertex shader I was in, so I used the Point SOP to assign an index attribute to every particle (is there a better way?). I then render it with a GLSL point sprite shader in which the vertex shader samples the noise TOP to position the point sprites. I’ve attached the result… seems to work! However… I’m curious to know if there’s anything I could do to further optimize this solution.
GLPointCloud.4.toe (6.13 KB)