Tech:Softskin
Latest version, in godot
Contents
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. It is also related to the relation between skin and fasciae in anatomy, see this chapter for more details.
limits of traditional skinning
(to come)
soft skin approach
First of all, it is useful to understand the relation between the mesh rendered on screen and the soft skin objects.
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 by default, the distance between the two dots it connects. 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 than 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 by fibers and anchors 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. After the update, the force not consumed (due to division) remains in the dots, equivalent to an inertia that helps avoiding the flickering. They also hold a 3d vector representing the normal vector of the dot.
Anchor are even simplier. They holds a reference to a dots and a 4d vector representing the XYZ position of the anchor. The fourth component (W) 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 own 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 during the current frame. It's simplicity ensure good performances, even on complex meshes rendered on small computers.
all fibers
In godot implementation, fibers and anchors are merged into the same class. All are fibers now.
type | head | tail | muscled |
---|---|---|---|
fiber | dot | dot | ∅ |
tensor | dot | dot | ⁕ |
ligament | vector3 (fixed) | dot | ∅ |
muscle | vector3 (fixed) | dot | ⁕ |
dev log
sub-surface scattering and fiber in mode SUBSTRACT
soft skin in godot - starting the integration of custom classes in godot
soft skin #003
soft skin #002 - muscles and 3d cylinder.
soft skin #001 - first version of the code.
anatomy
fasciae
Fascia is a connective tissue wrapping muscles and organs, Their structure is an network of elastic fibers[1]. Not being directly visible but determining the position of the skin, the analogy between the displayable mesh and the soft skin objects is pertinent.
Photos and representations of fibrae.
Screenshots of Integral Anatomy V1 pt2: Skin and Superficial Fascia - see references for link to video.
Thanks to Jacques André for this lead.
somatotypes
Related to superficial fasciae, present in two layers at the surface of the body (see first schema below, superfical and deep fasciae ), just below the skin, the shape of bodies are classified by the predominant element that model it. This classification is called somatotypes[2]
- Endomorph ( endo-, from greek, meaning inside, within, internal [3] ) - shaped by guts
- Mesomorph ( meso-, from greek, meaning middle, intermediate, halfway [4] ) - shaped by muscles
- Ectomorph ( ecto-, from greek, meaning outside, external [5] ) - shaped by skeleton
references
- ↑ Facia definition on wikipedia
- ↑ Somatotypes, definition on Encyclopedia Britannica
- ↑ endo- definition on etymonline.com
- ↑ meso- definition on etymonline.com
- ↑ ecto- definition on etymonline.com
resources
repositories
- Softskin repository C++ module for godot
- [https://gitlab.com/frankiezafe/SoftSkin-demo godot test project
- softskin-gdscript first attempt to use immediate geometries in gdscript
- Softskin repository on bitbucket, openframeworks version
external
- Tensegrity, property of a skeletal structure having continuous tension members (such as wires) and discontinuous compression members (such as metal tubes) so that each member performs efficiently in producing a rigid form [1], wikipedia
- Strain Based Dynamics - better skinning technique for skinning, implementation by nobuo-nakagawa on github.
- Fascinating Fasciae - The Hidden World Under Our Skin - documentary on arte.tv
- Integral Anatomy V1 pt2: Skin and Superficial Fascia - anatomy video
- Fascia research group