Dripping Blood Maya Mel Script

| 8 Comments

dripDemo.jpg

Oozing blood? Scary swamp moss? Maybe just some festive icicles?

This MEL Script maps a particle's position along a curve to a noise function and uses it to control its initial velocity to creepy effect.

dripSetup.jpg

Step 1) Design a NURBS curve.

Step 2) Drop in a particle omni emitter.

Step 3) Into the particleShape's creation expression to the following:

float $tVal = rand(0,1);
vector $tVal3D = <<0, $tVal, 0>>;

vector $birthPos = eval("pointOnCurve -top 1 -pr "+$tVal+" curve1");

vector $velocityVal = <<0.0, -1.0, 0.0>>;

particleShape1.position = $birthPos;

float $tVal3D_x, $tVal3D_y, $tVal3D_z;
$tVal3D_x = 0.0;
$tVal3D_y = $tVal * 100;
$tVal3D_z = time * 0.1;
$tVal3D = <<$tVal3D_x, $tVal3D_y, $tVal3D_z>>;

float $noiseDrag = -1 * (pow(abs(noise($tVal3D)),4)) * 0.25;
$velocityVal = <<$velocityVal.x, $noiseDrag, $velocityVal.z>>;

particleShape1.velocity = $velocityVal;

Be forewarned: Maya gets quirky whenever you try and do anything too different from the standard workflow. Sometimes I need to rebuild this from scratch to get Maya to behave properly.

8 Comments

Neato. You're working towards something which is the opposite of some recent explorations I've been on. I am working to put curves on to particle positions: http://www.lizardlounge.com/files/curveFlow1b.mov

I looked at your flowCurve movie. Pretty cool! I haven't played around too much with dynamic hair, but I wonder if attaching dynamic hair to particles is (a) possible and (b) something that would apply to what you're doing there.

Dynamic hair off particles sounds like something that would be worth exploring. As might softbody curves being attached as well. Lot's to look into. I'll let you know if anything cool comes of it. There was a nice example of something along those lines in the Kolektiv Particles DVD from a few years ago.

Chris, I've developed script drawing curves from particles too: http://ndhaussy.free.fr/melScript/drawParticleCurveScripts.mel It was for a stylish smoke design

this is very helpful to me for learning scripting for particle and dynamics.......

For some reason it doesen't work. expresions are correct but it apear some executable error...Help!!

Make sure you are creating the expression as the particle1Shape's creation expression. Also, in your preferences make sure you are playing every frame, as this tends to simulate slowly, especially after you have thousands of particles. It also helps the shape of the "drops" if you set the emitter rate to something higher like 100 particles / sec.

Joseph, this is a great script! I'm playing with some of the math to see what other kinds of similar effects I can get.

I couldn't get this to work either ?

Leave a comment

About this Entry

This page contains a single entry by published on November 6, 2005 3:40 PM.

Clockstoppers / Cinefex Magazine was the previous entry in this blog.

Real Time Lighting in Shake is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.