Announcement

Collapse
No announcement yet.

Runtime Mesh Component

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

    Originally posted by CashCache View Post

    I'm only using one UV channel. Setting it like so:

    Code:
    mesh->SetSectionMaterial(0, material);
    mesh->CreateMeshSection(0, vertices, triangles, normals, UVs, vertexColors, tangents, true, EUpdateFrequency::Infrequent);
    Try setting the material after CreateMeshSection().

    Comment


      Originally posted by MaximumDup View Post
      There's clearly a shading issue with RMC on 4.20 right now. Comparison with ProceduralMeshComponent :
      I'm having the same issue. It looks like all vertex normal values are coming out positive (comparison shown with a default static cube):

      Comment


        Is it possible to use this with the 4.19 flex version of unreal? I've added the plugin to my project but having problems building.

        Comment


          Originally posted by bishop86 View Post
          Is it possible to use this with the 4.19 flex version of unreal? I've added the plugin to my project but having problems building.
          Managed to build, but now when I try to copy a static mesh to runtime mesh I get 'assertion failed'. It's only happening with one mesh though, other meshes work fine. The mesh works fine with the procedural mesh component though...

          Comment


            Originally posted by bishop86 View Post

            Managed to build, but now when I try to copy a static mesh to runtime mesh I get 'assertion failed'. It's only happening with one mesh though, other meshes work fine. The mesh works fine with the procedural mesh component though...
            Make sure all meshes you want to retrieve the mesh data from are CPU accessible. Open the static mesh in question and use the search bar to search for "CPU".
            NodePrefabs | PluginBuilder | NotificationBackbone | WidgetBox | DebugWidget

            Comment


              Thanks, Koderz, this looks really good. I'm curious though. It seems not to have an equivalent 'Get Section from Procedural Mesh' node (I'm using blueprints atm). I'm not sure how to update an existing mesh in realtime without it. Am I missing something obvious?

              Comment


                Never mind, I realised I could copy the mesh data initially from a Procedural Mesh component into an array variable in the construction script, do my calculations on that and then update the mesh.

                Unfortunately, despite the claims, updating the RMC is noticeably slower than updating the built-in Procedural Mesh.

                Comment


                  Originally posted by Bob3DGames View Post
                  Never mind, I realised I could copy the mesh data initially from a Procedural Mesh component into an array variable in the construction script, do my calculations on that and then update the mesh.

                  Unfortunately, despite the claims, updating the RMC is noticeably slower than updating the built-in Procedural Mesh.
                  that is an issue we are currently facing as well. He wanted to save on memory, thus he combines normald and tangents into a single struct for internal use. But that needs shitload of calculation time. Especially if you have lots of vertices.
                  NodePrefabs | PluginBuilder | NotificationBackbone | WidgetBox | DebugWidget

                  Comment


                    Ah, thanks for the explanation. It's a shame as I'm having to greatly reduce the poly count in my model (from 26k to 600) to make performance reasonable and it doesn't look nearly as good anymore. Tessellation doesn't help either as the result is all lumpy and horrible.

                    Comment


                      Originally posted by Rumbleball View Post

                      Make sure all meshes you want to retrieve the mesh data from are CPU accessible. Open the static mesh in question and use the search bar to search for "CPU".
                      I checked this and it's already enabled... hmmm

                      Comment


                        Originally posted by bishop86 View Post

                        I checked this and it's already enabled... hmmm
                        what does the log say? Callstack of the crash?
                        NodePrefabs | PluginBuilder | NotificationBackbone | WidgetBox | DebugWidget

                        Comment


                          Originally posted by Rumbleball View Post

                          what does the log say? Callstack of the crash?
                           
                          Spoiler

                          Comment


                            bishop86 I had a look but I do not have enough understanding of how all this stuff works.

                            Code:
                              
                            ...
                                         // Lets copy the adjacency information too for tessellation 
                                            // At this point all vertices should be copied so it should work to just copy/convert the indices.
                                            if (LOD.bHasAdjacencyInfo && LOD.AdjacencyIndexBuffer.GetNumIndices() > 0)
                                            {
                                                FIndexArrayView AdjacencyIndices = LOD.AdjacencyIndexBuffer.GetArrayView();
                            
                                                // We multiply these by 4 as the adjacency data is 12 indices per triangle instead of the normal 3
                                                uint32 StartIndex = Section.FirstIndex * 4;
                                                uint32 NumIndices = Section.NumTriangles * 3 * 4;
                            
                                                for (uint32 Index = 0; Index < NumIndices; Index++)
                                                {
                                                    AdjacencyIndexCreator(MeshToSectionVertMap[AdjacencyIndices[Index]]);
                                                }
                                            }
                            ...
                            The crash happens when trying to access MeshToSectionVertMap with a value that is not present within the map. If you don't need Tessellation, your best bet is to somehow prevent the mesh to have adjacency information. What ever that means.
                            NodePrefabs | PluginBuilder | NotificationBackbone | WidgetBox | DebugWidget

                            Comment


                              Originally posted by Rumbleball View Post
                              bishop86 I had a look but I do not have enough understanding of how all this stuff works.

                              Code:
                              ...
                              // Lets copy the adjacency information too for tessellation
                              // At this point all vertices should be copied so it should work to just copy/convert the indices.
                              if (LOD.bHasAdjacencyInfo && LOD.AdjacencyIndexBuffer.GetNumIndices() > 0)
                              {
                              FIndexArrayView AdjacencyIndices = LOD.AdjacencyIndexBuffer.GetArrayView();
                              
                              // We multiply these by 4 as the adjacency data is 12 indices per triangle instead of the normal 3
                              uint32 StartIndex = Section.FirstIndex * 4;
                              uint32 NumIndices = Section.NumTriangles * 3 * 4;
                              
                              for (uint32 Index = 0; Index < NumIndices; Index++)
                              {
                              AdjacencyIndexCreator(MeshToSectionVertMap[AdjacencyIndices[Index]]);
                              }
                              }
                              ...
                              The crash happens when trying to access MeshToSectionVertMap with a value that is not present within the map. If you don't need Tessellation, your best bet is to somehow prevent the mesh to have adjacency information. What ever that means.
                              OK thanks for looking

                              Could it be because I'm trying to copy a static mesh that was converted from a skeletal mesh with 'make static mesh' in the editor? Not sure if this could have something to do with it.

                              It works fine with procedural mesh comp. I'll have a look at the RMC code.
                              Last edited by Cosmik-Debris; 09-29-2018, 12:51 PM.

                              Comment


                                Originally posted by bishop86 View Post

                                OK thanks for looking

                                Could it be because I'm trying to copy a static mesh that was converted from a skeletal mesh with 'make static mesh' in the editor? Not sure if this could have something to do with it.
                                You can try exporting and reimporting the static mesh. Maybe that solves it. I think there is a checkbox on import for adjacency info.
                                NodePrefabs | PluginBuilder | NotificationBackbone | WidgetBox | DebugWidget

                                Comment

                                Working...
                                X