PDA

View Full Version : particle speed or velocity by bitmap texture


Strob
03-09-2008, 07:48 PM
Hi,

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...

Meesto
03-10-2008, 01: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];

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

cheers

bigal

Meesto
03-10-2008, 10: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.

alexx
03-10-2008, 10:48 AM
this is what i meant:

http://img119.imageshack.us/img119/4086/velocityax0.jpg

CGTalk Moderation
03-10-2008, 10: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.