FEMFX 仿真流程之 FmTaskFuncStepVelocityRebuildBvh

FmTaskFuncStepVelocityRebuildBvhFEMFX/amd_femfx/src/Simulation/FEMFXSimulate.cpp 中定义,主要完成了仿真中(位置)速度的计算、bvh的更新等工作。

感觉该部分的主要内容为 FmTaskFuncTetMeshStepVelocityRebuildBvhFmTaskFuncRbStepVelocityRebuildBvh 两部分。


其中,FmTaskFuncTetMeshStepVelocityRebuildBvh 中的内容为软体的计算。

注:软体也区分软体对象是否为 KINEMATIC 对象。(KINEMATIC 对象意味着该对象的运动是由外界驱动的,也就是说,根据外界输入,直接设定该对象的运动状态、轨迹)

主要内容为:

FmStepVelocityImplicitEuler(scene, tetMesh, solverData, gravityVector, kRayleighMassDamping, kRayleighStiffnessDamping, tetMesh->extForceSpeedLimit, timestep, scene->params.epsilonCg);

FmBuildHierarchy(tetMesh, timestep, aabbPadding);

FmAddDeformationConstraints(tetMesh, constraintsBuffer, timestep);

具体为:
FmStepVelocityImplicitEuler 为求解步骤:

// Take a simulation step using current dynamic state, external forces, constraints set in tetMeshState.
// Also resets vertex flag FM_VERT_FLAG_FRACTURED and tetQuatSum

FmBuildHierarchy 为建立等级:

// For CCD, must build after integration computes new velocities.

FmAddDeformationConstraints 为添加形变约束:

// Add constraints to prevent excessive deformation.
// Expects that unconstrained end-of-step velocities have been updated.
// There are up to three constraints per tetrahedron, and using the same 3D constraints and 3x3 Jacobian submatrices as for contacts and glue.
// This allows some benefit from SIMD but wastes space when fewer dimensions are needed.
// Reference: Perez et al., "Strain Limiting for Soft Finger Contact Simulation"

具体的内容,还要进一步分析。


另外,FmTaskFuncRbStepVelocityRebuildBvh 中基本就是计算刚体在无约束(重力作用)下的运动,计算速度、位置之类的,顺便把碰撞对象 aabb 等更新一下。

原文地址:https://www.cnblogs.com/wghou09/p/12699520.html