Cloth

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Cloth

Postby JoeJ » Tue May 14, 2013 11:35 am

Julio, i see you work on cloth. It might be early, but can you tell something about that?

I'd assume it should work somehow like...
Use a (kinematic) soft body and update its vertices from an animated skinned character per frame. This soft body then acts as collision ostacle for cloth?
Or do you plan to support skinned newton mesh?
Do you have a low resolution version of character in mind or 10000 polys?
Do you plan to handle cloth self collisions?
Do you plan destructible cloth?



I did some cloth stuff myself a while ago and came up with this:
Simulate a coarse 'cloth rig' on cpu. witch was connected rings around the skeleton bones.
The real cloth (on GPU) is connected to that rig and uses that information to retrieve a small number of skin vertices for collision detection per cloth vertex.
That was stable, fast and accurate enough for very tight cloth, but did not handle cloth self collisions.

So actually i'd guess that newton cloth could be good for non tight cloth like a coat,
and also a replacement for my 'coarse cloth rig' to drive more detailed gpu cloth?
Or do you plan to do the full detailed cloth for us?

I that case i'd like to mention this issue:
It is impossible to get anatomical correct character deformation with traditional matrix palette skinning.
It is also impossible with something better like dual quaternions.
It is possible if you have a lot of RAM to store tons of prcomputed morph shapes.

It might be the best solution to simulate bones and muscles and do skin coll.det. in real time.
Personally i'm sure that's the right path to go. And i also think that cloth and skin can be simulated with a single or similar algorithms,
which i tested a little and it's very promising.
You could make that possible also with your soft bodies and cloth, so keep it in mind if you did not already thought about it.
I studied the anatomy problem from start up and have some art skills, so i might be useful to test your work in that direction :)
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Cloth

Postby Julio Jerez » Tue May 14, 2013 12:05 pm

for now that plan is very simple.

I was trying the implementation of Barraf "Large step on cloth simulation" but that seem to expensive for real time".
that method lead to some nice behavior buy with out calcuting the full partial derivatives of the spring and dampers relative to the neighbors links is not very stable
I am going to god with the simplex Verlet cloth which is unconditionally stable, but not very correct.

the collision will be an image Presidion system. Basically it will voxelize the piece or the cloth or soft body that are colliding onto a 3d z buffet, and caching for persistence.
they method can handle both self collision and collision with other environment objects.

the close and soft bodies, is not a his own body. It can no be static or Kinematic because it behaves like both. at the high level it act as kinematic body, but internally each particle ac as a rigid body.
Basically the soft body dynamics in implement by the shape. It has to by part of a body, so that if work together wit the rest of the engine, (collision, broad phase, and dynamics)
The kinematic part of the close are call form the collision and the dynamics form the dynamic part of the engine.

for that I made the this body with is the sift body, this is a experiment because say for example you want to put a soft shape into a scene or compound collision, there is no clear what the parent body should be.
I will resolve that later.
I still have long way to go, I am about one third of the way now.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Cloth

Postby JoeJ » Tue May 14, 2013 5:34 pm

I'm curious on the voxel based collision system.
I already have a volume grid from GI calculation and planned to use it for cloth - enviroment collision too, but for skin or self collision my data is too low res.
Using the same volume data for more purposes than one seems promising - particle and cloth collision, GI, approx. ray tracing, terrain...
That stuff becomes more and more attractive, as ram and parallelization grows and gpu-cpu barrier falls...

Reminds me that i'd like to have a user density volume as collision input for newton, somewhen in the future... :)

I also have no clear vision on the interaction rules of rigid, soft bodies and cloth. Depends on the matter how much it can hurt stability...
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Cloth

Postby Julio Jerez » Tue May 14, 2013 6:07 pm

Basically in the we already have the Broad Phase that can quickly determine if two shape are overlapping.
Just like a zbuffer for graphic is a 2d matrix of three dimensional points, where each pixel store information (x, y, z)
X and y are the location and z the distance to the isosurface we see on the screen.
To test if a point is in front of behind of no you all you need to do is compare the z, value of a need point with the z value, but it also gives you more than just that, if you subtract the distance for the value that was on the z buffer already, you can determine the minimum distance to the is surface.
This is just what the Mikulski theorem gives you, for a 2d or tree d shape.
In three d the point are just 3d cells and the w values representing the distance to the surface of the shape?

This will ne lot of space if we do for an entire shape, by we can use and octree to code the shape iso surface.

Si the algorithm is like this the entre world is consiodes a solid voxel space where solid region as represent by the block of solid points.
We add a pointer to and octree to the rigid body, and we a caching system we build these octree as three are needed.
The cells these represent solid space has a LRU the the caching system will use to do replacement of cell that are not longer in use.

Note that this image space collision system can be use for arbitrat shape solid meshes, provide that we have a way to calculate the closes distance to the surface, now we can do that using the convex approximation tool. Therefore this open the possibility for arbitrary shape collision.

It also handles naturally the self cloth collision, and even more is can also deal with stuff like particles and fluid collision, for example the buoyancy demo can for example have waves.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Cloth

Postby Julio Jerez » Wed May 15, 2013 10:51 am

Ok now I made a little more progress and we can see some sort of cloth pattern behavior emerging.
there is not collision, and it is not optimized yet.
I need to implement some op the force that can be applied to cloth like wind, pressure, and drag.
I also need to provide for Material to control how it elastic will be.

but I believe you can see where it is going.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Cloth

Postby JoeJ » Thu May 16, 2013 10:55 am

Nice :)
You say you use rigid body for particles, so they have orientation?
Then you could add an orientation constraint as an extension. That would open up some possibilties:
* Better control of bending behaviour.
* Metal alike material, that goes back to original state but can also change default state if error is > threshold.
So you could get those destruction effects shown in those BeamNG Cars in Cryengine 3 videos.
Maybe that's cheap and easy to implement.

Thinking of real destruction, i think the main problem would be the complexity of doubling particles when tearing those apart.
(i think PhysX does it like this)
But because cloth tesselation is always high, it would be enough to simply deactivate the joints and polygons between broken vertices?
That would make destruction also cheap and easy.

And finally thinking about use case, for me it might be the best to continue my own cloth and use it for character eye candy.
I'd use newton cloth for the enviroment, curtains etc. Imagine a scene of character sliding down ramps of cloth, or car driving over soft body mud - pretty cool.
So bidirectional interaction between rigid <-> cloth/soft would be a good thing.
My experience with verlet cloth is that there are cases where it does not come to rest and jitter remains jitter,
but i think that would be acceptable (my cloth is very simple - just average or sum up all forces from distance constrains per particle - no fancy island solver).
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Cloth

Postby Julio Jerez » Thu May 16, 2013 11:36 am

No particle are no rigid bodies, bodies are too big for that. They are point masses.
what I said is that the live inside a rigid body, so that they can interact graciously with the rest of the world.

They are implemented as a shape. which is and abstract class for all particle based bodies.
this modular method makes it possible to add different implementation of cloth or any other type of particle based body that any ne want to contribute.

the cloth is just the first one, about six month ago I stared with solid mesh soft body, but that is too hard for a start (too many unresolved issues at one) Jacobsen position base projection seems a simpler choice for a start.
but solid soft bodies and solid particle (particles with orientation s that interact with the world) will come next.

The cloth now allow me to complete all the support. This weekend I will implement the depth buffer for particle collision.
and yes all particles will have two way interaction with the world.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron