Selecting certain parts of instanced geometry

Hello everyone, I’ve been working with instances (based on CHOP samples) and I wanted to find out how I can select certain instance samples, so I can differentiate certain parts of the instanced geometry.
For example in the project I am working (which is based on the Simon’s amazing tutorial Looping Noise Part 2: Infinite Tunnel Zoom (TouchDesigner Tutorial) - YouTube ), I wanted to select the samples that are close to my camera position and make changes on them (eg make the color of the geometry follow the camera).
I am pretty bad at explanations so the picture bellow illustrates exactly what I want to achieve and the tox file is organized accordingly.

selecting certain parts of incanced geometry.toe (9.1 KB)

Another question that I had is also if I can differentiate not only the color and scale with in this way but also the material. (can I have 2 materials on the instances that change according to some parameter, like the camera position?).
Thanks in advance!

Hello,
Its possible to make some calculus inside the glsl mat, for example compute the distance of each vertex to some point in vertex shader and pass the result to geometry shader to add some vertex or the pixel shader to change color.
You can also add attribute to your Sop/Chop/Top specificaly for some instance to change color. Concerning material, there is also the possibility to instance textures.
There is some tutorials on that question.
Jacques

1 Like

Interesting, will look into that, although glsl seams really intimidating at this stage.

I think I might be close to the solution.


It doesn’t work yet for some reason but the graphs of t[x1,y1,z1] are very close to what I wanted.

Especially by multiplying the Chops in the math and normalizing them with a limit.
I am not sure why it doesn’t work thought (instead of following the camera it goes the opposite way).