I'm a beginner, still learning Geometry nodes so forgive me if my explanation isn't the clearest! How to make these scattered points adhere moving and rotating on any model's surface? I've tried many methods, but none seem to work!
This can be done… I'll describe the algorithm, as I don't have the time to build the node tree:
- Generate your geometry, use UV Unwrap node, make sure UV islands are separated with a margin greater than the velocity of particles.
- Split Edges. You don't really have to, but it makes the algorithm simpler (no need to translate between face corner and point domain), so start with that.
- Distribute Points on Faces and pass them to a Simulation Zone.
- Store Named Attribute
directionsin the point domain, which are random vectors in range $<-0.01, -0.01, 0> … <+0.01, +0.01, 0>$, you can normalize them. Alternatively you could set all directions to the same vector to have a consistent herd/flock movement. Remember the values have to be small, because you will operate in UV space $0..1$ - with the values suggested it takes between 100 and 142 frames for a point to travel across the biggest possible UV island.
- Pass that geometry to a simulation zone.
In Simulation Zone:
- Use two Named Attribute nodes to add together
- Pass the result to Sample UV Surface, using Position field. If you get a valid output, that's it, use Set Position node to update the position, and Store Named Attribute to update the UV to the vector calculated in p. 5.
- If you don't get a valid output, things get complicated… (use a switch that based on Sample UV Surface: Is Valid output, either uses the calculated data, or another branch of nodes)
Things get complicated:
- Find Nearest Edge. Check how many neighbors (faces) it has. If only 1, it's an actual geometric boundary, and decide what to do: disappear? Stop? Bounce? For bouncing, just do p.5. but subtract
directionsinstead of adding them. Now the Position from Sample UV Surface has an offset in the opposite direction.
- IF there's 2 neighbors, you also calculate the position as if you were bouncing, but don't actually set that as your position. Instead, calculate the offset to the new position - subtract from 'new position' the current position (Position node), and reverse it (Vector Math: Scale
- Divide this offset to two parts - one towards the nearest edge, and the rest.
- Rotate "the rest" around the axis defined by the nearest edge, by the angle being this edge's angle.
- Add the two parts back together, add that to current position, Sample Nearest Surface at that position to find the
UVMapattribute value there.
- You should know what do do now, you have your UV, so Sample UV to get position (yes you already have it, but it's only an estimate and this should avoid some 1-frame-jerks across boundaries), and update your position and UV.
Points 1 to 7: