Closed redsigma closed 9 months ago
I use the plugin in unreal 5.3.2 without any issues
using it as well for 5.3.2 without issue.
Hey @redsigma What errors are you getting? This definitely works for 5.0.0 - 5.3.2, and it's working locally for me for 5.4 (Current master)
Are you trying to use the last release, or master?
@Koderz I am sorry, I havent updated to 5.1 release version. I was still using the 5.0.5 version of this plugin.
I can confirm the plugin compiles properly now with the 5.1 release
However now that I updated, it broke a section of my code and I am not sure how I can replace it because the official documentation from the below site seems to point to missing functions https://runtimemesh.koderz.io/usage.html
The functions are CreateMeshSection
and UpdateSectionMesh
which seem to not be available anymore.
I checked this file as it mentions some redirectors for the CreateMeshSection
but that function doesnt seem to be available either
https://github.com/TriAxis-Games/RealtimeMeshComponent/blob/v5.1.0/Config/DefaultRealtimeMeshComponent.ini
Below is the code that I was using with version 5.0.5 and it was working.
FRealtimeMeshSimpleMeshData MeshSimpleData;
MeshSimpleData.Triangles = MeshData.RawTriangles;
MeshSimpleData.Positions = MeshData.RawVertices;
MeshSimpleData.Normals = MeshData.RawNormals;
MeshSimpleData.Tangents = MeshData.RawTangents;
MeshSimpleData.UV0 = MeshData.RawChannelUV0;
const auto& MeshPart = NewObject<URealtimeMeshSimple>(ActorOwner);
constexpr auto ShouldCreateCollision = false;
FRealtimeMeshSectionKey StaticSectionKey = MeshPart->CreateMeshSection(
0,
FRealtimeMeshSectionConfig(ERealtimeMeshSectionDrawType::Static, 0),
MeshSimpleData,
ShouldCreateCollision
);
MeshPart->UpdateSectionMesh(StaticSectionKey, MeshSimpleData);
I looked a bit in the code and there is a function called CreateSectionGroupFromSimple
which seems to have a similar signature like CreateMeshSection
but it uses a FRealtimeMeshStreamRange
instead of the FRealtimeMeshSimpleMeshData
that is shown on the website documentation.
Could you give me an example on how to use the URealtimeMeshSimple ? Or at least if you can point me to the commit that made these functions changes.
@Koderz I am sorry, I havent updated to 5.1 release version. I was still using the 5.0.5 version of this plugin.
I can confirm the plugin compiles properly now with the 5.1 release
However now that I updated, it broke a section of my code and I am not sure how I can replace it because the official documentation from the below site seems to point to missing functions https://runtimemesh.koderz.io/usage.html
The functions are
CreateMeshSection
andUpdateSectionMesh
which seem to not be available anymore.I checked this file as it mentions some redirectors for the
CreateMeshSection
but that function doesnt seem to be available either https://github.com/TriAxis-Games/RealtimeMeshComponent/blob/v5.1.0/Config/DefaultRealtimeMeshComponent.iniBelow is the code that I was using with version 5.0.5 and it was working.
FRealtimeMeshSimpleMeshData MeshSimpleData; MeshSimpleData.Triangles = MeshData.RawTriangles; MeshSimpleData.Positions = MeshData.RawVertices; MeshSimpleData.Normals = MeshData.RawNormals; MeshSimpleData.Tangents = MeshData.RawTangents; MeshSimpleData.UV0 = MeshData.RawChannelUV0; const auto& MeshPart = NewObject<URealtimeMeshSimple>(ActorOwner); constexpr auto ShouldCreateCollision = false; FRealtimeMeshSectionKey StaticSectionKey = MeshPart->CreateMeshSection( 0, FRealtimeMeshSectionConfig(ERealtimeMeshSectionDrawType::Static, 0), MeshSimpleData, ShouldCreateCollision ); MeshPart->UpdateSectionMesh(StaticSectionKey, MeshSimpleData);
I looked a bit in the code and there is a function called
CreateSectionGroupFromSimple
which seems to have a similar signature likeCreateMeshSection
but it uses aFRealtimeMeshStreamRange
instead of theFRealtimeMeshSimpleMeshData
that is shown on the website documentation.Could you give me an example on how to use the URealtimeMeshSimple ? Or at least if you can point me to the commit that made these functions changes.
Look into "YourProject\Plugins\RealtimeMeshComponent\Source\RealtimeMeshTests\Private\FunctionalTests\RealtimeMeshBasicUsageActor.cpp" for a example how this component works. Also took me few days to find out that there is a example.
Thank you @FynniX . I kinda got something to work but it's not fully functional. I'll close this issue and come back with a reply after I found a working alternative.
Also changed the title so it's more precise to the issue I have.
UPDATE:
This is the new version that is working but there is a big caveat that it crashes the game sometimes. I Posted at the bottom more context
for (const auto& MeshData : MeshParts)
{
FRealtimeMeshSimpleMeshData MeshSimpleData;
MeshSimpleData.Triangles = MeshData.RawTriangles;
MeshSimpleData.Positions = MeshData.RawVertices;
MeshSimpleData.Normals = MeshData.RawNormals;
MeshSimpleData.Tangents = MeshData.RawTangents;
MeshSimpleData.UV0 = MeshData.RawChannelUV0;
const auto& NumIndices = MeshData.RawIndices.Num();
const auto& NumVertices = MeshData.RawVertices.Num();
const auto& MeshPart = NewObject<URealtimeMeshSimple>(ActorOwner);
FRealtimeMeshSectionGroupKey GroupKey = FRealtimeMeshSectionGroupKey::CreateUnique(0);
MeshPart->CreateSectionGroup(GroupKey, MeshSimpleData);
FRealtimeMeshSectionKey SectionGroup = FRealtimeMeshSectionKey::CreateUnique(GroupKey);
MeshPart->CreateSection(
SectionGroup,
FRealtimeMeshSectionConfig(ERealtimeMeshSectionDrawType::Static, 0),
FRealtimeMeshStreamRange(0, NumVertices, 0, NumIndices),
false
);
const auto& MeshComponent = NewObject<URealtimeMeshComponent>(ActorOwner);
MeshComponent->SetRelativeTransform(MeshTransform);
MeshComponent->SetRealtimeMesh(MeshPart);
MeshComponent->AttachToComponent(CustomParentAttachment, FAttachmentTransformRules::KeepRelativeTransform);
MeshComponent->RegisterComponent();
The caveat is that this plugin (at least from what I have checked), doesnt seem to be safe to create URealtimeMeshSimple
meshes in a for
loop, for example if you plan to use it for importing a lot of parts that form a bigger mesh.
I posted the image to the crash below and it happens when calling NewObject<URealtimeMeshSimple>(ActorOwner);
All the code from above is called only in the GameThread.
@Koderz Could you tell me if my assumptions above are true or is there a way to explicitly handle that locking ? Or maybe is there a way to avoid that crash from happening ?
Hey @redsigma ,
This should have been fixed for a little while now, there was an issue with the internal locking mechanisms that could end up using too much thread local storage.
-Chris
It seems some of the RHI commands got changed and now the plugin throws a lot of compile errors.
Will this plugin be updated for Unreal 5.3.2 ?