plarson
Is there a good workflow for controlling particle's Goal U/V values with a higher degree of control, using Soup nodes? Things like using animated textures for UV coords, and having the particles follow the animated texture, sliding across the surface towards the new high value coords. Or perhaps to have nicer control over UV coord's using a bounding, and using its falloff.

I've found that colorAtPoint and closestPointOnMesh are useful for controlling goalUV.

ColorAtPoint to query color, then while($color.x < 0.4) looping for whether the coord's color value is low. If so, randomizing it's goalUV again, and getting the new color for the next repeat. Brute forcing it into finding a UV coord with a high value color. But this isn't so good at runtime, as the particles jump to their new random high value UV coord, rather than sliding towards the closest high value UV coord. It also seems a bit excessive.

And closestPointOnMesh used with a locator to return closest surface's UV parameters, then adding sphrand to spread the goals around that coord. Then sending the locator's UV parameter values into a PP attrib, so it can be grabbed during the next frame, and subtracted from the loc's UV parameters on that frame, to get the amount of movement between. Adding that offset value each frame to have the goalUV's follow the locator, and slide along surface. But does show stuttering with high goalPP.

Any input would be greatly appreciated, about better ways of using the above mentioned nodes, and other ways. Especially ways that make use of Soup nodes for better results and flexibility. Thanks.
Reply 0 0
pshipkov
I think you can do that by utilizing textureToArray, pointCloudField, attributeTransfer and closestPointsOnMesh nodes.
It goes like that:

You have a mesh with applied texture.
Use the textureToArray node to associate RGBA value coming from the texture for each point on that mesh.
Then pipe that to pointCloudField node (positions come from the mesh verts, weights come from the textureToArray - make sure you set it to output only R for example).
Set the pointCloudField to be in radial mode, and make sure you set the radius to cover your particles.
If you stop here the particles will not stick on the surface, but fly around, for that you can pipe particles.worldPosition to closestPointsOnMesh, and read the output back inside the particle expression and apply it as positionPP. That way you make sure the particles stay on the surface.

Now if you animate the texture different verts on the mesh will attract the particles with different strength and the particles will obey.

You can mimic that with expression (i have an old script called waterdrops on my web side that does just that), but it is slow.
Reply 0 0
plarson
Thanks for the reply. That is a very interesting way of going about it. The pointCloudField really is nice.

I've got the textureToArray driving the magnitudePP of the cloudField working.

However I'm running into an issue with the particle.worldPosition -> closestPointOnMesh, then resulting position back to particle position. I'm getting cycling. Should it all be done in a runtime expression? I tried "=" connections, as well as set/getAttr. Thanks.
Reply 0 0
pshipkov
I have been looking into this for over 2 hours already and i don't get it. Similar code works just fine in textureToArray. This one will need some more time.
Reply 0 0
JeremyR
This is something Ive been looking at also with limited to useless results. I had a look at the mapToMesh nodes and thought about using deformers to deform the UVs that way. It works and particles slide around surface but it looks primitive. I still think textures are the way to go here as one can create more intricate shapes. 
Subscribing to this thread.
Reply 0 0
ntashev
Just a thought: if you have some UV coords for each particle, you can use the build in arrayMapper and connect both attributes - something like:
parentU -> uCoopdPP
parentV -> vCoordPP
Then the mapper will do the same as the colorAtPoint, only faster, and also you can plug any type of texture and even animate it
<< aut inveniam viam aut faciam >>
Reply 0 0
pshipkov
thats pretty much i do with that waterdrops script i mentioned above.
Reply 0 0
plarson
ntashev, thanks. I gave that a try, and got some really interesting, tho unintended patterns. But I couldn't seem to get a specific textures to be represented. Is it ParentU > GoalU, ParentV > GoalV based on two separate ramps? How should the texture be connected?

Thanks Peter, I really appreciate you taking the time to look into that.

After trying various things and rebuilding it, I ran into a way that seems to work as you suggested. It may not work with classic particles. I thought I tried this exact thing with classic particles without it working.

nParticles emitted from surface. Then this in runtime before dynamics.

if(frame>1){

vector $pos = nParticleShape1.worldPosition;

setAttr closestPointOnMesh1.inPositionX ($pos.x);

setAttr closestPointOnMesh1.inPositionY ($pos.y);

setAttr closestPointOnMesh1.inPositionZ ($pos.z);

float $posX = `getAttr closestPointOnMesh1.positionX`;

float $posY = `getAttr closestPointOnMesh1.positionY`;

float $posZ = `getAttr closestPointOnMesh1.positionZ`;

nParticleShape1.position = <<$posX,$posY,$posZ>>;

}

Thanks again Peter, I can imagine some very interesting effects with it.
Reply 0 0
Reply