Game Development Reference
In-Depth Information
err[0] = vq.QEM(q[qp.v1].v);
err[1] = vq.QEM(q[qp.v2].v);
err[2] = vq.QEM(v);
if (err[0]<err[1] && err[0]<err[2]){
qp.v.x = q[qp.v1].v.x;
qp.v.y = q[qp.v1].v.y;
qp.v.z = q[qp.v1].v.z;
qp.error = err[0];
}
if (err[1]<err[0] && err[1]<err[2]){
qp.v.x = q[qp.v2].v.x;
qp.v.y = q[qp.v2].v.y;
qp.v.z = q[qp.v2].v.z;
qp.error = err[1];
}
if (err[2]<err[0] && err[2]<err[0]){
qp.v.x = v.x;
qp.v.y = v.y;
qp.v.z = v.z;
qp.error = err[2];
}
}
return TRUE;
}
Using single mesh deformation
It is certainly possible to transform a single key mesh and then choose an
appropriate rendering level using either subdivision to enhance the mesh
or polygon reduction to decimate the mesh. Another strategy when using
polygon reduction techniques is to pre-calculate several versions of your
model and choose the appropriate model depending on the viewing
angle. If you choose to adopt this strategy, which will involve less work at
display time, then you will need some way of deforming a single mesh
based on some kind of bones system. Identifying which vertices belong to
which control sets can be hard under these circumstances. If your original
mesh is split into point sets that are controlled by individual controls, then
you need to track the control sets as the vertex contraction takes place.
You will need some kind of strategy when contracting an edge that
belongs to two control sets. Which control set should the contraction
target belong to? One technique is to calculate the distance from the

Custom Search