Gentle nudge/push particles away from surface (using SDF?)

   3364   1   2
User Avatar
Member
133 posts
Joined: April 2014
Offline
Alrighy, I have a big wedge of stupid in my head that is keeping me from doing this. I have particles emitting into a container (a super-simplified version is attached). I would like to get it where instead of the usual bounce/slide off a wall, the particles slow down and gradually move/are pushed away from the containing walls. I'm assuming this would be done using SDF/volume sample/volume gradient and a POP wrangle modifying the velocity based on the sampled values, but I just can't get it to work. I've seen lots of tutorials on using this approach to get particles to stay NEAR a surface, but my brain isn't adapting that to a nudge-away-from-a-surface instead of a nudge-towards. What am I doing wrong?

The POP wrangle code-in-progress (the collider is input 2, the VDB is input 3):

float samp = volumesample(2, 0, @P);
vector grad = volumegradient(2, 0, @P);

@v *= -grad;


SOMETHING is happening, just not what I want. (And ideally I could have a second SDF inside the container pushing out, thus gently keeping the particles within a certain radius of the container wall, not going to the center.)

Thanks for any help!

Attachments:
example.hiplc (350.2 KB)

User Avatar
Member
542 posts
Joined: Nov. 2016
Offline
Is that more in line with what you're looking for?

Attachments:
example_v02.hipnc (346.6 KB)

  • Quick Links