Propagating an attribute along a line - Math/MathMix/GLSL?

hey community, I’m playing in POPs and trying to recreate these burning strands of steel wool.

I’ve identified a simple toy-behaviour that I’m trying to model. A point on a line has a “Temperature” attribute that goes from zero to 1 whenever at least one of it’s Neighbor’s has a value of 1 (like a “hotspot” that propagates between neighbors). I’m using Connected Neighbors, maximum number 2 on a line with attribute Temp.

For the life of me I can’t figure out how to code this with a Math or MathMix, I just don’t see how to “set” a value, other than with the A operation, or how to do an if-then that “sets” a value. I wouldn’t be surprised it’s right under my nose but I’m just not seeing it.

I’ve tried a GLSL which compiles but doesn’t seem do anything in the feedback loop.

float T = TDIn_Temp();
if ( (TDIn_NebrTemp(0, TDIndex(), 0) == 1) || (TDIn_NebrTemp(0, TDIndex(), 1) == 1)){
	T = 1;

Temp[id] = T;

Could any kind souls offer some insights, thank you kindly. (maybe it’s just too late and I should go to bed…)

hi again, I didn’t go to bed but instead got obsessed with this, and figured it out! (with GLSL)
The problem was, I had forgotten to enable the output attribute Temp on the GLSL POP.
Here’s a still frame:

I’d still be curious how to do this in Math/MathMix, thanks.
And the tox is attached for anyone’s curiosity.
propagate_attribute_along_line.tox (10.7 KB)

Hello @michaeljohnson.tv

One way to do this with a Math Mix POP is to first combine the NebrTemp check into a single variable (A + B to mimic an OR operation), and then use an A if C else B operation to assign the new value to Temp.

propagate_attribute_along_line.Modified.tox (10.8 KB)

1 Like

Thanks Guillaume, this was helpful and got me re-calibrated on how to properly think about MathMix - doing the operation and then setting the result of the operation into the Attribute specified in “Result Scope”.