View Full Version : particles visibility w/ nearest point on surface


nelsig
04 April 2010, 09:12 PM
Hello,

is there a way to make particles instance appear or disappear depending on the distance of an object with nearest point on surface ? and pick the color of this point to apply it to the color of the instance ?
would be great :)
thank you for your help
Nicolas

ctp
04 April 2010, 09:38 PM
As to the color question, you could do something like this, using a closestPointOnSurface node. If it is in fact a nurbs surface, and not a polygon mesh?


vector $pos = particleShape1.position;

setAttr closestPointOnSurface1.inPosition ($pos.x) ($pos.y) ($pos.z);
float $u = `getAttr closestPointOnSurface1.parameterU`;
float $v = `getAttr closestPointOnSurface1.parameterV`;

vector $color = `colorAtPoint -o RGB -u ($u) -v ($v) ramp2`;
particleShape1.rgbPP = $color;


Hope it will get you started in the right direction regarding both questions...
Also there's some discussion about it in an old thread here:
http://forums.cgsociety.org/showthread.php?f=86&t=649795&page=1&pp=15

and probably more threads.

EDIT: oh, just noticed you were asking in regards to instances! I'm a bit rusty on the issue, but as I remember, assigning different colors in sahding to particle instances has some challenges....?

Aikiman
04 April 2010, 12:44 AM
Hello,

is there a way to make particles instance appear or disappear depending on the distance of an object with nearest point on surface ? and pick the color of this point to apply it to the color of the instance ?
would be great :)
thank you for your help
Nicolas

Yes you could affect transparency of an instance using nearest point but you cant change the color per particle on the instancer.

nelsig
04 April 2010, 09:34 AM
Hello guys,

thanks a lot for giving me the way ... I will come back as soon as I have some results
all the best

Nicolas

CGTalk Moderation
04 April 2010, 09:34 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.


1