I have begun to play around with the Python programming language. And MAN, this shit is powerful! In terms of 3D production, there has yet to be a language like this. It has both power and simplicity. In this example, I created a realflow sim that would calculate particle velocity and age, and then depending on how old the particle was or how fast it was going, it is then turned into a more surface-tensioned liquid and gravity begins to take hold.
here is the script:
def onSimulationStep():
factor = 3
emitter1 = scene.getEmitter("Circle01")
emitter2 = scene.getEmitter("Circle02")
particle = emitter1.getFirstParticle()
while(particle):
life = particle.getAge()
vel_g = particle.getVelocity()
vel_x = vel_g.getX()
vel_y = vel_g.getY()
vel_z = vel_g.getZ()
speed = abs(vel_x+vel_y+vel_z)/3
if (speed>factor):
pID = particle.getId()
pos = particle.getPosition()
emitter2.addParticle(pos, vel_g)
emitter1.removeParticle(pID)
(factor+speed)/2
scene.message(factor)
if(life >= 1):
pID = particle.getId()
pos = particle.getPosition()
emitter2.addParticle(pos, vel_g)
emitter1.removeParticle(pID)
scene.message(factor)
particle = particle.getNextParticle()
Python liquid burst from alex van dyne` on Vimeo.
Mixing Liquids in C4D using Realflow and C4D
I also figured out an interesting way to simulate two(or as many as your rig can handle) mixing liquids using realflow and c4d, despite c4d's lack of a melt material! If you care, the rough directions are as follows.
1. sim out your mixing liquid being careful to note where it is exporting not just your mesh, but your particles as well.
2. import the 3 .bin files into c4d using the realflow plugin.
A. your mesh.bin
B. the first particle cache.bin
C. the second particle cache.bin
3. create a cloner object and set it's mode to object mode.
4. create any polygon shape and delete all but one vertice. then zero out the vertice in local an world space and drag it into your cloner object.
5. go to the thinking particle menu and drag one of the particle groups into the object link in the cloner object, effectively cloning a vertice to each particle in one of your mixed fluids.
6. create a material and use a proximal shader in whatever channel you like.
7. Drag the cloner object containg the verticies into the proximal shader. be sure to set the check boxes ON marked "inlcude subobjects" and "use vertices" inside your proximal shader.
8. now your proximal shader is effectivly an alpha map based on how close your mesh is to a particular particle cache. you can insert this proximal shader into anything from the color channel to the alpha channel and by setting the falloff of the proximal shader accordingly, you can have color changes or anything really!
if anyone needs a better explaination than this let me know!
Mixing liquid colors using c4d and realflow. from alex van dyne` on Vimeo.