Transfer skin normals to the groom curves (VEX)

Example: Having the skin surface normal attribute on the hairs is necessary for rotating the hair around the root perpendicular to the skin surface. 

Logic around the script:

  • Run over primitives

  • Get the first point (root) of the primitive to a variable

  • Store root point position to a variable

  • Use xyzdist() and primuv() functions to find the normal attribute on a surface measured from the root position of the iterated primitive

  • Store the found normal attribute as a primitive attribute to the groom curves

Script:

// run in a primitive wrangle
// hair curves to the first input
// skin geometry to the second input

int pnt = primpoint(0,@primnum,0);

vector rootP = point(0,"P",pnt);

int prim;
vector uv;

xyzdist(1,rootP,prim,uv);

vector N = primuv(1,"N",prim,uv);

v@skin_normal = N;
Previous
Previous

Measure hair length (VEX)

Next
Next

Finding the minimum and maximum values of an attribute (VEX)