View Full Version : Connect Translate to Particle RGb

08 August 2003, 11:45 PM
Is it possible to connect the translate of an emitter or even the particle point or multi points to their RGB

I know it is possible to connect a surface point in space to its RGB so it changes color as it moves around so I thought this might be handy for particles

08 August 2003, 05:14 AM
Yes you can.

For the emitter you could have it translation (x,y,z) translation pass to the particle runtime expression using xform and you could use use position (which is per particle) for each particle.

You can do it per object or per particle basis.

The only thing you have to do is normalizing it to certain range.

Best regards,

08 August 2003, 08:39 PM
I am not to familiar with xform, can you post a screenshot of hypershade and the needed expression or write out the steps


09 September 2003, 06:06 AM
This is a small expression that work per object basis:

Particle shape I'm using is point, and I add color per object attribute to it.
Color will be derived from positionY of emitter, 0 will give black, 10 will give red. And I do a linstep between these 2 values. Since linstep will clamp the output to 1 above max value, I didn't need to do any checking on it.

float $emitterPos[3] = `xform -q -ws -t emitter1`;
float $red = linstep (0, 10, $emitterPos[1]);
particleShape1.colorRed = $red;

first line is checking the position of emitter1, second line will interpolate it if the value is between 0 to 10 or set to 0 if it is less than 0, and set it to 1 if it is more than 10.
third line will pass result value back to colorRed.

If you need to do on per particle base, then you need to check each particle position and get the value, and sent it back to particle shape using `particle` command.

BTW: I didn't use any of hypershade related node in this case, just an expression.

Best regards,

09 September 2003, 10:34 PM
It is possible to connect translateX of emitter to rgbPP with expressions :

float $redpp = linstep (0, 20, emitter2.translateX );
particleShape2.rgbPP = << $redpp,0,0>>

when the emitter move, particles change color, black to red

if you want,

file maya (

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