Accessing particleID fom within an instanced object

I have a fairly complex (and deep) geometry node that I am instancing. It is a character (robot) and it has multiple geometry nodes and materials inside. All animated/trigger driven etc.

Anyway, is there a way to call upon the instanceID from inside the geometry node? for example, have a Select Top access a range of external (to the geo node) tops using a python commend or equivalent.

Something like ‘…/moviefilein’ + str(InstanceID) in the “top” variable of a select top.

I am just making that up but something along those lines. Possible??

Otherwise i could probably write a GLSL shader, but i want to select between more samplers than there are slots for them…

thanks in advance…

Hi Daniel,

are the textures animated? In that case you would have to reference them in a glsl MAT and access them depending on the gl_InstanceID given in the shader.
If they are not animated but just static textures, you can pass them to the shader as a 2D Texture array and then access again via the gl_InstanceID.
derivative.ca/wiki088/index. … Instancing

Hope that helps
Markus

A lot of this depends on how your network is setup.

I usually create an additional channel of information with a pattern CHOP and merge it into my instance data. A ramp CHOP set to the same length as the number of samples / instances, with an amplitude of the length as the number of samples / instances - 1 will give a set of integers that can represent the “index” of your instances that’s external to the actual GL itself. This can be handy for any number of reasons, but namely it can be used with either a 2D array of textures or a 3D texture to provide a lookup coordinate for a texture in a stack.

I don’t know if that gets you closer to what you’re after, but maybe?

base_using_a_wcoord.tox (1.43 KB)

Thanks guys… FYI Its an animated texture. I have made a glsl shader that accesses external tops but there are not enough sample slots for the amount of tops i need to access. So this approach isn’t necessarily the best solution in my situation.

Maybe if i rephrase the question. Can i access the instance id in a chop or chop_execute dat inside the geo that is being instanced?

For example, using an if statement that calls upon the the instance ID to decide whether to act or not. This would allow me the individuality i am aiming for. I dont know if your comment Raganmd is relevant here…

Thanks again

I don’t think outside of the vertex shader you have access to gl_instanceID - which would be why I typically create an independent index outside of shader pipeline to be able to track assignments.

There’s a better example here:

[url]https://github.com/raganmd/touchdesigner_instancing_examples/blob/master/tox/base_3d_text_multimovies.tox[/url]

Make sure to right click and run the execute DAT. This should fill multiple texture 3d buffers and get this example going.

This uses a single grid SOP to define point positions and then some trimming to isolate samples for different texture look-ups. Here the ID channel is used to specify which video gets assigned to which geo.

You might also give this a look to see if there’s something in these examples to help you get to what you’re looking for:
[url]https://github.com/raganmd/touchdesigner_instancing_examples/tree/master/tox[/url]

You might also consider breaking apart your nested geo, and using the parenting in/outs on your objects to handle your transforms. I’m guessing that’ll be a major pain, but it should also allow you better texture assignment to your instances.

Thanks again.

Ended up writing a GLSL shader and changed the way i was accessing the different textures.