0

I have seen 3d models of dress items reshape automatically in softwares such as Daz3d, poser, makehuman etc when the model which the dress is put on is modified (usually with a morph). I have a situation where i have to do something similar in opengl es. Can somebody tell me the underlying logic in doing so? Is it again the morphs working or is there some other way?

desertnaut
  • 57,590
  • 26
  • 140
  • 166
sreesreenu
  • 1,007
  • 2
  • 11
  • 21

1 Answers1

1

I would approach it like this:

  1. Mesh

    Is usually represented as a network of nested points in some topological grid. For this I would break the clothes into "cylinders". Each "cylinder" would be represented by a grid of points something like this:

    struct _pnt { float x,y,z; bool stretch,done; };
    _pnt pnt[na][nb][3];
    

    where

    • na should be dependent on the cylinder diameter but usually na=36 is more then enough in all cases
    • nb should be dependent on the "cyliner" height and cloth detail ...

    cylinder

    Each of the points has its 3D coordinates x,y,z which are initially set to cloth's shape as would it filled with air like balloon. The stretch flags if the point is on some rubber band forcing it to stick to skin. The done is just temp flag for the computation.

  2. Dynamics

    Now if you want to compute the actual cloth shape then you need to:

    1. set done=false for all points
    2. set all stretched points to their corresponding position on person/dummy skin (mesh surface) and set done=true for them. These points will be usually covering whole slice (b=constant,a=0,1,2,...na-1)
    3. for each stretched point (a0,b0) compute the chained points. The math/physics behind it is this:

      so scan the points (a0+1,b0),(a0+2,b0)... if you hit another stretch point use caternary curve and if not use Newtonian / D'Alembert dynamics simulation to obtain position (for that yu need to add speed vx,vy,vz to the _pnt. When the position is computed set the done=true for all computed points.

      Also if the computed position of a point is inside avatar mesh you have to set its position to the avatar surface and set its speed to zero.

      Handle mesh self-collisions (dynamic impact)

    4. search all non computed points done==false and interpolate their position from their computed neighbors.

If you got this working you can add more features like ellasticity,mass,... coefficients for each point and more.

Spektre
  • 49,595
  • 11
  • 110
  • 380