使用Maya的SDF——Poly2Volume和nParticle制作的融化效果。
视频 http://v.youku.com/v_show/id_XNDI1MzcwMTM2.html
主要的粒子表达式:
// runtime
if(nParticleShape1.isDyn<0.5){
vector $pos = nParticleShape1.position;
int $index[3] = `fluidVoxelInfo -voxel ($pos.x) ($pos.y) ($pos.z) fluid1`;
float $density[] = `getFluidAttr -at density -xi $index[0] -yi $index[1] -zi $index[2] fluid1`;
if($density[0]>CTRL.threshold){
nParticleShape1.isDyn = 1.;
}
}
if(nParticleShape1.isDyn<0.5){
nParticleShape1.velocity = 0;
nParticleShape1.position = nParticleShape1.position0;
}