|
|
|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
| How to Query Color Information from texture to particles?
|
|
|
hi guys,
just wondering how to query the colour information of a texture and pass it on to the particles.
Lets say i have an animated texture which changes colour over time mapped on a plane and i have a particle grid set as goal on the same plane,now i want particles to get the colours from the animated texture applied on that plane.hope i have made myself clear.
any suggestions??
Thanks,
Karan.
|
|
|
|
Use the colorAtPoint command.
|
|
|
|
|
thanks for the reply buddy,but can you explain me the process as how to go bout it....
Karan..
Author: Karan
|
| Replied: 25 January 2010 05:19 AM
|
|
|
|
|
can someone give me a detailed explanation on this one,really need to know the process.
Thanks,
Karan.
|
|
|
|
There isn’t much to explain in terms of steps, if you have already set up the animation and you’ve got your goals working, which I’m going to assume you did alredy.
The example below assumes that the name of the animated texture on your goal object is ramp1. You need to change that to whatever it is that you’re using.
You need two expressions, the creation expression and the runtime expression. My creation expression had two lines in there to randomize the per particle goals, you may not need that, so I’ve commented it out. Apart from that, the runtime before dynamics expression is the same and all you have to do is copy/paste.
//particleShape1.goalU = rand(0,1)
//particleShape1.goalV = rand(0,1)
float $u = particleShape1.goalU; float $v = particleShape1.goalV; float $col[] = `colorAtPoint -o RGB -u $u -v $v ramp1`; particleShape1.rgbPP = <<$col[0], $col[1], $col[2]>>;
|
|
|
|
|
hey mate thanks alot,it worked…
Thanks,
Karan.
Author: Karan
|
| Replied: 26 January 2010 05:53 AM
|
|
|
|
|
I’m using this idea, but my particles need to remain in a perfect grid. I’m goaling the particles to their birth coordinate, which is working, but when I make the varibles $u and $v to feed into the colorAtPoint command, the $u and $v are returing a value of 0. Any idea what I’m doing wrong?
//creation:
vector $partPos = particleShape2.position;
particleShape2.goalU = linstep(-35,35,$partPos.x);
particleShape2.goalV = linstep(-20,20,$partPos.z);
//runtime:
float $u = particleShape1.goalU;
float $v = particleShape1.goalV;
//print($u);
//print($v);
//print("\n");
float $col[] = `colorAtPoint -o RGB -u $u -v $v file1`;
particleShape2.rgbPP = <<$col[0], $col[1], $col[2]>>;
|
|
|
|
float $u = particleShape1.goalU; float $v = particleShape1.goalV;
should be
float $u = particleShape2.goalU; float $v = particleShape2.goalV;
|
|
|
|
|
|