UE5《Electric Dreams》项目PCG技术解析 之 PCGCustomNodes详解(四)ApplyHierarchy

2023-10-29

继续解析《Electric Dreams》项目中的自定义节点和子图:ApplyHierarchy

在这里插入图片描述

前导文章

《UE5《Electric Dreams》项目PCG技术解析 之 理解Assembly(以SplineExample为例)》
《虚幻引擎程序化资源生成框架PCG 之 UPCGBlueprintElement源码笔记(一)》
《虚幻引擎程序化资源生成框架PCG 之 UPCGBlueprintElement源码笔记(二)数据流》
《UE5《Electric Dreams》项目PCG技术解析 之 PCGCustomNodes详解(一)》
《UE5《Electric Dreams》项目PCG技术解析 之 PCGCustomNodes详解(二)Look At》
《UE5《Electric Dreams》项目PCG技术解析 之 PCGCustomNodes详解(三)SG_CopyPointsWithHierarchy》

标准组合拳

在这里插入图片描述

上一篇博文《UE5《Electric Dreams》项目PCG技术解析 之 PCGCustomNodes详解(三)SG_CopyPointsWithHierarchy》,我们分析了这套组合拳中SG_CopyPointsWithHierarchy的工作原理,简单来说:

  1. SG_CopyPointsWithHierarchy其实就是携带source中层级信息和相对Transform的高级版CopyPoints。
  2. 它需要和"PCGSettings"一起工作(需要"PCGSettings"中原始ActorIndexParentIndex信息)。
  3. 一般要和本文中介绍的ApplyHierarchy一起使用构成组合拳。

ApplyHierarchy

在使用ApplyHierarchy之前,点云里存在一个由Actor IndexParent Index索引构成的树形结构,而Relative Transform则代表着每个层级子级Point和父级Point之间的"相对变换"。ApplyHierarchy的作用就是将这个树形结构中一层层的Relative Transform应用到每个PointPositionRotationScale属性(Property)上。

Execute with Context

在这里插入图片描述以上部分(包含Iteration Loop)的作用就是构造2个数组IdsHierarchy Depths

  • Ids 数组:数组的Index对应PointIndex;数组的Value对应Actor Index,这样通过Actor IndexParent Index就可以反向找到实际的Index
  • Hierarchy Depths数组:和上面的逻辑类似,建立PointIndexHierarchy Depth一一对应关系。

在这里插入图片描述
逐层(Depth)将Relative Transform转换成PointPositionRotationScale属性(Property)上,逻辑有点像“俄罗斯方块”。

Iteration Loop Body

在这里插入图片描述

Point Loop Body

通过Actor IndexParent Index反向找到实际的Index
在这里插入图片描述
将该层(Depth)的Relative Transform转换成PointPositionRotationScale
在这里插入图片描述
删除无效的Point

在这里插入图片描述

应用场景

注意:在“组合拳”中使用Transform Points变换的对象为Relative Transform

在这里插入图片描述

小结

SG_CopyPointsWithHierarchy构造了一个虚拟的"树形结构",而ApplyHierarchy是将"树形结构"和层级之间的Relative Transform应用到PointPositionRotationScale属性上。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

UE5《Electric Dreams》项目PCG技术解析 之 PCGCustomNodes详解(四)ApplyHierarchy 的相关文章

随机推荐