12 if (!inMaterial.mEnableGrid)
19 float3 a = float3(1, 1, 1) - ma;
23 uint3 stride = cGridStride;
25 uint adr_100 = adr_000 + 1;
26 uint adr_010 = adr_000 + stride.y;
27 uint adr_110 = adr_010 + 1;
28 velocity = gVelocityAndDensity[adr_000].xyz * ( a.x * a.y * a.z);
29 velocity += gVelocityAndDensity[adr_100].xyz * (ma.x * a.y * a.z);
30 velocity += gVelocityAndDensity[adr_010].xyz * ( a.x * ma.y * a.z);
31 velocity += gVelocityAndDensity[adr_110].xyz * (ma.x * ma.y * a.z);
32 velocity += gVelocityAndDensity[adr_000 + stride.z].xyz * ( a.x * a.y * ma.z);
33 velocity += gVelocityAndDensity[adr_100 + stride.z].xyz * (ma.x * a.y * ma.z);
34 velocity += gVelocityAndDensity[adr_010 + stride.z].xyz * ( a.x * ma.y * ma.z);
35 velocity += gVelocityAndDensity[adr_110 + stride.z].xyz * (ma.x * ma.y * ma.z);
38 ioVel.mVelocity +=
GradientSamplerSample(inMaterial.mGridVelocityFactor, inStrandFraction) * (velocity - ioVel.mVelocity);
51 float3 force = float3(
52 a.y * a.z * (dd000 - dd100)
53 + ma.y * a.z * (dd010 - dd110)
54 + a.y * ma.z * (dd001 - dd101)
55 + ma.y * ma.z * (dd011 - dd111),
57 a.x * a.z * (dd000 - dd010)
58 + ma.x * a.z * (dd100 - dd110)
59 + a.x * ma.z * (dd001 - dd011)
60 + ma.x * ma.z * (dd101 - dd111),
62 a.x * a.y * (dd000 - dd001)
63 + ma.x * a.y * (dd100 - dd101)
64 + a.x * ma.y * (dd010 - dd011)
65 + ma.x * ma.y * (dd110 - dd111));
67 ioVel.mVelocity += inMaterial.mGridDensityForceFactor * force * cDeltaTime;
72 JPH_HairVelocity vel = inVel;
75 vel.mVelocity += cSubStepGravity *
GradientSamplerSample(inMaterial.mGravityFactor, inStrandFraction);
78 vel.mVelocity *= inMaterial.mExpLinearDampingDeltaTime;
79 vel.mAngularVelocity *= inMaterial.mExpAngularDampingDeltaTime;
82 ioPos.mPosition += vel.mVelocity * cDeltaTime;
87 ioPos.mRotation = normalize(rotation + delta_rotation);
void GridPositionToIndexAndFraction(float3 inPosition, JPH_OUT(uint3) outIndex, JPH_OUT(float3) outFraction)
Definition HairCommon.h:45
void ApplyGrid(JPH_IN(JPH_HairPosition) inPos, JPH_IN_OUT(JPH_HairVelocity) ioVel, JPH_IN(JPH_HairMaterial) inMaterial, float inStrandFraction)
Definition HairIntegrate.h:10
void Integrate(JPH_IN_OUT(JPH_HairPosition) ioPos, JPH_IN(JPH_HairVelocity) inVel, JPH_IN(JPH_HairMaterial) inMaterial, float inStrandFraction)
Definition HairIntegrate.h:70