an idea on 'friction with cloth' feedback appreciated

Please don't post Bullet support questions here, use the above forums instead.
asmithers
Posts: 13
Joined: Wed Apr 26, 2006 6:22 pm

an idea on 'friction with cloth' feedback appreciated

Post by asmithers »

I've a problem with constraints not actually using friction therefore they PULL an object along the ground when they shouldn't.

quick overview on why... a constriant is meant to pull keep two particles apart at a set distance if that distance is exceeded then the particles spring will move them together using equal forces. When pinned we only move the unpinned particle the full distance.

I've seen some peoples implementation of collision where they temporarily pin that particle so that the objects other constraints dont pull it out of collision. Something I dont do, I do things slightly different, resulting in no lost spring forces. The application though is similar (except I dont need to pin).

so this leads me to pinning, I hate it :) Its artifical and incorrect its infinite mass, and infinite friction its effectively a cheat.

so how about if I stored ALL friction into a map, rather than using a PIN map. ?

Each particle has a friction value, that friction say for what was normally pinned is now 100% friction or 1.0. This means when the constraint pair goes to move, 100% friction would indicate no motion, biasing purely the free spring.

Now when a particle hits the ground or collides to a surface we specify that materials friction value, it is then applied to the particle. The friction is used to dampen the verlet motion. As well as used to help stop cloth movement when it is touching the floor, reducing the pull it has.

from a constriant computation we get

t = (Magnitude - springLength)/springLength
amount = (t*springLength) * factor
i+=dir*amount
j-=dir*amount

factor use to be 0.5 in the old method or 1.0 if pinned. Then we'd move the constraint along the direction by this amount.

now instead I want to compute the amount of motion using seperate friction values which biases how much to move

iAmount = (t*springLength) * iFriction
jAmount = (t*springLength) * jFriction
i+=dir*iAmount
j-=dir*jAmount

iFriction and jFriction are computed which I haven't worked out yet ;) Just sounding this out for a general approach.

any feedback appreciated including recommened whitepapers on friction for cloth on surfaces ?

thanks

andi
mewert
Posts: 52
Joined: Sat Oct 08, 2005 1:16 am
Location: Itinerant

Post by mewert »

That looks pretty reasonable ( assuming you only use it to modify the tangent direction ). You may want to allow the constraint to actually stretch a bit each iteration, i.e. allow iFriction+jFriction < 1.0. Over multiple iterations/frames your constraints will still converge, and it may give you better looking results ( or not :)

I implemented friction by effectively damping out the velocity at the contact point. I would move the x_current back towards x_prev based on my friction function. Which can result in some weird, twitchy artifacts. Also the most likely candidate as the source of the instability I get occasionally. Let us know how your friction method works out.