PDA

View Full Version : moving vertices based on texture map


gmask
01-03-2008, 02:08 AM
I'm trying to figure out a way to "displace" vertices in a polygonal plane using an animated texture map. I don't want to use a shader and a displacement because I need to see geometry actually get moved in the interface. The code below sor tof works although it spits out alot of errors about some objects not being movable in 3d space which is annoying.

I thought I might beable to do this with artisan in some way but the artPuttyCtx command is only for NURBS.. but I might beable to use it if I could figure out how to use it to just load an image and displace it and then convert it to polygons.


select -r pPlane1;
$x = `polyEvaluate -uv`;

int $N = 0;

while($N <= $x[0]){

select -r pPlane1.vtx[$N];

PolySelectConvert 4;

float $uvPos[] = `polyEditUV -q`;

$color = ` colorAtPoint -o RGBA -u ($uvPos[0]) -v ($uvPos[1]) ramp1`;

select pPlane1.vtx[$N];

move -a -y $color[0]`;

$N++;

}

gmask
01-03-2008, 02:23 AM
ok this works better without all the annoying warning messages.

select -r pPlane1;
$x = `polyEvaluate -uv`;
int $N = 0;
while($N <= $x[0]){
select -r pPlane1.vtx[$N];
PolySelectConvert 4;
float $uvPos[] = `polyEditUV -q`;
$color = ` colorAtPoint -o RGBA -u ($uvPos[0]) -v ($uvPos[1]) ramp1`;
select pPlane1.vtx[$N];
polyMoveVertex -ty $color[0] pPlane1.vtx[$N];

$N++;

}

gmask
01-03-2008, 02:26 AM
hmm looks like this command does exactly what I need.. oh well..

textureDisplacePlane

EDIT.. hmm not exatly what I need..

goleafsgo
01-03-2008, 02:15 PM
EDIT.. hmm not exatly what I need..
How close is it to what you need? I haven't tested it at all, but textureDisplacePlane is a MEL script and not a MEL command...i.e. you could use it as a start for something slightly different.

Mydrako
01-15-2008, 07:16 PM
I was also thinking of this same problem. however, our solution dont seem to work for animation. and using mel commands seem to be rather slow. I guess a custom node is needed to make it faster and animatable?

gmask
01-15-2008, 08:10 PM
Yea a custom node would be great.. I'm caching the geometry with the script turned on so that playback is not dead slow.

berniebernie
01-16-2008, 12:20 PM
I'm also very interested by this, can't you use a cluster modifier and drive the weight map with a texture channel ?

gmask
01-16-2008, 04:40 PM
I'm also very interested by this, can't you use a cluster modifier and drive the weight map with a texture channel ?

I dunno... never tried that..

CGTalk Moderation
01-16-2008, 04:40 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.