View Full Version : rgbPP question
bluehonda 09-20-2007, 03:33 AM need some help.
emmitted particles from another particle. using particles > emit from obj. now i have a trail of particles. i would like the trail particles to have random or different colors. so i assign a rgbPP to it. and create a ramp. of course, it applies ramp to the whole particleShape .so every trail is alike in ramp color. question is: how can i make or create my trails to have different color of ramp ??? like one trail is blue, one is red, one is green, etc. im using multiPoint for my trails.
any comments are welcome. help me out. thanks.
|
|
Why not use multiple emitters?
Als
bluehonda
09-20-2007, 06:58 AM
yes, i can use multiple emitters. but i hope, it can still be done with the right expression.
kbrown
09-20-2007, 10:22 AM
Don't use ramp. Simply in your trail particle's creation expression do this:
seed(id);
float $R = rand(1); float $G = rand(1); float $B = rand(1);
rgbPP = <<$R, $G, $B>>;
shanshore
09-20-2007, 01:21 PM
Hi.
Each trail to hv different color of ramp...
Assuming particleShape2 is the trails particleSystem and
particleShape1 is the source particleSystem,
step-1: particleShape1 to hv rgbPP attr and use rand function in creation Expression to hv different colors of each particles...particleShape1.rgbPP = <;
step-2: particleShape2 emits particle trails, to get the same color as its parent...
add parentId attr for particleShape2 (if ur not sure, it is found in particleShape2 -> Add Dynamic Attr -> General (button) -> Particle (tab) -> parentId)
use this creation Expression for particleShape2...int $par = (float)particleShape2.parentId;
vector $rgb = `getParticleAttr -array true -at rgbPP particleShape1.pt[$par]`;
particleShape2.rgbPP = $rgb;
which gives different color for each trail (but not a ramp)
step-3: gradually changing the color to white to get the ramp using this runtime-expressionparticleShape2.rgbPP += <<0.03,0.03,0.03>>;
I got the different color ramp for each trail.
lemme know if u dont understand / trouble with any part of this...
- Shanshore
bluehonda
09-21-2007, 02:44 AM
woow! thats awesome shanshore. exactly what i need. thanks to everyone!
bluehonda
MikeRhone
09-21-2007, 05:20 PM
Interesting... I have a different approach to the problem. I try and avoid using MEL in a particle expression whenever I can (getParticleAttr)... One of the coolest tricks out there is to use global variables in particle expressions. I set the attributes I want on the source particle, and have that information passed down to the particles that get emitted to it. So here is how I do it:
Add rgpPP to both particle systems, and add parentId to the trail particle.
//sourceParticleShape Creation Expression
sourceParticleShape.rgbPP = <<rand(1),rand(1),rand(1)>>;
global vector $PartColor[];
$PartColor[ (int) sourceParticleShape.particleId ] = sourceParticleShape.rgbPP;
//trailParticleShape Creation Expression
global vector $PartColor[];
int $pid = trailParticleShape.parentId;
trailParticleShape.rgbPP = $PartColor[ $pid ];
I use the quite often to pass along a rand value from the trail particle into the lifespanPP on the trial particle. Each particle in this 'comet' system will have tails of varying lengths. Nifty trick, eh?
shanshore
09-21-2007, 07:18 PM
nice idea mike. This global variable helps a lot to optimize the performance.
I hvn't thought abt it so far.
- Shanshore
CGTalk Moderation
09-21-2007, 07:18 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-2012, Jelsoft Enterprises Ltd.