UE4 Runtime Mesh Component

Runtime Mesh组件2.0已发布,专为运行时生成的网格提供渲染和碰撞支持,适用于从Minecraft式的体素引擎到用户模型加载等各种场景。相比UE4中的Procedural Mesh Component,在内存使用和渲染效率上有显著提升。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://forums.unrealengine.com/showthread.php?113432-Runtime-Mesh-Component-Rendering-high-performance-runtime-generated-meshes!




Version 2.0 Released!

The RuntimeMeshComponent, or RMC for short, is a component designed specifically to support rendering and collision on meshes generated at runtime. This could be anything from voxel engines like Minecraft, to custom model viewers, or just supporting loading user models for things like modding. It has numerous different features to support most of the normal rendering needs of a game, as well as ability to support both static collision for things such as terrain, as well as dynamic collision for things that need to be able to move and bounce around!

Now, the RMC is very similar in purpose to the ProceduralMeshComponent or CustomMeshComponent currently found in UE4, but it far surpasses both in features, and efficiency! It on average uses half the memory of the ProceduralMeshComponent, while also being more efficient to render, and far faster to update mesh data. This is shown by the ability to update a 600k+ vertex mesh in real time! The RMC is also nearly 100% compatible with the ProceduralMeshComponent, while adding many features above what the PMC offers.


Current list of features in the RMC

  • Slicer Support!! You can now use the procedural mesh slicer.
  • Collision cooking speed improvements.** (new)
  • High precision normals support (new)
  • Tessellation support (new)
  • Navigation mesh support (new)
  • Fully configurable vertex structure (new)
  • Ability to save individual sections or the entire RMC to disk (new)
  • RMC <-> StaticMeshComponent conversions. SMC -> RMC at runtime or in editor. RMC -> SMC in editor. (new)
  • Normal/Tangent calculation. (new) (will be getting speed improvements soon)
  • Multiple UV channel support (up to 8 channels)
  • Fast path updates for meshes that need to update as fast as frame-by-frame
  • Static render path for meshes that don't update frequently, this provides a slightly faster rendering performance.
  • Collision only mesh sections.
  • 50%+ memory reduction over the ProceduralMeshComponent and CustomMeshComponent
  • Visibility and shadowing are configurable per section.
  • Separate vertex positions for cases of only needing to update the position.
  • Collision has lower overhead compared to ProceduralMeshComponent


** The RMC has picked up the collision cooking improvements done in UE4.14. This means that by default you'll see far faster collision updates, but at the cost of a little lower performance collision. You do however have the option to prioritize quality, which will slow down updates, but make actual collision detection a little faster

As a part of V2, there has also been some preliminary work done on threaded cooking. This can help to unblock the game thread from collision with large meshes. This is still a very new part, and not heavily tested or complete. To use this you'll have to use a source build of the engine. More information to come.


Some requested features that I'm looking into: (These aren't guaranteed to be added)

  • LOD (Potentially with dithering support)
  • Dithered transitions for mesh updates.
  • Mesh sharing, to allow multiple RMCs to have the same copy of the mesh to reduce memory overhead. This is much like how the StaticMeshComponent works.
  • Instancing support.
  • Multiple vertex buffer (In Addition to the current separate position vertex buffer)
  • Mesh replication


Supported Engine Versions:
v1.2 supports engine versions 4.10+
v2.0 supports engine versions 4.12+

The Runtime Mesh Component should support all UE4 platforms.
Collision MAY NOT be available on some platforms (HTML5, Mobile)

Tested Platforms:

Windows, HTML5 
(Also tested with HTC Vive, and Oculus Rift)


Downloads:
Version 2.0 (Without Slicer):  https://github.com/Koderz/UE4Runtime...eases/tag/v2.0
Version 2.0 (With Slicer):  https://github.com/Koderz/UnrealEngi...rmcslicer_v2.0 (You will need to be signed into github and be linked to your UE4 account to access this repo)
Github:  https://github.com/Koderz/UE4RuntimeMeshComponent

If you found the RuntimeMeshComponent to be useful to your project, and would like to contribute to its development, please consider a monetary donation! As a student, working on this in his free time, I would greatly appreciate any contribution! To make a donation, simply click the button below! Thank you for your support!

Name:  btn_donate_LG.gifViews: 169Size:  1.7 KB




Examples:
https://github.com/Koderz/UE4Runtime...ponentExamples

Documentation:
https://github.com/Koderz/UE4RuntimeMeshComponent/wiki

Issues/Help:
https://github.com/Koderz/UE4Runtime...mponent/issues


640k vertex animated mesh! (Not great quality gif)


Convex collision support for movable objects!


Same familiar API as PMC from Blueprints!


New Simpler to use API from C++! (Still supports the PMC style API as well!)
Last edited by Koderz; 11-28-2016 at  08:20 PMReason: v2.0 released!

<think>好的,我需要帮用户查找Unreal Engine中与形状(shape)相关的功能和用法。首先,我应该回忆一下UE中的核心模块和工具,比如组件、蓝图、物理系统等。形状在UE中通常用于碰撞检测、触发器、可视化调试等场景。 首先想到的是Shape组件,比如“Box Collision”和“Sphere Collision”,这些属于基本形状组件,用于物理模拟中的碰撞设置。用户可能在关卡设计或角色交互中使用这些组件。此外,Procedural Mesh Component可能也相关,因为它允许程序生成几何形状,引用中的Split ProceduralMeshComponent插件可能与之有关[^1]。 接下来,动画系统中的曲线驱动功能,引用提到可以直接驱动形变和材质曲线[^2],虽然主要涉及动画,但可能形状的变化(如变形)也会用到。另外,物理资产的调整可能涉及形状的修改,比如碰撞体的优化。 还要考虑编辑器中的形状工具,比如笔刷几何体(BSP)用于快速搭建关卡原型,不过BSP在现代UE中使用较少,更推荐使用静态网格体。另外,Landscape地形系统也可能涉及形状的塑造,但用户的问题可能更偏向基础形状组件。 物理碰撞设置中的形状简化,例如在静态网格体编辑器中调整碰撞复杂度,使用简单形状近似复杂模型,这影响性能和精确度。还有,导航网格体(NavMesh)的生成可能涉及体积(Volume)的形状,比如NavMesh Bounds Volume。 蓝图中的Shape Trace节点,如Sphere Trace或Box Trace,用于检测特定形状的区域内的碰撞,常用于武器攻击判定或互动检测。这些属于形状在游戏逻辑中的应用。 最后,考虑用户提到的引用内容,ProceduralMeshComponent的分拆可能影响运行时生成形状的方式,而曲线驱动和修复目标平台初始化也可能间接影响形状相关的功能表现[^2][^3]。 总结需要涵盖的方面:碰撞组件、Procedural Mesh、物理和碰撞设置、蓝图中的形状检测、编辑器工具、动画相关的形状变化。确保每个点都有对应的解释和可能的引用关联。</think>在Unreal Engine中,形状(Shape)相关的功能主要用于碰撞检测、物理交互、程序化生成和可视化调试等场景。以下是关键功能及用法解析: --- ### 1. **碰撞体形状组件** UE提供了多种基础形状组件用于物理碰撞: - **Box Collision**:立方体碰撞体,适用于门、墙壁等规则物体。 - **Sphere Collision**:球体碰撞体,适合角色或球形物体。 - **Capsule Collision**:胶囊体碰撞体,常用于角色移动组件(`CharacterMovementComponent`)的默认碰撞形状。 - **自定义凸包(Convex Hull)**:通过简化复杂网格生成近似碰撞体,优化性能。 **用法示例**:在静态网格体(Static Mesh)编辑器中,可为模型添加简化的碰撞形状以提升物理计算效率。 --- ### 2. **程序化几何生成(ProceduralMeshComponent)** 通过代码动态生成几何形状: - 支持创建三角形、四边形等基本图元。 - 引用相关更新:ProceduralMeshComponent插件被拆分为运行时(Runtime)和编辑器(Editor)模块,提高了灵活性和性能。 **应用场景**:地形生成、动态破坏效果或自定义几何工具。 ```cpp // C++示例:创建程序化网格 UProceduralMeshComponent* MeshComp = CreateDefaultSubobject<UProceduralMeshComponent>(TEXT("GeneratedMesh")); TArray<FVector> Vertices; TArray<int32> Triangles; // 添加顶点和三角形数据... MeshComp->CreateMeshSection(0, Vertices, Triangles, TArray<FVector>(), TArray<FVector2D>(), TArray<FColor>(), TArray<FProcMeshTangent>(), false); ``` --- ### 3. **物理与碰撞设置** - **复杂碰撞简化**:在静态网格体设置中,可将碰撞复杂度设为“Use Simple Collision”,仅用基础形状近似模型。 - **物理材质(Physical Material)**:定义形状表面的摩擦力、弹性等属性。 - **触发器(Trigger Volume)**:使用形状组件(如`Box Trigger`)检测物体进入/离开事件。 --- ### 4. **蓝图中的形状检测** 通过`Line Trace`或`Shape Trace`检测特定区域内的物体: - **Sphere Trace**:检测球体路径内的碰撞。 - **Box Trace**:检测立方体区域内的碰撞。 - **Overlap Events**:如`OnComponentBeginOverlap`,响应形状重叠事件。 **典型用途**:武器攻击范围判定、互动区域检测。 --- ### 5. **编辑器工具与调试** - **调试绘制**:在视口中显示碰撞形状(控制台命令`Show Collision`)。 - **体积(Volume)**:如`Kill ZVolume`(死亡区域)、`Physics Volume`,通过形状定义影响区域。 - **笔刷几何体(BSP)**:快速创建关卡原型(但通常建议替换为静态网格体以获得更好性能)。 --- ### 6. **动画与形变** - **形变目标(Morph Target)**:通过曲线直接驱动顶点位移,实现形状变化。 - **物理资产(Physics Asset)**:调整骨骼碰撞体的形状以匹配模型。 ---
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值