Generate multiple instances at each point based on a count attribute

I have a grid of points where:

  • P0 and P1 represent the XY position of each point

  • color.r represents how many instances should appear at that position

For example:
If color.r = 0, no instances at that point.
If color.r = 6, six instances should appear at that same XY position (they could be stacked or slightly offset in Z).

What I’m trying to figure out is:
How can I create these multiple instances efficiently inside TouchDesigner — ideally in a way that scales and can be animated later?

I’m open to any approach (TOPs, SOPs, POPs, or GLSL). I’d really appreciate pointers or examples. Thank you

Potentially the easiest approach is to define a maximum amplitude of instances per point upfront. Create all instances, and then hide (0 scale) those you don’t need.

Thx @josefpelz I will try this out.

Soln suggested by @josefpelz worked for me. Attaching a patch that simulates the same. Thank you

multiple-instances-based-on-count.toe (11.2 KB)

1 Like