After seeing this video (yes I’m a fan of this two guys) I decided to cook some particles in TP.
How? Normally we have acces to diferent particles information like velocity, age, lifespan, size, rotation,…. But in thinking particles we are not only limited to this, we can create any data channel we want.
Imagine you want to add a value that is incrementing per frame and per every individual particle, yes it’s particle age, but imagine now that you want to only add this value under certain conditions. We can say that when a particle has passed X frames near another object pass to a new rule, this can be very powerfull.
We can improve a little more this idea and made that particles increase more his data channel if they are more near to one object, and if they are very far away particle can loose gradually this value. And yes, with this we have a basic temperature system in TP!
To create a new data channel is very easy, select your group and on right panel you can add a “float” data on “data channel” give it a name and we are ready! We can acces this data the same way we can acces to all other data in our particles group.
I added all matematic operations inside one dynamic set, for more organized view. Here you can see the inputs I create:
“Heating point” is one object in scene that will emit heat, “distance heating” is effective heating distance, “Temp increase” is the maximum heating value per iteration, “Temp decrease” is the temperature lost per iteration, “start temp” is the ambiental temperature, all particles start with this temperature and if heating point is far away they will loose temperature until this value. “Rand start” is to add a some variation in our initial temperature. All this input parameters are evaluated inside “Temp system” and return a temperature value per particle that is sended inside to “Data channel” operator.
1- Calucation of distance between every particle and our “heating” object”. We divide the result distance by “dist heating” so we have a value between 0 and 1.
2-We add some random to our particles “per animation” to add some randomnes on the starting point.
3-The expression”heating” is to have as maximum value 1 in the anterior operation, so if particles are more far than “dist heating” they will return a value bigger than 1 and we don’t want this. After with “invert” expression we invert this value (1-scalar) so particles near “heating” object will be “1″ and particles more far than “dist heating” will be “0″. We multiplie this value by “temp increase” and add random value in “2″ if we want it.
4-This is the colding system. Is really easy, the expresion “colding is: “if (scalar<1,0,1)” so if our particles are more far away than “heating distance” will return “1″ value. and will be multiplied by “Tem decrease” that is a negative value, so our particles will loose temperature every iteration.
5-We put everything together here. We take the “temp” that is the previews temperature in the last frame, and we add our “temp increase” and our “temp decrease”, one is positive and the other is negative. The expresion is “if(scalar<stemp,stemp,scalar)” so if the final temperature is less than the “starting temperature” the returning result will be “staring temperature”, this is to don’t have a value inferior than our “starting temperature” since objects stabilize his temperature with the ambient temperature. And this output value is writed on our created “temperature” data channel for every iteration.
6-This is prescindible, particle age is set to “particle born”, so its only called on the begining, and its to add some starting temperature. If we don’t do this the starting data will be “0″, with this we can say that all particles starts with a temperature of 30ºc for example.
And now we can cook some particles! In the video I create an animated blend material so we can see the increase and decrease temperature visually. But we can send to another group our particles when they arrive to a certain temperature. Also withou adding “decrease temperature” value we can have one system that can evaluate when a particle passed some time under a certain condition.
Temperature blackbox: Download