Danta1ion
Danta1ion
发布于 2024-06-20 / 34 阅读
0
0

Chaos Destruction 101

如何表现破坏效果

  • 主体碎块:
    • Geometry Collection: Rigid Body Simulation, Network Replication, ...
  • 次级元素:
    • 细小碎块 Geometry Collection Small Particles;
    • 贴图特效烟尘 Sprite Niagara;
    • 物理流体烟尘 Niagara Fluid;
    • 材质贴花 Decal, Damage Material, World Position Offset, Nanite Tessellation ...

主体碎块美术表现

如何切割?

体现出不同的材质:

  • 石头:Uniform/Cluster 后预留 grout,然后对grout再次uniform;
  • 木头:先沿着纹理方向挤压 scale, uniform 后再复原;
  • 玻璃:多次slice;

断面细节:

  • Auto UV,烘焙材质;
  • 烘焙模型信息:厚度,曲率,法线;
  • embed 挂载仅用于渲染的细节模型;

虚幻引擎项目设置

![[Chaos Destruction 101.png]]

勾选这三个设置允许全局的事件。

在 Niagara 中通过 Chaos Destruction Data Interface 接受来自物理系统的事件:

  • Spawn from Chaos
  • Apply Chaos Data
  • 继承 Velocity 和 Location

Niagara 生成 Material Mask

![[Chaos Destruction 101-1.png]]

在 Niagara Graph 中通过GPU将 mask 传递到材质实例的 mask 中作为参数,控制模型的贴图细节。

或者通过在 DCC 中预先处理变形后的模型,并把顶点 offset 存储到顶点着色中,在 runtime 通过 Niagara 控制并读取。

![[Chaos Destruction 101-2.png]]

Physics Constraint

引擎默认的物理约束更加复杂,有六个方向的自由量,以及位置,速度,角速度,阻尼等等的约束。Chaos Destruction 的这个约束更加轻量简单,比较接近 Houdini 的 Glue 类型约束,只计算其他物体在对应位置的冲量是否超过 Damage Threshold。

Cluster and Convex

Cluster 化以减少 activated body

将碎块进行 cluster 化是控制效果和控制性能的关键。可以在 Fracture Mode 中对选择的碎块进行自动cluster或者手动 cluster,以合并形成大块。

此外,cluster还可以用于制作宣传片。在离线渲染的宣传片中可以使用最高级别的 cluster,而游戏中在 Geometry Collection Component 中限制 MaxClusterLevel。此项可能也可以根据游戏中角色与物体之间的距离进行动态设置,在角色距离建筑较远时减少 cluster level 以获得更大规模的破坏效果。

调优 Convex 以增强单次碰撞的性能

这些在 Fracture Mode 中都可以设置。

![[Chaos Destruction 101-3.png]]

注意碰撞代理的性能开销:Sphere < Capsule < Box < Convex。

这些可以在 Geometry Collection 的 Details 界面设置。

![[Chaos Destruction 101-4.png]]

Sleep and Disable Field

可以让物体在到达地面时停止物理状态的更新,提高性能。

可能是用到了 UFieldSystemComponent::ApplyRadialForce 这个函数。

Debug

# Enable activated rigid body debug draw (collision)
p.Chaos.DebugDraw.Enabled 1
p.Chaos.Solver.DebugDrawShapes 1

# Show Cluster Connection Type, Damage Model and Constraint
p.Chaos.Solver.DebugDraw.Cluster.Constraints 1

# Show Chaos clusters, activated bodies count, num contacts count, ...
stat ChaosCounters

Niagara

[[Chaos with Niagara]]
[[www.baidu.com]]

Fracturing

If the Static Mesh before fracturing is uniformed, you should ensure there is no single edge or face in it. Broken holes should not appear additionally.

If the Static Meshes are grouped and procedurally generated by blueprint, first you should convert all of them to Static Mesh Component directly under Actor's root. That is you can directly see these items in the outliner of actor.

Then, as mentioned above, there should not have any broken holes and unconnected faces and edges.

While fracturing, use planar mode firstly to separate the ceiling and the others. Otherwise the generated convex collision maybe error since convex can appear in the middle of air.

Then you should cut the edge of doors and windows. You can either perform horizonal or vertical.

Reference


评论