View Full Version : particle speed or velocity by bitmap texture

03 March 2008, 06:48 PM

Is there a way to control the volicityPP of surface emitted particles with a texture on that surface?

Like the more it is black the greater the speed is...

03 March 2008, 12:51 AM
Sure. You can use `colorAtPoint;` to sample the color of a map in the particle creation script and save that to a custom per particle attribute. This can be used as a multiplier for your velocity. `colorAtPoint;` allows for the use of an alpha flag "-o A" to sample the alpha channel and return a single index float array. Your creation script might include the following in it:

float $pU = particleShape1.parentU;
float $pV = particleShape1.parentV;
float $sampleAlpha[] = `colorAtPoint -o A -u $pU -v $pV checker1`;
particleShape1.velocity = $sampleAlpha[0];

Hopefully this helps you along. The above sample works where brighter (more white) is faster. If you change it so that darker = faster then use:

particleShape1.velocity = 1-$sampleAlpha[0];

03 March 2008, 09:12 AM
why not just using the color from the emission and multiply that with a factor to achieve the speed?



03 March 2008, 09:35 AM
I think the only way to query the emission color is to use colorAtPoint. If there is another method I would be very intersted to know what it is.

03 March 2008, 09:48 AM
this is what i meant:

CGTalk Moderation
03 March 2008, 09:48 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.