Vertex Shader Feedback Loop

It’s possible to have a feedback loop inside a vertex shader, like the phong MAT one, to iterate the position of each points of a SOP in a new position defined by a function inside shader?

What i’m asking for is something like what you can do with GLSL TOP, using an output render buffer and reiterate it inside a feedback TOP. This is working for textures but if i need to do the same process inside vertex shader.

For whose came or have experience from Max/MSP Jitter i’m trying to achieve this example that i don’t know how traslate a jit.matrix buffer (named jit.matrix position in this example) into a vertex world context:

youtu.be/TRgX7rVgSAE?t=1212

Hi there,

No, what you ask wouldn’t make sense in the vertex shader. You can easily achieve this by using the sampler options in the GLSL MAT and passing the position information for each of your particles via a texture using those inputs.

You can do the feedback loop and all processing in the texture that you are passing, so that the vertex shader takes that data to assign a position for each vertex. The MaxMSP Jitter example you attach is in fact doing that, since a Jitter Matrix is equivalent to a texture (which is in fact a matrix). So think about it as passing pixel values (rgb) that will be interpreted by the GLSL MAT Vertex shader as position values (xyz).

I’m not in front of my computer atm, but I can upload an example later :slight_smile:

Best,
Darien

Hi Darien!

Thanks for your reply and your clarification!
If you could do an example how you’ll do something similar about that example i really appreciate.

What don’t i have clear is that all those equations about force and acceleration i have to do inside Vertex shader of a GLSL MAT and from fragment shader of this operator send out the data values to the feedback TOP?

Hi there,

I’ve put together a tox that does what you seek. you can hover with the mouse on the tox and the particles will react. I left some comments here and there, hope it makes sense. As you see, you can do all sort of operations in a GLSL TOP and pass the processed data to the GLSL MAT so that the vertex shader uses that to draw the particles.

Best,
Darien
mouseParticles.tox (9.94 KB)

Thanks a lot Darien for your time!!!

This example is super useful for me to understand the relationship of Jitter operators inside TD.

Hope you all the best!

thanks for the examples!

small detail that i’ll share here:
Lots of people are doing add → dat → dattosop for the creation of the first point.

You can also simply add → convert

Just need to close the polygon on the add’s polygon page (*, closed on)

  • so you actually get 1 point, 1 vertice, 1polygon, 1primitive -
    Then use the convertSOP convert to particles, and set render as point sprite as ‘particle type’