View Full Version : per Particle Attributes

10 October 2003, 09:49 PM
does anyone know if there is a way to force blobby surfaces to react to the rgbPP like points or multi-streaks (ect.) do?? I have a short script that I wrote that changes the colors of particles based on their velocity at any given frame. I wanted to use this for blobby surfaces, but so far I have found that since they get their color from particle textures, they don't obey the PP attribue RGB.
If there isn't a way to make them obey the PP attr., is there a way to force a particle texture to change multiple times per frame and not have everything that it is applied to change as well??
So far the only thing I can think of is to create a texture for every particle which really isn't practicle... so I was hoping that someone would know of a different way.


10 October 2003, 09:54 PM
Blobby surfaces need to be shaded by the software renderer. So, what you'll need to do is use the particleSamplerInfo node to feed rgbPP into a shading network.

You can do some really great stuff with this node and a few ramps. (I've used this for flying splashes of molten metal, for example, cooling as droplets fly through the air by feeding the age of the particles into a ramp.)

-- Mark

10 October 2003, 09:53 PM
sweet, I knew there had to be a way, checking it out right now,

PS got your book... one of the best investments i've made in a long time... you planning on writing any more on more complex MEL programming?? hope so...

10 October 2003, 10:44 PM
Thinking about it, but nothing's set right now.

BTW, you might consider checking out the new forums!

I'm glad you like the book!

-- Mark

11 November 2003, 01:48 AM
checked out the mel scripting forum, Looks awesome. I'm registered there under the same screenName, but it might take a while to get used to going to another forum.

another quick question about using the ramps and particleSamplerInfo node... I see how you can use the ramps with age to control the per particle attributes, but how would you use the ramps to control the colors based on their velocity... to change from red to yellow to blue based on their speed...? I couldn't figure out the right connections to make it work...

11 November 2003, 02:40 AM
Open the attribute editor, right click on velocity, and choose Ramp?

-- Mark

11 November 2003, 05:07 PM
doesn't that just make the velocity of the particles follow the ramp and change their speed based on the color of the ramp?? I want the velocity to be controlled by the emitter and a field, then take the resulting per particle velocities and make the particles certain colors based on the individual speeds.
I have a script that I wrote that does that, but only from red to blue... I'm having trouble incorporating the green part of the spectrum to get the yellow color that I want... I guess what I really want is a color ramp that goes from red to yellow to blue, then somehow make the particles follow the color ramp "based" on their velocity... that's where I'm having trouble.

11 November 2003, 03:31 AM
Here's how you do that:

1) Add the rgbPP attribute to your particle object.

2) Right click on rgbPP in the attr editor and choose the Create Ramp option box.

3) Set your U parameter to "none" and your V parameter to rgbVPP.

4) Now, assign the following as runtime and creation expressions for rgbVPP:

rgbVPP = mag(velocity)/30;

Now, you can edit the ramp to map particle velocity to color. If the velocity exceeds 30, the colors will wrap around.

-- Mark

11 November 2003, 02:06 AM
that was exactly it... cheers
um, might be you be able to give me a brief explanation about how everything is connected... from the samplerNode to the ramps and how the rgbPP and rgbVPP act with each other...??
I would love to know the why with the how.

11 November 2003, 02:36 AM
There are only a handful of per-particle attributes that can drive a ramp. Two of them are rgbUPP and rgbVPP. These two parameters are hooked up automatically when you use a texture to color particles, but they're just float attributes that you can use for driving ramps as well.

So, what I did was make a ramp that feeds the RGB color based on the value of rgbVPP. Then, with an expression, I drove rgbVPP with the speed, which is the magnitude of velocity (which is a vector.)

-- Mark

11 November 2003, 03:46 AM
ok, gotcha,
I tell ya, your explanations make it sound so easy, I feel kinda stupid for not seeing it...
thanks again:beer:

CGTalk Moderation
01 January 2006, 02:00 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.