View Full Version : Texture driving translation of multiple objects, particles(?)
razorback 02-22-2006, 03:23 PM Hi,
Just got a very simple (or maybe very complicated) question. Been working on it for the last 2 days and can't figure it out. I must be stupid...
What I need to do...
1. Create an array of the same object (can do it with a particle instancer as well), maybe 30 X 30 of em'.
2. translate them in the Y-axis, using an animated file image sequence, so I can make them form a number of predefined shapes.
Simple ? Is there an easy solution to this effect ?
I've seen a similar effect in some hollywood movie, i think it was Xmen. where the pieces bobbed up to show like a 3D map of the city.
Didn't work with the particle instancer coz i don't know how to query the file texture values/image, then apply it to my position/velocity/mass.
Didn't work with geometry, coz I don't know how to send my X and Z coords to the texture and have it return the correct output.
Any ideas would be appriciated...
|
|
cgtriguy
02-22-2006, 04:07 PM
I am not sure if this would work but you could try use the closestPointOnSurface to get the color info as described here (http://forums.cgsociety.org/showthread.php?t=319739) and then use the color info to drive the Y translation based on the value of the R,G or B. You could convert it into HSV then use the V to drive the translation.
I have not tried any of this myself but I think it could work. Let me know if this works or not.
razorback
02-22-2006, 08:01 PM
Thanks for the link. Just went over and it sorted out part of my problem.
I've gotten the closestPointOnSurface to control my rgbPP. What I can't seem to get around is how to get the rgbPP to drive the particles position. I think I read somewhere that the position attribute can't be controlled directly.
I've tried with a gray scale image,
float $inc = mag(rgbPP);
vector $pos = particleShape1.position;
if($inc<$pos.y)
particleShape1.position += <<0,0.2,0>>;
but somehow it didn't work for me... :( It only brought up the edges....
Any ideas ?
cgtriguy
02-22-2006, 09:43 PM
The script that was posted in the other thread is querying color by finding UV position. Does the plane you have your image mapped to have enough divisions to give you enough UV's? If not, try increasing the divisions in your plane.
I am no expert but it may be that in order to drive the position you may need to read the RGB values into a vector then apply the vaules to the particle position which is I think is determined by a vector as well.
wdaniel
02-22-2006, 09:50 PM
http://www.worldofmaya.com/index_2d.html
go to download and then mel script its the first one.
it works realy well.
w......................................
razorback
02-22-2006, 10:23 PM
Hey guys thanks for the feedback.
Have got it to work with minor adjustments
vector $pos = particleShape1.position;
float $posY = (trunc($pos.y*10))/10;
float $inc = (trunc(mag(particleShape1.rgbPP)*10))/10;
if($posY<$inc)
particleShape1.position += <<0,0.03,0>>;
else if ($posY>$inc)
particleShape1.position -= <<0,0.03,0>>;
used the trunc to remove the jittering from the calculations. it works but its just not very graceful. slow as hell.
Will try out the script. Hope its works !
Thanks again guys
razorback
02-23-2006, 04:53 PM
http://www.worldofmaya.com/index_2d.html
go to download and then mel script its the first one.
it works realy well.
w......................................
Just tested the script. Worked like a charm. Still trying to figure out the control texture nodes at the moment, but it looks great. Works almost real time too. Much better than the closest point on surface trick, which worked but just took too much to make useful.
CGTalk Moderation
02-23-2006, 04:53 PM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.