Tagging particles (jit.expr problems)
Hello,
I was hoping someone could help me out, I've run into a few problems using the particle system.
I've been trying to create a particle system which allows all particles to be tagged with a 1 or a 0 when they are created(emitted), these tags are then tested before the particle xyz's are passed to 2 jit.gl.multiple's. Particles with a tag of 0 get sent to one jit.gl.multiple to render object a and particles tagged with 1 get sent to the second jit.gl.multiple to render object b.
While this could be made much more easily with two shiva objects, in the end I hope to have around 15 different jit.gl.multiples's so tagging particles seems to be the most efficient way forward. Not to mention being able to perform
Where i'm running into problems is tagging the particles, i've tried using a jit.op (jit.op @op !pass @val) to put tags into a plane of the particle matrix but this seems to work indiscriminately across the whole plane, regardless of whether a particle is new or old.
I think using a jit.expr object may be more useful but am having problems with the syntax, below is pseudo code for what i'd like to do on a cell by cell basis throughout the matrix.
if plane 1 has a particle id and plane 8 hasn't been tagged then set plane8 with a value(from inlet).
if plane1 != 0 and plane8 == 0 then plane8 = value
jit.expr @expr if (in[0].p1 != 0 && in[0].p8 == 0) then in[0].p8 = @val
Is the above possible with jit.expr? Im especially interested in how to write the if and then statements. I hope this makes sense, below is the patch which should make more sense!