Jump to: navigation, search

Tech:Softskin

Revision as of 17:21, 10 February 2018 by Frankiezafe (Talk | contribs) (Computation)

soft skin #003

presentation

The idea of soft skin is to find another/better way to animate the mesh of an avatar. This is related to the bloodbag researches made some time ago.

First of all, it is useful to understand the relation between the mesh rendered on screen and the soft skin objects.


Softskin-bascis.png

object displayable mesh soft skin
3d position vertex dot
line edge fiber
surface polygon (quad or triangle)
constraint anchor

Even if they are bounded together, the relation between displayed mesh and soft skin is not a 1-1 relation. In displayed mesh, the edges exists in relation to triangles, and can be neglected. In the soft skin structure, fibers are mandatory to the structure. They are the active part, processing and transmitting forces to dots they are connecting.

The anchors are pullers to arbitrary defined point in space. They constraint the displacement of the dots without being influenced by them or the fibers. In the video soft skin #003 here above, they are represented as red lines.

Muscled fiber

Fibers have a rest length, the distance between the two dots it connects by default. This length can be modified at any time. At each update, fiber process the delta between the actual distance of the dots and this reference length. If the delta is bigger than 0, the fiber pull or push the two dots to match the rest length. Each dot connected to more then one fiber therefore receive more than one push.

Fibers can vary the rest length by themselves, becoming muscles. This variation is cyclic (sinusoidal), and is defined by these params:

  • minimum length,
  • maximum length,
  • frequency, the number of rotation by seconds,
  • phase shift, a constant offset on the angle used to render the curve.


See video soft skin #002 for a demonstration of these parameters' influence.

computation

Dots are simple objects. They holds a XYZ coordinate, a 3d vector to accumulate the forces transferred from the fibers and counts the number of times they've been pushed by frame. To avoid flickering in the dots' position, the force is divided by [push count - 1] before applying the force on the position. They also hold a 3d vector representing the normal vector of the dot. After the update, the force not consumed (due to division) remains in the dots, allowing an inertia.

Anchor are even simplier. They holds a reference to the dots and a 4d vector representing the XYZ position of the anchor. The fourth parameter is used as a multiplier when the force vector is computed and passed to the dot.

Fiber are a bit more complicated. At each update, they:

  • if they are muscled, compute the current rest length;
  • compute the delta of distance between the current rest length and the current distance between points;
  • pass the force to the dots;
  • and adapt their direction.


The complete process is done in one pass:

  • update of all dots and reset of the counters;
  • update of all anchors;
  • update of all fibers.


This order prevents inconsistencies between fiber's direction and dots' position. It's simplicity ensure good performances, even on complex meshes rendered on small computers.

dev log

soft skin #001 - first version of the code.

soft skin #002 - muscles and 3d cylinder.

fasciae

resources