Announcement

Collapse
No announcement yet.

Runtime Mesh Component

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Originally posted by Tomza View Post
    Hi Koderz,

    i have downloaded your project and I can't run.

    RMC_Examples could not be compiled. Try rebuilding from source manually.
    Hey, I just updated the Examples to UE4.13 and RMC v2.0. This is just for a temporary solution until I get the new examples project done. You can find that here: https://github.com/Koderz/UE4Runtime...eases/tag/v2.0





    Originally posted by housekiller View Post
    So not available/legal in built application?



    It's meant to run on local network only for now so size is practically no problem, for now I'll share the files between server & clients, import on both and replicate the transforms with necesary logic checks as a quick fix.
    Interesting ideas for voxel based meshes, I'm planning a project on the side where this will be relevant.



    For now I made a simple box hull which is enough for my current project, might make something more complex as the need arises.

    Unfortunately, creating a static mesh component requires some editor only modules that can't be linked into a package game. Out of curiosity, why is it you're wanting to convert them to a static mesh? What files are you talkinga bout sharing between the server/client? If you really don't care about bandwidth, probably the easiest way is to stay within the RMC and use the SerializeRMC() or SerializeRMCSection() functions. With those you setup an FArchive to either load or save and just call that function (it loads/saves based on what the FArchive is setup to do) So you could probably just to a memory archive, serialize it to that, send the data across and feed the archive back into the RMC on the other side. It's not going to be light on bandwidth but within a LAN you're probably OK.

    Leave a comment:


  • replied
    Originally posted by Koderz View Post
    Thanks for the donation!

    You can convert to a static mesh by selecting the RMC in editor and finding "Convert to Static Mesh" in the details panel. This will only work in editor.
    So not available/legal in built application?

    Originally posted by Koderz View Post
    It's been a while since I've put much thought into replication, but you can't do conversion to static mesh at runtime, and even then the SMC does support replicating the mesh either. I've had a few thoughts on how to do it, but I've not really dug into it as you're talking replicating potentially MB's of mesh data and it usually ends up being better for the app to do it's own replication. In the case of voxel, it's easier to replicate the voxel data and regenerate the mesh on the client for example. Other projects have similar ways to more efficiently get the needed parts to client/server than straight mesh replication.
    It's meant to run on local network only for now so size is practically no problem, for now I'll share the files between server & clients, import on both and replicate the transforms with necesary logic checks as a quick fix.
    Interesting ideas for voxel based meshes, I'm planning a project on the side where this will be relevant.

    Originally posted by Koderz View Post
    From your edits it appears you found the problem to movable objects. Basically PhysX (the underlying physics engine) doesn't support dynamic moving triangle meshes. They work well for static objects, but for dynamic you have to use an approximation of the object through some combination of convex hulls, cubes, spheres, and capsules. Currently the RMC only supports convex hulls but that will be changed in the future. I'm investigating ways to generate this at runtime, but there isn't an easy solution to this.
    For now I made a simple box hull which is enough for my current project, might make something more complex as the need arises.

    Leave a comment:


  • replied
    Hi Koderz,

    i have downloaded your project and I can't run.

    RMC_Examples could not be compiled. Try rebuilding from source manually.

    Leave a comment:


  • replied
    Originally posted by housekiller View Post
    I'm generating normals with assimp but it doesn't change much in execution speed, I also have collision enabled but would like to leave that on and doesn't make much of a change in speed either. Later on I'll be working with bigger models so I'm looking into doing the conversion to another thread.

    I have a couple of questions though about other stuff;
    -How can I convert to a normal static mesh if possible? Does it create a .uasset file? (so it doesn't need to be imported every time)
    -How are you thinking to handle replication over network? (via conversion to static mesh and copying the asset to clients or something?)

    -I'm having trouble to create physics enabled objects, I use the following code to create an object that should have a lot of 'drag' but it moves at constant speed when receiving a push.

    Code:
    RuntimeMesh->CreateMeshSection(0, vertices, triangles, normals, texMap, vertexColors, tangents, true, EUpdateFrequency::Infrequent);
    
    	RuntimeMesh->SetMaterial(0, MeshMaterial);
    	RuntimeMesh->SetMobility(EComponentMobility::Movable);
    	RuntimeMesh->SetLinearDamping(100.f);
    	RuntimeMesh->SetAngularDamping(100.f);
    	RuntimeMesh->SetSimulatePhysics(true);
    	RuntimeMesh->SetEnableGravity(false);
    	RuntimeMesh->SetLockedAxis(EDOFMode::XYPlane);
    SetLinearDamping(100.f) and SetAngularDamping(100.f) are correctly set on the mesh but it seems to be ignored.

    I donated around 10 bucks, happy to support

    EDIT:
    It works when disabling bUseComplexAsSimpleCollision, is it possible/legal to make the engine calculate a convex hull at runtime? (I'll probably write my own algorithm anyway but would be handy for now).

    EDIT2:
    I cleaned up some debugging which decreased the duration a 10-fold.

    Thanks for the donation!

    You can convert to a static mesh by selecting the RMC in editor and finding "Convert to Static Mesh" in the details panel. This will only work in editor.

    It's been a while since I've put much thought into replication, but you can't do conversion to static mesh at runtime, and even then the SMC does support replicating the mesh either. I've had a few thoughts on how to do it, but I've not really dug into it as you're talking replicating potentially MB's of mesh data and it usually ends up being better for the app to do it's own replication. In the case of voxel, it's easier to replicate the voxel data and regenerate the mesh on the client for example. Other projects have similar ways to more efficiently get the needed parts to client/server than straight mesh replication.

    From your edits it appears you found the problem to movable objects. Basically PhysX (the underlying physics engine) doesn't support dynamic moving triangle meshes. They work well for static objects, but for dynamic you have to use an approximation of the object through some combination of convex hulls, cubes, spheres, and capsules. Currently the RMC only supports convex hulls but that will be changed in the future. I'm investigating ways to generate this at runtime, but there isn't an easy solution to this.

    Leave a comment:


  • replied
    Hi!
    I've some problems with the "URuntimeMeshLibrary::CalculateTangentsForMesh" function...

    I have each variables declared as below:

    TArray<int32> Triangles;
    TArray<FVector2D> UV0;
    TArray<FVector> Normals;
    TArray<FRuntimeMeshTangent> Tangents;
    TArray<FColor> VertexColors;

    // code to fill the arrays

    URuntimeMeshLibrary::CalculateTangentsForMesh(Vertices, Triangles,UV0, Normals, Tangents);

    when I call the method to calculate tangents and normals the engine chash, and I get this error.

    Assertion failed: UV1s && UV1s->Num() > CurrentPosition [File:d:\build\++portal+main+full\sync\localbuilds\plugintemp\hostproject\plugins\runtimemeshcomponent\source\runtimemeshcomponent\public\RuntimeMeshBuilder.h] [Line: 786]



    KERNELBASE
    UE4Editor_Core
    UE4Editor_Core
    UE4Editor_Core
    UE4Editor_RuntimeMeshComponent!FRuntimeMeshComponentVerticesBuilder::GetUV() [d:\build\++portal+main+full\sync\localbuilds\plugintemp\hostproject\plugins\runtimemeshcomponent\source\runtimemeshcomponent\public\runtimemeshbuilder.h:787]
    UE4Editor_RuntimeMeshComponent!URuntimeMeshLibrary::CalculateTangentsForMesh() [d:\build\++portal+main+full\sync\localbuilds\plugintemp\hostproject\plugins\runtimemeshcomponent\source\runtimemeshcomponent\private\runtimemeshlibrary.cpp:243]
    UE4Editor_RuntimeMeshComponent!URuntimeMeshLibrary::CalculateTangentsForMesh() [d:\build\++portal+main+full\sync\localbuilds\plugintemp\hostproject\plugins\runtimemeshcomponent\source\runtimemeshcomponent\private\runtimemeshlibrary.cpp:328]
    UE4Editor_Mockingbird_9502!ASimpleTerrainGeneration::GenerateMesh() [c:\agus\projects\tesis\prototipo\mockingbird\source\mockingbird\private\terraingenerators\simpleterraingeneration.cpp:139]
    UE4Editor_Engine
    UE4Editor_Engine
    UE4Editor_Engine
    UE4Editor_Engine
    UE4Editor_Engine
    UE4Editor_Engine
    UE4Editor_UnrealEd
    UE4Editor_UnrealEd
    UE4Editor_UnrealEd
    UE4Editor_UnrealEd
    UE4Editor_UnrealEd
    UE4Editor
    UE4Editor
    UE4Editor
    UE4Editor
    UE4Editor
    kernel32
    ntdll

    Anyone can helpme?

    Leave a comment:


  • replied
    Hi!
    I've some problems with the "URuntimeMeshLibrary::CalculateTangentsForMesh" function...

    I have each variables declared as below:

    TArray<int32> Triangles;
    TArray<FVector2D> UV0;
    TArray<FVector> Normals;
    TArray<FRuntimeMeshTangent> Tangents;
    TArray<FColor> VertexColors;

    // code to fill the arrays

    URuntimeMeshLibrary::CalculateTangentsForMesh(Vertices, Triangles,UV0, Normals, Tangents);

    when I call the method to calculate tangents and normals the engine chash, and I get this error.

    Assertion failed: UV1s && UV1s->Num() > CurrentPosition [File:d:\build\++portal+main+full\sync\localbuilds\plugintemp\hostproject\plugins\runtimemeshcomponent\source\runtimemeshcomponent\public\RuntimeMeshBuilder.h] [Line: 786]



    KERNELBASE
    UE4Editor_Core
    UE4Editor_Core
    UE4Editor_Core
    UE4Editor_RuntimeMeshComponent!FRuntimeMeshComponentVerticesBuilder::GetUV() [d:\build\++portal+main+full\sync\localbuilds\plugintemp\hostproject\plugins\runtimemeshcomponent\source\runtimemeshcomponent\public\runtimemeshbuilder.h:787]
    UE4Editor_RuntimeMeshComponent!URuntimeMeshLibrary::CalculateTangentsForMesh() [d:\build\++portal+main+full\sync\localbuilds\plugintemp\hostproject\plugins\runtimemeshcomponent\source\runtimemeshcomponent\private\runtimemeshlibrary.cpp:243]
    UE4Editor_RuntimeMeshComponent!URuntimeMeshLibrary::CalculateTangentsForMesh() [d:\build\++portal+main+full\sync\localbuilds\plugintemp\hostproject\plugins\runtimemeshcomponent\source\runtimemeshcomponent\private\runtimemeshlibrary.cpp:328]
    UE4Editor_Mockingbird_9502!ASimpleTerrainGeneration::GenerateMesh() [c:\agus\projects\tesis\prototipo\mockingbird\source\mockingbird\private\terraingenerators\simpleterraingeneration.cpp:139]
    UE4Editor_Engine
    UE4Editor_Engine
    UE4Editor_Engine
    UE4Editor_Engine
    UE4Editor_Engine
    UE4Editor_Engine
    UE4Editor_UnrealEd
    UE4Editor_UnrealEd
    UE4Editor_UnrealEd
    UE4Editor_UnrealEd
    UE4Editor_UnrealEd
    UE4Editor
    UE4Editor
    UE4Editor
    UE4Editor
    UE4Editor
    kernel32
    ntdll

    Anyone can helpme?

    Leave a comment:


  • replied
    Originally posted by Koderz View Post
    Thanks! Glad it's been useful! Assuming it's not Assimp, the two primary culprits for something like that is first collision, and secondly if you're using the RMC's utility to calculate normals/tangents. Collision will hitch with large meshes due to cooking. The normal/tangent calculator is exponentially slower for large meshes, which will be fixed soon. Are you using one or both of those?
    I'm generating normals with assimp but it doesn't change much in execution speed, I also have collision enabled but would like to leave that on and doesn't make much of a change in speed either. Later on I'll be working with bigger models so I'm looking into doing the conversion to another thread.

    I have a couple of questions though about other stuff;
    -How can I convert to a normal static mesh if possible? Does it create a .uasset file? (so it doesn't need to be imported every time)
    -How are you thinking to handle replication over network? (via conversion to static mesh and copying the asset to clients or something?)

    -I'm having trouble to create physics enabled objects, I use the following code to create an object that should have a lot of 'drag' but it moves at constant speed when receiving a push.

    Code:
    RuntimeMesh->CreateMeshSection(0, vertices, triangles, normals, texMap, vertexColors, tangents, true, EUpdateFrequency::Infrequent);
    
    	RuntimeMesh->SetMaterial(0, MeshMaterial);
    	RuntimeMesh->SetMobility(EComponentMobility::Movable);
    	RuntimeMesh->SetLinearDamping(100.f);
    	RuntimeMesh->SetAngularDamping(100.f);
    	RuntimeMesh->SetSimulatePhysics(true);
    	RuntimeMesh->SetEnableGravity(false);
    	RuntimeMesh->SetLockedAxis(EDOFMode::XYPlane);
    SetLinearDamping(100.f) and SetAngularDamping(100.f) are correctly set on the mesh but it seems to be ignored.

    I donated around 10 bucks, happy to support

    EDIT:
    It works when disabling bUseComplexAsSimpleCollision, is it possible/legal to make the engine calculate a convex hull at runtime? (I'll probably write my own algorithm anyway but would be handy for now).

    EDIT2:
    I cleaned up some debugging which decreased the duration a 10-fold.
    Last edited by housekiller; 12-08-2016, 07:20 AM.

    Leave a comment:


  • replied
    Originally posted by Chupacabra View Post
    I'm having an issue using the slicing system in the latest marketplace version of RuntimeMeshComponent and I'm not entirely sure how to debug what's going on:

    -I'm taking a static mesh (a wall, it's pretty much just a scaled cube), then in BeginPlay I'm using "Copy Runtime Mesh from Static Component"
    -I'm then slicing it down the middle with "Create Other Half" enabled and "Create New Section" selected.
    -When I make the slice I get this error in the log: "RuntimeMeshLog:Error: Section is not of legacy type."
    -The resulting slice seems to have worked for the newly created section, but nothing happens to the original Mesh Component


    I'm using the exact same blueprint logic that I used for using the inbuilt procedural mesh slicing, which visually works as expected but results in a lot of weird collision issues (hence why I'm looking to switch over to your plugin).

    Any ideas what I'm doing wrong?
    Hey, sorry about the late response. I actually didn't get a notification when you posted this. I'm not sure what would cause that.. Would you be willing to send me some more details about how you did this and I'll try to get it fixed! I actually tested that using SMC converted meshes.. so not sure why it would be doing that. I'm also around the UE4 Discord if that's easier.


    Originally posted by housekiller View Post
    Fantastic work thanks!
    I'm importing various models at runtime via assimp.

    One question though; while reading somewhat bigger files (+50k faces) and giving the info for making the mesh the ue4 application freezes for a second. Is there something I could do to prevent this from happening?
    Thanks! Glad it's been useful! Assuming it's not Assimp, the two primary culprits for something like that is first collision, and secondly if you're using the RMC's utility to calculate normals/tangents. Collision will hitch with large meshes due to cooking. The normal/tangent calculator is exponentially slower for large meshes, which will be fixed soon. Are you using one or both of those?

    Leave a comment:


  • replied
    Fantastic work thanks!
    I'm importing various models at runtime via assimp.

    One question though; while reading somewhat bigger files (+50k faces) and giving the info for making the mesh the ue4 application freezes for a second. Is there something I could do to prevent this from happening?

    Leave a comment:


  • replied
    I'm having an issue using the slicing system in the latest marketplace version of RuntimeMeshComponent and I'm not entirely sure how to debug what's going on:

    -I'm taking a static mesh (a wall, it's pretty much just a scaled cube), then in BeginPlay I'm using "Copy Runtime Mesh from Static Component"
    -I'm then slicing it down the middle with "Create Other Half" enabled and "Create New Section" selected.
    -When I make the slice I get this error in the log: "RuntimeMeshLog:Error: Section is not of legacy type."
    -The resulting slice seems to have worked for the newly created section, but nothing happens to the original Mesh Component

    Pre Slice: (Red line is where I make the slice)
    Click image for larger version

Name:	preslice.JPG
Views:	1
Size:	18.4 KB
ID:	1119489

    Post Slice: (I've moved the pieces apart to illustrate the problem, the purple slice is the newly create mesh)
    Click image for larger version

Name:	postslice.JPG
Views:	1
Size:	21.0 KB
ID:	1119490

    I'm using the exact same blueprint logic that I used for using the inbuilt procedural mesh slicing, which visually works as expected but results in a lot of weird collision issues (hence why I'm looking to switch over to your plugin).

    Any ideas what I'm doing wrong?

    Leave a comment:


  • replied
    RuntimeMeshComponent v2.0 Now on the marketplace!

    Since I know some of you have been waiting for this, I just wanted to alert you...

    Version 2.0 of the RMC is now live on the Marketplace. This means both that the marketplace has the current GitHub version, including the slicer, and also that the marketplace version has been updated to support UE4.14!

    A couple people in the community have suggested that I provide a way to donate to the development of the RMC. I have now added a link to the first post as well as this post. As a full time student I appreciate anything you can contribute, and I hope to be able to support, and extend the RMC for a long time to come.

    Click image for larger version

Name:	btn_donate_LG.gif
Views:	1
Size:	1.7 KB
ID:	1119073

    Leave a comment:


  • replied
    Originally posted by daeilkim View Post
    [MENTION=141752]Koderz[/MENTION] I sent you a PM, but thought it'd be useful to have the knowledge shared with anyone. Been playing around with the tool which is amazing, but wanted to know if you had any insights on generating procedural meshes given a known set of vertices and triangle indices. Apologies in advance if this is a newbie question, but I've been able to execute the generation of box meshes using the example found in "UE4RuntimeMeshComponentExamples/Source/RMC_Examples/Actors/BasicRMCActor.cpp", but would you have a quick example for where there already exists a set of vertices and triangle indices? Especially for v2.0 of your plugin. Here's what I was wondering for the example you had:


    Sorry about the late response, been busy with family then school work! I will say I'll be updating the docs over the coming week or two to hopefully show how to use all the existing parts.

    First, I'm not quite sure what you mean be "generating procedural meshes given a known set of vertices and triangle indices" Do you mean you have these from output of something else? if that's the case you just need to convert the parts into those arrays. The better way is to use a packed vertex but much of this isn't super well documented for now and it's not easy to explain here.

    Caculating UV coordinates automatically would depend what you want. That's either super simple, or super complicated. It depends entirely on what you're going for.

    As a part of the docs I will show how to use the static mesh conversions and the slicer. I'll try to do those parts tomorrow if I have some time.

    Leave a comment:


  • replied
    Examples to generate meshes with provided vertices and triangle indices?

    [MENTION=141752]Koderz[/MENTION] I sent you a PM, but thought it'd be useful to have the knowledge shared with anyone. Been playing around with the tool which is amazing, but wanted to know if you had any insights on generating procedural meshes given a known set of vertices and triangle indices. Apologies in advance if this is a newbie question, but I've been able to execute the generation of box meshes using the example found in "UE4RuntimeMeshComponentExamples/Source/RMC_Examples/Actors/BasicRMCActor.cpp", but would you have a quick example for where there already exists a set of vertices and triangle indices? Especially for v2.0 of your plugin. Here's what I was wondering for the example you had:

    Code:
    void ABasicRMCActor::OnConstruction(const FTransform& Transform, TArray<FVector> Vertices, TArray<int32> Triangles;)
    {
            // Vertices and Triangle indices are now provided
    	TArray<FVector> Normals;
    	TArray<FRuntimeMeshTangent> Tangents;
    	TArray<FVector2D> TextureCoordinates;
    	
            // What would replace this function to allow for Vertices & Triangles to be passed?
    	URuntimeMeshLibrary::CreateBoxMesh(FVector(100, 100, 100), Vertices, Triangles, Normals, TextureCoordinates, Tangents);
            
            // Is it possible to generate UV Coordinates automatically as well?
    
    	// Create the mesh section specifying collision
    	RuntimeMesh->CreateMeshSection(0, Vertices, Triangles, Normals, TextureCoordinates, TArray<FColor>(), Tangents, true, EUpdateFrequency::Infrequent);
    }
    Also would love to see an example of the new feature where the procedural mesh can be saved to a static mesh. Thanks again for such a great tool.

    Leave a comment:


  • replied
    No problem, many of us are using the source code anyway, I am sure. This to be able to dive on the source code, to understand, and to tweak it if needed.
    Cheers!

    Leave a comment:


  • replied
    Just as a heads up to those of you waiting for the marketplace update. It was submitted last night, but it might take Epic a little extra time as I'm sure people are off over the holiday. With that it might be early next week before they can look at it.


    Also, if anyone as ideas on features they'd like to see added, feel free to send them to me! While much of the development is directed by what I personally want/need, I'm more than willing to look into other things if they make sense!
    [MENTION=28104]wilberolive[/MENTION], [MENTION=1690]SiggiG[/MENTION], [MENTION=1105]SRombauts[/MENTION] Thank you all!

    Leave a comment:

Working...
X