Changing color based on neighbor count and time (solved)
#1
Hey,


I am trying to make an ink simulation with mixing colors. Due to issues with inheriting color from the smoke sim i am looking at alternative ways to do this. I have 2 separate flows, one for each emitter/color. I have had limited success using a gradient over age, but now i would like to take it a step further.

What im trying to do is set it up in such a way that tests for neighbor count and particle lifetime. If the neighbor count is greater than X, then float through a color ramp over Y seconds. The caveat is that it needs to test against the other emitters flow, not itself. 
(if particles from emitter 1 have >X neighbors within Y distance from emitter 2, then change color over X seconds/frames based on a gradient ramp)

This way i can use gradient ramps to mix the colors. The time would be how fast the colors mix and the neighbor count controls when it starts mixing.

Any help would be greatly appreciated!

Thanks!


Edit: I seem to have it working when its testing against itself. I still dont know how to make it test against the other flow though.
  Reply
#2
Hey, i have come across a solution that works fairly well. Instead of using 2 separate flows i have managed to get it all in one! 

I am using a multi sub material with 4 entries. The first 2 entries are the solid start colors. The next 2 entries are gradient ramps starting with its initial solid color and ending with a diff color. Each event has a particle group and a property test set to nearest neighbors. The particle group isolates the property test to only accepts input from the other event. When the condition is met it goes to a new event that changes the solid color material to the gradient ramp via the material ID operator. The second event has a custom properties set to continuous event age (frames) that is read back by the mapping operator. You can adjust the blends by adjusting the test distance and test amount via the property test operator and the length of blend on the gradient by adjusting the min/max values in the mapping operator.(normalized)

I will post the max file here so you guys can mess around with it.

P.S. I had to enable the clamping on the mapping operator or the gradient will tile. Its set to 0.01 - 0.99 on all channels.

Enjoy! Big Grin

https://imgur.com/caj2xNp


Attached Files
.max   blend.max (Size: 616 KB / Downloads: 368)
  Reply
#3
Glad you figued it out!

And yes the clamping is necessary due to the way max filters maps by default. It's kind of annoying, but it makes sensei if you think about it...if it didn't filter pixels at the borders of a map, you'd potentially see hard seams at areas where the tiling occurs. You can minimize the effect by disabling filtering/blurring in the render but I'm not sure if that's possible in the view.
  Reply
#4
(05-02-2019, 05:21 PM)shadowkiller Wrote: Hey, i have come across a solution that works fairly well. Instead of using 2 separate flows i have managed to get it all in one! 

I am using a multi sub material with 4 entries. The first 2 entries are the solid start colors. The next 2 entries are gradient ramps starting with its initial solid color and ending with a diff color. Each event has a particle group and a property test set to nearest neighbors. The particle group isolates the property test to only accepts input from the other event. When the condition is met it goes to a new event that changes the solid color material to the gradient ramp via the material ID operator. The second event has a custom properties set to continuous event age (frames) that is read back by the mapping operator. You can adjust the blends by adjusting the test distance and test amount via the property test operator and the length of blend on the gradient by adjusting the min/max values in the mapping operator.(normalized)

I will post the max file here so you guys can mess around with it.

P.S. I had to enable the clamping on the mapping operator or the gradient will tile. Its set to 0.01 - 0.99 on all channels.

Enjoy! Big Grin

https://imgur.com/caj2xNp
Thank you, man!

(05-02-2019, 10:36 PM)tyFlow Wrote: Glad you figued it out!

And yes the clamping is necessary due to the way max filters maps by default. It's kind of annoying, but it makes sensei if you think about it...if it didn't filter pixels at the borders of a map, you'd potentially see hard seams at areas where the tiling occurs. You can minimize the effect by disabling filtering/blurring in the render but I'm not sure if that's possible in the view.

Hello, how to find a certain number of nearest neighbors ignoring the radius? Is it possible?


Attached Files Thumbnail(s)
   
  Reply


Forum Jump: