Rain 1

Posted by on Aug 24, 2009 in animation, code, MEL | No Comments

The rain itself was created with a particle system. A plane emits particles, which collide with a NURBS plane. The particles are assigned a collision event which kills the particle and creates new “splash” particles upon collision.

1. create NURBS plane, duplicate. Move duplicate above as it will be emitting the rain particles.
2. Select duplicate NURBS plane, go Particles > Emit From Object (options) > type: Surface.
3. Select new particle system (may be named particle1). Shift select original NURBS plane, the ground. Go Particles > make collide.
4. Select particle only, go Particles > Particle Collision Event Editor (options). Create a new collision event. Set Event Type to Emit, so that new particles will be created. This will create a new particle (may be named particle2).

The concentric waves on the ground plane are created by assigning density to a fluid texture. The density is based on particle collisions. The particle must be assigned a Collision U and V to access the location of the density being mapped.

1. Create 2d Fluid Texture (shadingNode -asTexture fluidTexture2D;). Scale and orient so it matches and fits the ground plane.
2. Select particle1. Add dynamic attributes collision U and V. To do so, open the attribute editor, scroll to “Per Particle Attributes. Click on Add Dynamic Attributes > General > Particle.
3. Create an expression to control the “density” attribute of the fluid texture at the point of collision between particle1 and the ground plane.

Expression for mapping the density to the fluid texture:

float $colU = particleShape1.collisionU;
float $colV = particleShape1.collisionV;

if ($colU > 0) {
int $xpos = fluidTexture2DShape1.resolutionW * $colU;
int $ypos = fluidTexture2DShape1.resolutionH * $colV;
setFluidAttr -xi $xpos -yi $ypos -at density -ad -fv 0.6 fluidTexture2DShape1;
particleShape1.lifespanPP=0;
} 

Email this to someoneTweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInShare on StumbleUponShare on RedditDigg this

Leave a Reply