MathMix topics (RFE, bug & idea)

Hi there,

RFE: Would it be possible to add a ‘reflect(A,B)’ and ‘refract(A,B,C)’ function to the mathmix operations? Those are predefined GLSL functions and can help alot for particle collisions (mainly reflect). I can imagine some interesting effects with refract() as well.

Other thing which I’m not sure is technical possible but thought about mentioning. When working with arrays (like position outputs of the neighborPOP), you often want to do some math operations with each element in this array. Would it be possible that if the attribute is an array, it automatically creates a for loop out of it ? See attached TOX as example using 5 mathmix to handle 5 neighbors vs 1 GLSL shader with a for-loop. No problem ofcourse to use a GLSL POP for this, so not a big RFE from my side, but could be an idea to keep the glsl usage to a minimum :slight_smile:

Last thing is that I think the mix(a,b,c) is reversed. This might be a feature rather than a bug since I guess you want to have consistency with the ‘A if C else B’ option. Though it feels a bit weird when you’re used to the GLSL mix() function. See second attachment.

Cheers,
Tim

NeighborMath.tox (2.5 KB)
Backwards_mix.tox (1.1 KB)

1 Like

one last thing I forgot to mention, but I guess you are aware of it already:
The mathCombine second POP input attributes are called ‘attributeName1’ instead of ‘in1_attributeName’ like the mathMix.

Cheers,
tim

1 Like

Hello @timgerritsen
We will look into the input attribute naming convention between Math Mix and Math Combine.
For the RFEs, I’ll check with the team what are the priorities. We’ll probably quickly add ‘reflect(A,B)’ and ‘refract(A,B,C)’.

Thanks

1 Like

A key difference between the Mix and Combine POPs is how they deal with inputs - Mix has auto-naming for all the inputs’ attributes, but the attributes don’t go to the output except for the first input. Combine you are explicitly selecting the attributes from all the inputs where you can rename them and these selected ones go to the output (unless you delete them on the output page).

I try to explain it here: Math Combine POP - Derivative

1 Like

aaah that makes alot of sense :slight_smile: I should have read the docs :smiley:

reflect() refract() and the Math Mix’s mix() in proper order now in Alpha 5.3.

2 Likes