View Full Version : particle emission: random size and location question
bravmm 06-27-2006, 08:41 PM Hi all,
Due to my early steps with MEL, I was wondering if anyone can help me out here.
I'm trying to have a particle emitter that has gives a bit of a 'wandering' random position on the particles perpendicular to the emission direction. So it's not that linear look, but a more "jiggly" look as the particles travel further away from the emitter.
I figured out a simple way to get my particles have a random size when emitted with a ramp and simple expresson on the radiusVPP.
Even better would be a random size/position emission that still ends in a particlesize 2or3 times the startvalue, but that would 'override' my current sizing solution. This would probably be something as the randomized location I guess.
I read some of the stuff about noise values etc on particles, but still wondering how to implement this. All the other stuff is working, but I want to give my emission a more organic feeling to it.
cheers for any replies, and yes... I know I should learn MEL soon ;-)
rob
|
|
Aikiman
06-28-2006, 01:51 AM
you could write runtime expression on the position of each particle using the noise(time) function, something like....
vector $pos = particleShape1.position;
particleShape1.position = <<noise(time),$pos.y+.1,noise(time)>>;
Im not sure how successful this would be but here you would have the particle moving in the y direction while shaking in the x and z.
Give it a go!
bravmm
06-28-2006, 11:52 AM
Hi, This seems to work, but it moves my emission back to the worldcenter. My emitters are away from that, so both don't stay attached.....
Any clue how to fix this. Reading up on MEL atm....
cheers for the respons though,
rob
Bonedaddy
06-28-2006, 03:21 PM
vector $pos = particleShape1.position;
int $noiseMag=1;
particleShape1.position = <<($pos.x+(noise(time)*$noiseMag)),$pos.y+.1,($pos.z+(noise(time)*$noiseMag)>>;
NoiseMag will control the amplitude of the noise. You may want to put a timeMult in there too, to control the frequency.
Aikiman
06-28-2006, 08:33 PM
Hi, This seems to work, but it moves my emission back to the worldcenter. My emitters are away from that, so both don't stay attached.....
Any clue how to fix this.
rob
Im not sure, maybe Bdaddy will know but it could be something like this although Im only guessing for now...using Bdaddy's above mel
vector $emitpos = emitter1.position;
vector $pos = particleShape1.position;
int $noiseMag=1;
particleShape1.position = <<($emitpos.x+(noise(time)*$noiseMag)),$emitpos.y+.1,($emitpos.z +(noise(time)*$noiseMag)>>;
give it a go!
Bonedaddy
06-28-2006, 11:12 PM
A particle's .position attribute will return where the particle is birthed in worldspace. You don't need to know where the emitter is, really, unless you need it to stay around the emitter.
The problem with your initial code was that it was editing the particle's position absolutely, so it would be somewhere between 1 and -1 on the X and Z axes. You wanted it to be between 1 and -1 on the Z axes around where it was birthed -- so I added the part with $pos.x and $pos.z in there.
Aikiman
06-28-2006, 11:26 PM
Not meaning to hijack this thread, but say you want your particles to emit from the position of a locator that is controlled by a motion path is it as easy as saying...
runtime expression
vector $loc = locator1.position;
particleShape1.position = <<$loc.x,$loc.y,$loc.z>>; ??
Bonedaddy
06-29-2006, 05:38 AM
More or less. You can't just call a locator's .position attribute, you need to either do an `xform -q -ws -t` or getAttr its .tx, .ty, and .tz attributes. But it'd be a lot easier to just parent an emitter to the locator...
MikeRhone
06-29-2006, 04:38 PM
Another option would be to use a fieldPP attribute. Assign a turbulence field to the particles, and name it "lifeTurb"
On your particle shape, add a PP attribute named lifeTurb_magnitude (magnitude needs to be all lower-case)
Now apply a ramp to your lifeTurb_magnitude, black at the bottom and white at the top.
Now your particles should be unaffected by the field when its born, and will be more influenced by the field as it ages. You will also likely need to increase the value in the arrayMapper so the fields strength is strong enough.
Bonedaddy
06-29-2006, 05:28 PM
Mike, does that seriously work? Where is that documented? I've been wanting some sort of per-field mass control for some time, but that would do just as well.
EDIT: A few quick tests later, and holy hell, it does work! That's cool!
EDIT TWO: After like a half hour of searching in the docs, I finally found where this is documented. How the hell did I miss that? I feel like an idiot.
MikeRhone
06-29-2006, 07:10 PM
I guess it was a little bit of a hidden gem. Lucky me Im dorky enough to browse the release notes every time a new version comes out ;) Consider it a trade for the awesome nugget of info you bestowed on me a while back about using global variables to get 2 particle systems to 'talk' to each other. I use that regularly.
fattony1982
06-29-2006, 07:18 PM
Screw maya's particle system. Download the free trail of houdini and never turn back. Mel script is no fun, and takes way from the fun of playing with particles. After using Maya for almost 4 years, and switching to Houdini the thought of going back to Maya's particles will make you thow up.. Happy learning MEL :P
Bonedaddy
06-29-2006, 07:37 PM
Screw maya's particle system. Download the free trail of houdini and never turn back. Mel script is no fun, and takes way from the fun of playing with particles. After using Maya for almost 4 years, and switching to Houdini the thought of going back to Maya's particles will make you thow up.. Happy learning MEL :P
Clearly, this solves his problem in as an efficient and timely manner as possible. Thank you for contributing to the store of Maya dynamics knowledge on cgtalk, and for keeping this thread on-topic.
Aikiman
06-29-2006, 08:49 PM
wow, it does work! How does the lifeTurb_magnitude know to effect the turbulance lifeTurb when its not assigned to a variable? Thats really cool!
bravmm
06-30-2006, 10:59 AM
Wouwaweewaa :D
This thread does certainly contain some very handy tips and tricks. Thanks everybody for the usefull (-1) contributions on my question. I've learned a lot from this.
cheers,
rob
EDIT: Is it correct the values on the arraymapper are quite high, like in the 200 range to see any effect, or is this linked to the values of the created turbulence node?? Assuming I set up my 'Per Particle Attribute Type' correctly to a 'Float' Data Type..... For the rest this works wonderfully well.
MikeRhone
07-01-2006, 05:56 AM
Well, particles will only be affected by the full magnitude (200) at its death frame. I find that you usually have to turn up the values on the array mapper a bit more than you would directly on the field to get the effect you would expect. Its not too big a deal though.
bravmm
07-01-2006, 09:39 AM
Hi Mike,
It was just to verify that I was adressing the whole thing correctly. Apparently I am... :D
Cheers for all the great tips.
rob
frogspasm
07-01-2006, 06:53 PM
I had forgotten about this one.
Makes me want to start collecting these tips on a cheat sheet and pin it next to my monitor.
Thanks Mike!
~M
CGTalk Moderation
07-01-2006, 06:53 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.