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?
1 Answers
I would approach it like this:
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 usuallyna=36
is more then enough in all casesnb
should be dependent on the "cyliner" height and cloth detail ...
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. Thestretch
flags if the point is on some rubber band forcing it to stick to skin. Thedone
is just temp flag for the computation.Dynamics
Now if you want to compute the actual cloth shape then you need to:
- set
done=false
for all points - set all
stretch
ed points to their corresponding position on person/dummy skin (mesh surface) and setdone=true
for them. These points will be usually covering whole slice(b=constant,a=0,1,2,...na-1)
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 anotherstretch
point use caternary curve and if not use Newtonian / D'Alembert dynamics simulation to obtain position (for that yu need to add speedvx,vy,vz
to the_pnt
. When the position is computed set thedone=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)
search all non computed points
done==false
and interpolate their position from their computed neighbors.
- set
If you got this working you can add more features like ellasticity,mass,... coefficients for each point and more.

- 49,595
- 11
- 110
- 380