Questions about Particles Colors

Hi guys!

I wanted to have a liquid effect so I was trying out the particles I had not used yet.

I really like them a lot but there’s something I do not understand:

If I combine, for example, a red particle with a blue one (unsing 

flags = { "water", "colorMixing" }

)

The particles behave as indicated in the documentation:

[http://google.github.io/liquidfun/Programmers-Guide/html/md__chapter11__particles.html#pb](http://google.github.io/liquidfun/Programmers-Guide/html/md chapter11 particles.html#pb)

so reasoning in colors from 0 to 1 I will have two balls of color: (0.5, 0, 0.5).

How can I do though if I want to have two balls of color: (1, 0, 1)?

Edit:

I also tried adding a white particle but by doing two counts you understand that it is still not enough

Thinking about it better, the question can be more precise like this:

Given the particle color fusion rules, how can I mix particles to get a particle that (for example) has the following color : (1, 0, 1) ?

you’re describing additive blending.   try setting the blend mode to “add”, tho you may then get unwanted additive side-effects against the background (unless it’s black).

I know that attribute but as you said creates problems with backgrounds that are not black.

I was wondering then if there was another solution maybe mixing other particles…

Or any other idea

not natively supported that i’m aware of, so suspect you’re unlikely to find a workaround.  (tho i’m no expert on liquidfun - it’s just a crash-generator for me, gave up trying it long ago)

the only thing i can think of, and it’s a _ long-shot _, is to do your own color mixing, say in response to a collision event.  tho i’m not sure that you’ll be able to access the other particle’s color, might have to muck around with adding your own color values to “expose” them, then keeping them in sync as you mix, etc…  performance would probably be terrible, and it’s all just conjecture, not tested at all, just for ideas.

i suppose if queryRegion actually gave you a callback (like liquidfun native does) you could iterate the particles, “dodging” their red/blue to saturate, but that’s a non-starter with qR.  (and again, performance would probably be terrible)

As I feared …

Another annoying thing is not to have references to the single particle but only to the group…

I was thinking of creating something simple using physics and collision events (creating a physical body that mimics the particle) but I fear it would be more complicated than expected. Do you have any other advice?..

that’s the best i can offer, maybe someone more experienced with liquidfun can chime in

I understand, thanks the same!

I am waiting then

Thinking about it better, the question can be more precise like this:

Given the particle color fusion rules, how can I mix particles to get a particle that (for example) has the following color : (1, 0, 1) ?

you’re describing additive blending.   try setting the blend mode to “add”, tho you may then get unwanted additive side-effects against the background (unless it’s black).

I know that attribute but as you said creates problems with backgrounds that are not black.

I was wondering then if there was another solution maybe mixing other particles…

Or any other idea

not natively supported that i’m aware of, so suspect you’re unlikely to find a workaround.  (tho i’m no expert on liquidfun - it’s just a crash-generator for me, gave up trying it long ago)

the only thing i can think of, and it’s a _ long-shot _, is to do your own color mixing, say in response to a collision event.  tho i’m not sure that you’ll be able to access the other particle’s color, might have to muck around with adding your own color values to “expose” them, then keeping them in sync as you mix, etc…  performance would probably be terrible, and it’s all just conjecture, not tested at all, just for ideas.

i suppose if queryRegion actually gave you a callback (like liquidfun native does) you could iterate the particles, “dodging” their red/blue to saturate, but that’s a non-starter with qR.  (and again, performance would probably be terrible)

As I feared …

Another annoying thing is not to have references to the single particle but only to the group…

I was thinking of creating something simple using physics and collision events (creating a physical body that mimics the particle) but I fear it would be more complicated than expected. Do you have any other advice?..

that’s the best i can offer, maybe someone more experienced with liquidfun can chime in

I understand, thanks the same!

I am waiting then