Fastest way to get vertex positions (MEL)

Fastest way to get vertex positions (MEL)

InNeedOfHelp
Advocate Advocate
2,946 Views
1 Reply
Message 1 of 2

Fastest way to get vertex positions (MEL)

InNeedOfHelp
Advocate
Advocate

I have an nParticle object with 120k particles and a corresponding deforming mesh with 120k verts. I'm using the this creation expression to set the particles' RGB to the verts' XYZ.

 

float $meshVertPos[] = `pointPosition -w wobbleMesh.vtx[nParticleShape1.particleId]`;

nParticleShape1.rgbPP = <<$meshedColor[0],$meshedColor[1],$meshedColor[2]>>;

 

It works but the pointPosition command is really slowing things down, I then tried using 'getAttr' but it seems about the same. I was wondering if there's a more efficient way to do this, like if its possible access the vertex position directly without a command, like the way you can with transforms.

0 Likes
Accepted solutions (1)
2,947 Views
1 Reply
Reply (1)
Message 2 of 2

stuzzz
Collaborator
Collaborator
Accepted solution

I would query all the particles positions with the particleShape attribute

getAttr "nParticleShape1.worldPosition"

then iterate throught this array to set your colors