cloth simulation 3d/rippling effect?

Recommended Posts

Mantrid    188
hooke's law for the mass-spring based cloth simulaton works in 2 dimensions with the addition of a z-force such as wind etc is there a method so that if you, for example, bring the top two corners of the cloth closer to each other the cloth will ripple and therefore have a z-component instead of the particles just bouncing off each other in the x-y plane? i can't seem to find anything about it...

Share this post

Share on other sites
Antheus    2409
It only depends how you calculate everything. If you use 3D vectors, you will get rippling automatically.

Just use 3D vectors for everything. Hooke's law, when written in vector form, is universal (it probably works even in higher dimensions, but those give me a headache, so I never wanted to try it).

Start here (http://www.gamedev.net/reference/list.asp?categoryid=28#306), look for articles about cloth simulaton. It explains how to properly set up springs for 3D.

Share this post

Share on other sites
Mantrid    188
oh right ok, i'm using vectors but nothing seems to ever act on the 'z'. i'll have a look at that link now, cheers

Share this post

Share on other sites
Mantrid    188
basically 'z' doesnt seem to ever be affected because as there's never a change in position in the z-direction this '0' value cancels out the z calculations, same with the change in velocity of 'z' being 0 always

everything that's happening on the xy plane just doesnt affect z, which is logical really but i know i've got to be missing something :-/

Share this post

Share on other sites
Mantrid    188
here's the hooke's law equation itself

	particlesOUT[m_Spring.nParticle1[0]][m_Spring.nParticle1[1]].vForce.x +=		L.x * fDisplacement * m_Spring.fSpringConstant;	particlesOUT[m_Spring.nParticle1[0]][m_Spring.nParticle1[1]].vForce.y +=		L.y * fDisplacement * m_Spring.fSpringConstant;	particlesOUT[m_Spring.nParticle1[0]][m_Spring.nParticle1[1]].vForce.z +=		L.z * fDisplacement * m_Spring.fSpringConstant;	//now add the damping forceparticlesOUT[m_Spring.nParticle1[0]][m_Spring.nParticle1[1]].vForce.x -=	m_Spring.fDampingConstant * LDot.x;particlesOUT[m_Spring.nParticle1[0]][m_Spring.nParticle1[1]].vForce.y -=	m_Spring.fDampingConstant * LDot.y;particlesOUT[m_Spring.nParticle1[0]][m_Spring.nParticle1[1]].vForce.z -=	m_Spring.fDampingConstant * LDot.z;

i honestly don't see how anything happening on the x-y plane will affect the z-plane unless an outside force actually acts in the z direction? anyone got any ideas?

Share this post

Share on other sites
Antheus    2409
Add noise.

Unfortunately, mass-spring model is an approximation, and as such lacks some properties that would allow it to occur naturally.

In most applications, you will not deform strictly in one plane, so the distortion will occur naturally.

Best way, if you define your cloth in XY plane, would be to perturb the Z coordinate randomly by a small ammount (1e-6). This will be enough, to add cause manipulation of cloth to exhibit wrinkles.

Despite dampening, this noise should persist as long as at least a small section of cloth is under stress. This should give you proper simulation.

Share this post

Share on other sites
Mantrid    188
oh yeah that'd make sense

it doesnt strictly have to be in the xy-plane, that just seemed to be the way i did it, i could just have it defined randomly spread across all the planes maybe, cheers again ill get cracking on that now :D

Share this post

Share on other sites
Mantrid    188
WE HAVE RIPPLES!!!!

thanks antheus, i've rated you like a motherbitch

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now