UE4 Runtime Mesh Component

1623 篇文章 23 订阅
1277 篇文章 12 订阅

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!

UE4 中设置 Procedural Mesh 的颜色,同样可以使用 Material。但是在 UE4 中,我们一般使用 Material Instance(材质实例)来设置 Procedural Mesh 的颜色,这样可以方便地在游戏中动态地修改颜色。 下面是一个使用 Material Instance 设置 Procedural Mesh 颜色的示例: 1. 创建一个 Material,设置其颜色为红色。 2. 创建一个 Material Instance,并将其 Parent(父级)设置为上一步创建的 Material。 3. 在 Material Instance 中修改颜色为你想要的颜色。 4. 在代码中获取 Material Instance,并将其赋值给 Procedural MeshMeshComponent。 下面是示例代码: ```c++ // 获取 Material Instance UMaterialInstance* MaterialInstance = LoadObject<UMaterialInstance>(nullptr, TEXT("MaterialInstance'/Game/Materials/RedMaterialInstance.RedMaterialInstance'")); // 获取 Procedural MeshMeshComponent UProceduralMeshComponent* ProceduralMeshComponent = GetProceduralMeshComponent(); // 将 Material Instance 赋值给 MeshComponent ProceduralMeshComponent->SetMaterial(0, MaterialInstance); ``` 在这个示例中,我们首先通过 LoadObject 函数获取了一个 Material Instance,然后获取了 Procedural MeshMeshComponent,并将 Material Instance 赋值给了 MeshComponent。 需要注意的是,在 UE4 中,Procedural Mesh 的 Material Index 默认是 0,因此我们使用 SetMaterial 函数将 Material Instance 赋值给了 Index 为 0 的 Material。如果你的 Procedural Mesh 中有多个 Material,则需要指定不同的 Material Index。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值