Multi GLSL TOP & Geometry Instancing - How to render different colors for my particle system?

Hi :slight_smile:
I’m a newbie about GLSL and Shader.

I followed the tutorial of Lake Heckaman about the autonomous agents → https://alltd.org/touchdesigner-dynamic-particle-system-with-attractors-part-1-autonomous-agents/

Here’s the .toe I’m working on :slight_smile:
GLSL.26.toe (9.7 KB)

Btw I modified a little bit the network:

  1. I tried to build a 3D version with respect the linked tutorial
  2. in /project1/AUTONOMOUS_AGENTS/sim GLSL Multi Top I tried to add in the vectors section the coefficient uNumSpecies (in the GLSL Pixel Shader): I would like to create different behaviours between species, but it’s not the main topic of this post
  3. in the related /project1/AUTONOMOUS_AGENTS/glslmulti1_pixel you can find the code related to the shader

The thing that I would like to do is very easy I think.
Since I’m defining different species using the value uNumSpecies in the Multi GLSL TOP ‘sim’, I would like to render them with different colors in the final Geometry ‘boids’.
How can I do it?

Should I have to use a GLSL Material to apply to Geometry ‘boids’? How?

Thank you!
Let me know if you need more pieces of information!
:slight_smile:

Hi @cicintrip,

you would want to create another output buffer which stores the color. Follow the same principle as for position, velocity and species - reading and writing to it in each update cycle.
The resulting output buffer you now can use in your instancing setup to drive the color on the “Instancing 2” page of the Geometry Component.

Hope this helps
cheers
Markus