I’ll look into that issue hopefully tomorrow. For now I have a surprise for everyone… stay tuned!
RMC V2.0 progress!
Ok, this has been a long time coming, and every time I tried to set myself a date to have it done I would get slammed with another ‘fun’ time consuming project or problem, but I’m finally actually making real progress on the RMC again!
So… The original list of things I wanted for V2.0…
Version 2 Upcoming features! (List subject to change)
- Normal/Tangent Calculation (Like the PMC’s current helper, but hopefully faster)
- RMC <-> StaticMeshComponent conversions. SMC -> RMC both in editor and runtime and RMC -> SMC in editor
- Tessellation support
- World origin shifting for infrequently updated sections (fixed already in github)
- Hi-Precision Normals
- Collision cooking speed improvements*
Well I can finally say that almost all of that is done, and was pushed to github just before this post! As a qualification to that! This means that master branch of github is potentially unstable as I have not gone through and tested all of the new things as well as I want too, but decided I’d let some others at least try it and I’ll try to fix everything that comes up as fast as possible!
I DO NOT RECOMMEND GITHUB MASTER FOR REAL PROJECTS!!
I would however like any feedback I can get about any issues encountered, and will attempt to fix them as they arise.
Now, for more detail about what the current state is:
- Normal/Tangent Calculation should be ported and up and working. This version does not have my speed improved version, so it’s still very slow for large meshes. This I hope to get too soon after a few other things are finished.
- Tessellation support is done! This means you can now use PN-Triangles and other tessellation on all platforms that support it provided that you either use the utility to calculate the adjacency information, or tell the RMC to calculate it internally when you Create/Update a section. This information will also be copied in a SMC->RMC conversion. (More details below)
- Mesh Builder is operational, however not anywhere near finished and I’m not satisfied with its current design. (Feel free to pitch ideas if you have them)
- Hi-Precision normals are supported throughout. This means like the SMC you can have higher fidelity normals/tangents on your meshes. These will also be copied correctly from a StaticMeshComponent.
- SMC <->RMC conversions are done! This means you can convert a StaticMeshComponent to a RuntimeMeshComponent both in editor and at runtime. You can also convert a RMC to a SMC in editor as long as it’s engine version 4.13+
- Several bug fixes including world origin shifting, a shadowing bug, and a couple serialization issues.
- Nav meshes now work correctly! By this I mean that nav meshes should always update correctly on any change. Until now both the RMC and PMC have required hacky workarounds to get this to work like moving the object to trigger a rebuild. Now it will automatically trigger a rebuild when it’s needed! (More details below)
Nav Meshes!!!
Tessellation!!!
**Now the one major feature left for v2 that isn’t in this list is the collision overhaul. I am sort of starting over with that due to several things, including the upgrade UE did to 3.4 as well as just a better understanding of what needs to happen. I’m going to refrain from giving a estimate as to when it will be done, as that hasn’t worked well for me recently! Other than bug fixes which will take priority, this is the next thing I want to finish so hopefully it will get done pretty quick. I still expect it to have a dramatic impact on performance of projects with collision as I’m still going after complete threaded cooking to unblock the game thread and speed up cooking overall.
Now, I won’t be surprised if there’s incompatibilities with older engine versions. This has only ever been vaguely tested against 4.14/master(4.15) so you have been warned about using it! I will try to test everything on 4.10-4.15 over the next day or two as I test the various new parts and update docs/examples to show these new things. If you’re willing to test a likely highly unstable version, feel free and let me know what breaks! I will post here again when it’s more ready for real use.**
Feel free to message me on discord if you have questions/comments/bug reports!
Registering the component did the trick! I’m sure I’ve never had to do that with components before.
@ That is an impressive update. Really excited to get my hands on this. I’ll try and figure out how to compile the plugin from GitHub so I can at least help with testing.
From your little navmesh gif animation, does that mean the bug I was having with it not affecting navmeshs is now fixed in v2.0?
It depends where you are adding the component. My understanding is that if you are doing it in the constructor, then you can skip registration as it happens automatically. However if you are adding the component at some other place, like OnConstruction, BeginPlay or Tick for example, then you need to register the component manually.
I haven’t updated these docs much in quite a while. I need to do that once v2 is finalized but this should be a decent starting point to getting setup from github. https://github.com//UE4RuntimeMeshComponent/wiki/Installing-the-RMC-from-GitHub
In theory all navigation bugs are now fixed. I’ve never really used the navigation system yet so I’m limited on my testing but it appears the navmesh updates correctly on all updates! If it doesn’t, let me know as I want this to work as well as possible.
It will be a while before all of this makes it to the marketplace as there’s a few things that need to be finished, including collision, and also some serious testing needs to be done so it will likely be a few weeks at least before this makes it to the MP. The more people that can test over the next few days to a week the better. I should be around to fix them as they come up, as I’m building a brand new example project right now to test everything and show how everything works.
@KoderzI figured out how to get the plugin installed and compiled into my project by poking through the UE4 docs.
The navmesh issue I was having with it not updating seems to be fixed. The navmesh now updates every time without any problems. Was really exciting to see my AI actually walk around the objects instead of through them! However, I did have to delete the navmesh and recreate it for it to start working, but not a big deal.
The issue with it not rendering with a translucent material still remains however. I have put together some information to help reproduce the problem.
Firstly I created a new C++ actor called MyActor, added the following code to it, and compiled.
MyActor.h
#pragma once
#include "RuntimeMeshComponent.h"
#include "MyActor.generated.h"
UCLASS()
class BLOCKHOSPITAL_API AMyActor : public AActor
{
GENERATED_BODY()
public:
AMyActor();
virtual void BeginPlay() override;
virtual void Tick(float DeltaSeconds) override;
UFUNCTION(BlueprintCallable, Category = "Default")
void UpdateMesh();
UPROPERTY(BlueprintReadOnly, Meta = (ExposeOnSpawn = true))
UMaterialInterface* MeshMaterial;
URuntimeMeshComponent* RuntimeMesh;
float Size;
};
MyActor.cpp
#include "MyProject.h"
#include "MyActor.h"
#include "RuntimeMeshLibrary.h"
AMyActor::AMyActor()
{
PrimaryActorTick.bCanEverTick = true;
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("DefaultSceneRoot"));
Size = 10.0f;
}
void AMyActor::BeginPlay()
{
Super::BeginPlay();
RuntimeMesh = NewObject<URuntimeMeshComponent>(this);
RuntimeMesh->SetupAttachment(RootComponent);
RuntimeMesh->SetMaterial(0, MeshMaterial);
RuntimeMesh->RegisterComponent();
}
void AMyActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
Size += DeltaTime * 2.0f;
}
void AMyActor::UpdateMesh()
{
FVector BoxRadius(Size, 100.0f, 100.0f);
TArray<FVector> Vertices;
TArray<int32> Triangles;
TArray<FVector> Normals;
TArray<FVector2D> UVs;
TArray<FColor> Colors;
TArray<FRuntimeMeshTangent> Tangents;
URuntimeMeshLibrary::CreateBoxMesh(BoxRadius, Vertices, Triangles, Normals, UVs, Tangents);
for (int32 i = 0; i < Vertices.Num(); ++i)
Colors.Add(FColor::White);
RuntimeMesh->CreateMeshSection(0, Vertices, Triangles, Normals, UVs, Colors, Tangents, true);
}
Then I created a material in the editor called NewMaterial and set it up like this.
Finally I created a PlayerController in the editor and added the following to its blueprint.
Now I run the project in the editor and turn on the navmesh rendering using the “show Navigation” console command. Then when I press the space bar, this is what I get.
So you can clearly see that a mesh is being generated, added to the runtime mesh and affects the navmesh. However it just doesn’t render.
Now if I go back to the material and change its Blend Mode to Opaque, then It renders fine.
Also, if I change the code over in MyActor to use a UProceduralMeshComponent instead of a URuntimeMeshComponent then it also works fine. So it must be an issue with RMC and translucent materials.
@ Any luck reproducing the bug with translucency?
I really love you to make this awesome package!!
This makes my whole problems easier.
By the way, is the market-place uploaded content version 1.2??
Yes it is. v2.0 is still in the works but hopefully it is ready for the marketplace soon. You can test with v2.0 by following the instructions on GitHub to add it to your project. It might have bugs though.
I was successful in reproducing it, but haven’t been able to find the cause yet.
@alleysark version 1.2 (the marketplace version and current release) doesn’t have these parts yet. I hope to get v2 finished up here pretty quick, as it’s mostly bugs left, then I’ll update the marketplace.
That’s good. I was worried it was just me! So hope you can find a fix for it as that bug is driving me crazy. I tried to have a look through the code myself to see if I could work out a fix, but unfortunately, I just couldn’t grasp the architecture of it all enough to know where to look.
Hi ,
Is it possible to bake lighting for meshes generated using your plugin? Thanks!
Yeah, sorry about not getting back to you. I had this fix locally for a couple days waiting on bigger push of updates but I decided to go ahead and push this one to github. So it should be fixed now using the github master branch.
It depends on what you’re asking. If you mean at runtime, no as that requires editor only code. If you mean in the editor, I’m not really sure as I haven’t really investigated it, but I would think it would work.
Can this component be used with splines? In space of the spline mesh component? I’d like to smooth/edit vertices of my spline’s corners…
Does this component support skeletal meshes or just static meshes?
Splines are not something it natively supports, but depending on what you’re wanting you could mimic the behavior by creating large meshes out of the repeated smaller ones with the spline. I’ve never attempted it, or used the spline mesh component so that’s just a guess. Basically you can create the mesh however you want, but it’s up to you to create it. The RMC is just meant to efficiently draw them and provide other core features like collision.
Skeletal meshes are something I’ve thought about, but haven’t decided whether I want to pursue it as they’re quite a bit more complicated than static meshes. The answer for the foreseeable future is it’s just meant for static meshes.
That is great news. Thanks for all your effort. I did use the GitHub version for a while, but I found that it slowed my project compile times down way too much, so I’ll just wait for the binary release on the marketplace. Cheers.
Thanks for this amazing plugin. It allows us to do stuff that would not have been possible with PMC. Very nice is the second UV channel.
Yeah, I hate the part that it requires compiling, but I just came across the “Package” option for a plugin so if that does what I assume it does then when I release the next version on github here soon I’ll package it so it should solve much of this problem. The github version is very far ahead of marketplace right now.
You’re welcome! Also, just to let you know it will support far more than 2 UV channels, those are just predefined vertex formats. The github version, which will be v2 soon, can support quite a few configurations, and up to 8 uv channels with the builtin vertex. I will be updating the example project and docs over this next week.
Thanks, but will wait for the Marketplace update.
having issue with using VertexColor of RMC.
The material applied is as simple as it can be. Using a Material with a fixed color, everything is fine. Using a Material that shows VertexColor, the RMC color differs.
Shadows are disabled to get rid of shadowing difference.
The Sphere is default static mesh from Unreal. The line is the RMC-Mesh.
Here is what I got with fixed color:
Using VertexColors. Material and colors are the same. Sphere does show the color wanted.
The mesh is build via Blueprint CreateMeshSection/UpdateMeshSection.