Please help me with my particle system (-_–')

Check out this video vimeo.com/130641104

I create a Line SOP and use a Point SOP to give it a custom attribute PT (with the TScript expression $PT). I wire the Point SOP into a Geometry Comp.

I use Python (docs.python.org/2/library/itert … mbinations) to create a Table DAT of unique pairs of IDs (0, 1), (0, 2) etc.

I use this DAT to instance on the Geometry comp and use the first column of the Table DAT as tx and the second column as ty.

I export a standard phong shader to a GLSL shader.
The vertex shader must include

in float PT;

I modify the following line in the vertex shader:

vec4 worldSpaceVert =TDDeform(P);

The function TDDeform would normally use the tx and the ty from the Table DAT, but those values are particle ids–not real transforms that we want to use.
So modify the line to this:

vec4 worldSpaceVert =vec4(0.0, 0.0, 0.0, 1.0);

and extract the info from the DAT.

vec3 pairInfo = TDInstanceTranslate(); float ptA = pairInfo.x; float ptB = pairInfo.y;

Write a function that returns a translation based on the identifier.

vec3 getTrans(float ptID) { // do something else return vec3(0.0); }

Calculate the two transforms:

vec3 transA = getTrans(ptA); vec3 transB = getTrans(ptB);

And mix between the transforms:

vec3 trans = mix(transB, transA, PT); // PT is 0 or 1 so this is safe

Add the trans to the world space vert:

worldSpaceVert.xyz += trans;

Extras:
You have the locations of the two ends of each line, so you can calculate the distance. From the distance you can make a calculation of color and alpha and pass that to the pixel shader. You can also explore options with UVs.

Other threads with sample files: