Announcement

Collapse
No announcement yet.

Runtime Mesh Component

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

  • replied
    I've just implemented my own LODs, but I am curious about how one could get the dither blending? Also, I saw on the marketplace page some description about collision only sections. How can I do that. Currently I just duplicate the visual mesh and then set that section to no visible.

    Leave a comment:


  • replied
    any news on LOD support?
    or are there manual ways to assign the unreal LOD system, like to draw a mesh multiple times in different resolutions?

    really need this for our current development.
    we intensly use the PMC to draw loads of meshes in VR. but in bigger worlds, all the distant meshes easily add up to 1 million+ vertices which drops fps.
    just can't handle all the vertices without LOD support...

    Leave a comment:


  • replied
    Originally posted by Lekyaira View Post
    First off, thanks for this Koderz! This plugin has been a huge help to me.

    Now for a very newb question, I'm sure. Is there a way to get a mesh from the RMC to render in the editor, rather than only at run time?
    There certainly is, just call it from the onConstruction event.

    Leave a comment:


  • replied
    Will this be updated for 4.15 with the new minimal headers etc?

    Leave a comment:


  • replied
    First off, thanks for this Koderz! This plugin has been a huge help to me.

    Now for a very newb question, I'm sure. Is there a way to get a mesh from the RMC to render in the editor, rather than only at run time?

    Leave a comment:


  • replied
    The slowdown from collision could be because the runtime mesh create dynamic physx actors by default, so it can't apply fancy optimizations.

    Does it run better if you force it to static after spawning? (using SetMobility method)

    Leave a comment:


  • replied
    Originally posted by rYuxq View Post
    Visibility doesnt affect collision btw.
    Cool, yeah it just seemed strange is all.

    Originally posted by rYuxq View Post
    But wait... You are saying that RCM with collision is much slower than having RCM for visibility (without collision) and HISM without visibility (for collision) running at the same time, overlaying each other?
    Yup. The test I mentioned above was pretty straight forward. The exact same mesh was imported into code to be added to a RMC 317 times and it was imported through the editor (FBX) and added to a HISM component in code, and then 317 instances were created. I toggled the Use comlex as simple in the editor imported Static mesh. Then when creating the RMC I did so with collision off. The performance wasn't even close. The order of performance went

    1 = HISM (Visual mesh and Complex collision) = Ran on Oculus Rift perfectly
    2 = RMC (visual mesh, no collision) and HISM (no visual mesh, but with collision) = Ran on Oculus rift, less performant than 1
    3 = RMC (visual mesh with collision) = Could barely run in editor, no need to test in Oculus Rift

    To add to the above I just looked into some other combinations and I discovered more odd behavior. I was curious if there was a difference between setting the HISM visibility to false, and setting the actor holding the HISM component Set Hidden In Game = true; I wondered if this would make the collision of the HISM go away, as you indicated it did not. But, it did further increase the performance while maintaining collision. I was getting around 26 FPS using stat FPS in the editor. With the just mentioned setup, of setting the actor hidden in game, I'm up to 35 FPS steady. The collision is still there. Crazy...
    Last edited by Thumper; 02-10-2017, 11:51 AM.

    Leave a comment:


  • replied
    Originally posted by Thumper View Post
    I just finished creating a obj importer so that I can convert meshes into RMC data. In a test I decided to try and compare RMC performance with Hierarchical Instanced Static Mesh. HISM is a lot faster and if you have collision enabled (I was using per poly collision in both RMC test and HISM test) it's not even comparable. I ran a test with 317 tree stumps, for a total of around 1.5 million polygons. I had the converted obj stump duplicated and rotated into place (identical transforms as with the HISM) I loaded up a RMC and turned collision to true. This was barely playable, serious FPS drops. I did the same test instead spawning instances of the same stump on the HISM component, but this time I imported the mesh through the editor. I set complex collision on the static mesh. UE4 barely slowed down. The test was barely playable using RMC, and with HISM I was able to put the oculus rift on and walk around jumping around on the tree stumps. This got me thinking about collision differences. So I ran the same test again, but this time I spawned both, all 317 stumps on an single RMC and also all 317 stumps on HISM, but I turned collision off on the RMC, and I turned visibility off on the HISC (for some reason this still allows the collision to exist). This basically made the RMC run as fast as the HISM. Very bizarre but also really cool. I guess the downside would be having to double spawn up front, but performance wise it's so much better.
    Visibility doesnt affect collision btw.

    But wait... You are saying that RCM with collision is much slower than having RCM for visibility (without collision) and HISM without visibility (for collision) running at the same time, overlaying each other?

    Leave a comment:


  • replied
    I just finished creating a obj importer so that I can convert meshes into RMC data. In a test I decided to try and compare RMC performance with Hierarchical Instanced Static Mesh. HISM is a lot faster and if you have collision enabled (I was using per poly collision in both RMC test and HISM test) it's not even comparable. I ran a test with 317 tree stumps, for a total of around 1.5 million polygons. I had the converted obj stump duplicated and rotated into place (identical transforms as with the HISM) I loaded up a RMC and turned collision to true. This was barely playable, serious FPS drops. I did the same test instead spawning instances of the same stump on the HISM component, but this time I imported the mesh through the editor. I set complex collision on the static mesh. UE4 barely slowed down. The test was barely playable using RMC, and with HISM I was able to put the oculus rift on and walk around jumping around on the tree stumps. This got me thinking about collision differences. So I ran the same test again, but this time I spawned both, all 317 stumps on an single RMC and also all 317 stumps on HISM, but I turned collision off on the RMC, and I turned visibility off on the HISC (for some reason this still allows the collision to exist). This basically made the RMC run as fast as the HISM. Very bizarre but also really cool. I guess the downside would be having to double spawn up front, but performance wise it's so much better.

    Leave a comment:


  • replied
    [MENTION=141752]Koderz[/MENTION]: Any ideas what causes those errors when trying to work with RMC and splines in c++? This is the only thing holding me up from integrating RMC into my main project...

    Leave a comment:


  • replied
    Bug report: Trying to #require Components/SplineComponent.h in a project that has this plugin (doesn't have to be the same class that uses RMC) results in a spate of errors from VS:

    G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(214): error C2065: 'UMaterialInterface': undeclared identifier
    2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(214): error C2059: syntax error: ','
    2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(214): error C2976: 'TMap': too few template arguments
    2> G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Core\Public\Containers\Map.h(927): note: see declaration of 'TMap'
    2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(217): error C2065: 'UMaterialInterface': undeclared identifier
    2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(217): error C2059: syntax error: ','
    2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(217): error C2976: 'TMap': too few template arguments
    2> G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Core\Public\Containers\Map.h(927): note: see declaration of 'TMap'
    2> MyRuntimeActorComponent.cpp
    2>G:\Kasia\UE4 project\cpp\MyProject2 - Kopia\Source\MyProject2\MyRuntimeActorComponent.cpp(1): error C2059: syntax error: '.'
    2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/EngineBaseTypes.h(357): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/EngineBaseTypes.h(357): error C2143: syntax error: missing ',' before '&'
    2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/EngineBaseTypes.h(364): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/EngineBaseTypes.h(364): error C2143: syntax error: missing ',' before '&'
    2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/EngineBaseTypes.h(367): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/EngineBaseTypes.h(367): error C2143: syntax error: missing ',' before '&'
    2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(214): error C2065: 'UMaterialInterface': undeclared identifier
    2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(214): error C2059: syntax error: ','
    2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(214): error C2976: 'TMap': too few template arguments
    2> G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Core\Public\Containers\Map.h(927): note: see declaration of 'TMap'
    2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(217): error C2065: 'UMaterialInterface': undeclared identifier
    2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(217): error C2059: syntax error: ','
    2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(217): error C2976: 'TMap': too few template arguments
    2> G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Core\Public\Containers\Map.h(927): note: see declaration of 'TMap'
    2>ERROR : UBT error : Failed to produce item: G:\Kasia\UE4 project\cpp\MyProject2 - Kopia\Binaries\Win64\UE4Editor-MyProject2.pdb

    Curiously enough, I *can* work with splines and RMC in blueprints.

    Leave a comment:


  • replied
    Just stopping by to say I started to use it and it is great! Thank you very much for such a great free addition [MENTION=141752]Koderz[/MENTION]!

    Leave a comment:


  • replied
    Dev Grant Nomination for the RMC!

    This is long shot but it's worth a try. I started a thread, and hope to get support from others like me using the RMC in the hope that we can convince Epic to give Koderz a dev grant for the work he's done on the RMC.

    I'd like to thank Koderz for the work he's done so far!

    If you use the RMC and think Epic should look into giving Koderz a dev grant, please support it here: https://forums.unrealengine.com/show...or-a-dev-grant

    Leave a comment:


  • replied
    I am currently having some issues with line trace. It seems the collision bounds are different from the odd shape runtimemesh. Is there a way to pass the collision shape to the runtimemesh function?
    Attached Files

    Leave a comment:


  • replied
    Originally posted by Beriol View Post
    Hey guys, I wanted to test the performance of this plugin by creating a very high poly sphere (say, 1 million triangles).

    Does anyone have the code to generate a parametric sphere like that? I'm messing around with algorithms, but things are getting complicated for me and I don't want to lose too much time for this, so if anyone has something already done it would be a big help
    In case anyone needs it, I managed to create the sphere, here's the code (I'm actually using the ProceduralMeshComponent in this one, but the code stays basically the same):

    Code:
    void ASphereActor::GenerateSphereMesh()
    {
    	mVertices.Empty();
    	mIndices.Empty();
    	mNormals.Empty();
    	mUvs.Empty();
    	mVertexColors.Empty();
    	mTangents.Empty();
    
    	CreateSphereWithTriangles(mVertices, mIndices, mNormals, SphereRadius, SphereRings, SphereSectors);
    
    	mMesh->CreateMeshSection(0, mVertices, mIndices, mNormals, mUvs, mVertexColors, mTangents, false);
    }
    
    void ASphereActor::CreateSphereWithTriangles(TArray<FVector> &vertices, TArray<int32> &indices, TArray<FVector> &normals, float radius, int stacks, int slices)
    {
    	double stackAngle = PI / stacks;
    	double sliceAngle = 2.0 * PI / slices;
    
    	int i, j, v1_index, v2_index, v3_index;
    
    	double a = 0;
    	double b = a + stackAngle;
    	double r0 = radius * sin(a);
    	double r1 = radius * sin(b);
    	float z0 = radius * cos(a);
    	float z1 = radius * cos(b);
    
    	double c = 0;
    	float x = cos(c);
    	float y = sin(c);
    
    	vertices.Add(FVector(x * r0, y * r0, z0));
    	v1_index = vertices.Num();
    
    	vertices.Add(FVector(x * r1, y * r1, z1));
    	v2_index = vertices.Num();
    
    	for (i = 0; i < stacks; i++)
    	{
    		a = i * stackAngle;
    		b = a + stackAngle;
    		r0 = radius * sin(a);
    		r1 = radius * sin(b);
    		z0 = radius * cos(a);
    		z1 = radius * cos(b);
    
    		j = i ? 0 : 1;
    
    		for (; j <= slices; j++) 
                    {
    			c = j * sliceAngle;
    			x = cos(c);
    			y = sin(c);
    
    			vertices.Add(FVector(x * r0, y * r0, z0));
    			v3_index = vertices.Num();
    
    			indices.Add(v1_index);
    			indices.Add(v2_index);
    			indices.Add(v3_index);
    
    			v1_index = v3_index;
    
    			vertices.Add(FVector(x * r1, y * r1, z1));
    			v3_index = vertices.Num();
    
    			indices.Add(v1_index);
    			indices.Add(v2_index);
    			indices.Add(v3_index);
    
    			v2_index = v3_index;
    		}
    	}
    }
    It's not the prettiest code but it works:
    Click image for larger version

Name:	33p39kz.png
Views:	1
Size:	894.7 KB
ID:	1121770
    Attached Files

    Leave a comment:

Working...
X