Announcement

Collapse
No announcement yet.

Runtime Mesh Component

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

  • replied
    I'm in the process of updating to UE4.16. Im stuck at the changes to the build.cs files

    Code:
    2>C:\Program Files\Epic Games\UE_4.16\Engine\Plugins\Marketplace\RuntimeMeshComponent\Source\RuntimeMeshComponent\RuntimeMeshComponent.Build.cs : warning : Module constructors should take a ReadOnlyTargetRules argument (rather than a TargetInfo argument) and pass it to the base class constructor from 4.15 onwards. Please update the method signature.
    2>C:\Program Files\Epic Games\UE_4.16\Engine\Plugins\Marketplace\RuntimeMeshComponent\Source\RuntimeMeshComponentEditor\RuntimeMeshComponentEditor.Build.cs : warning : Module constructors should take a ReadOnlyTargetRules argument (rather than a TargetInfo argument) and pass it to the base class constructor from 4.15 onwards. Please update the method signature.
    2>C:\Program Files\Epic Games\UE_4.16\Engine\Plugins\Marketplace\RuntimeMeshComponent\Source\RuntimeMeshComponentSlicer\RuntimeMeshComponentSlicer.Build.cs : warning : Module constructors should take a ReadOnlyTargetRules argument (rather than a TargetInfo argument) and pass it to the base class constructor from 4.15 onwards. Please update the method signature.
    Having this issue with some more plugins as well. I gues it was changed in the plugin for the 4.16 release? Just want to make sure it is changed in the code that was submitted. But I would gues it is cause non else mentioned issues?

    I downloaded the plugin via the launcher (Marketplace) on two different PCs. Both downloads are missing that change.

    C:\Program Files\Epic Games\UE_4.16\Engine\Plugins\Marketplace\RuntimeMeshComponent\Source\RuntimeMeshComponent\RuntimeMeshComponent.Build.cs
    Code:
    // Copyright 2016 Chris Conway (Koderz). All Rights Reserved.
    
    using UnrealBuildTool;
    
    public class RuntimeMeshComponent : ModuleRules
    {
    	public RuntimeMeshComponent(TargetInfo Target)
    	{
            PrivateIncludePaths.Add("RuntimeMeshComponent/Private");
            PublicIncludePaths.Add("RuntimeMeshComponent/Public");
    
            PublicDependencyModuleNames.AddRange(
                    new string[]
                    {
                            "Core",
                            "CoreUObject",
                            "Engine",
                            "RenderCore",
                            "ShaderCore",
                            "RHI"
                    }
                );
        }
    }

    And here the version file. Did the launcher download the correct version?
    C:\Program Files\Epic Games\UE_4.16\Engine\Plugins\Marketplace\RuntimeMeshComponent\Source\RuntimeMeshComponent\Public\RuntimeMeshVersion.h
    Code:
    // Copyright 2016 Chris Conway (Koderz). All Rights Reserved.
    
    #pragma once
    
    #include "RuntimeMeshComponentPlugin.h"
    
    
    // Custom version for runtime mesh serialization
    namespace FRuntimeMeshVersion
    {
    	enum Type
    	{
    		Initial = 0,
    		TemplatedVertexFix = 1,
    		SerializationOptional = 2,
    		DualVertexBuffer = 3,
    
    		SerializationV2 = 4,
    
    		// -----<new versions can be added above this line>-------------------------------------------------
    		VersionPlusOne,
    		LatestVersion = VersionPlusOne - 1
    	};
    
    	// The GUID for this custom version
    	const static FGuid GUID = FGuid(0xEE48714B, 0x8A2C4652, 0x98BE40E6, 0xCB7EF0E6);
    };

    Leave a comment:


  • replied
    Originally posted by wilberolive View Post
    [MENTION=141752]Koderz[/MENTION] - So I've worked out what the problem is. It turns out you cannot set a material on a mesh section if that mesh section either doesn't exist already or is not created in the same tick.

    My actors add an empty RMC to themselves in the constructor. No materials or mesh sections are set at this point. Later on as the game dictates for a given actor, a material needs to be set and a mesh section needs to be created. The problem is that these two conditions are not met in exactly the same tick. For example, the player may choose a material and then it takes a few ticks before the mesh section needs to be created.

    So the problem was that I was setting a material into slot 0 on the RMC, but I'm guessing slot 0 doesn't exist as there is no mesh section yet. However if I force it to create the mesh section in the same tick, then it works fine. Even if I set the material before creating the mesh section. This explains why it would fail the first time and then work each time after that as the mesh section was now created.

    Unfortunately, I cannot set the material and create the mesh section in the same tick. So to get around the problem I need to create a dummy mesh section in the constructor, so the RMC is not empty. To do this, I'm just using three vertices all at the world origin so they effectively make an invisible triangle and then create a mesh section from that. This ensures that material slot 0 exists and I can then set the material when needed. Later on, when the real mesh section is created, it simply overwrites the three dummy vertices.

    So, not an ideal solution, but I can't think of any other way around this issue. I'm not sure if this is a bug with RMC or just a limitation?
    Thanks for the info! I'll see what can be done in v3. Will probably need to figure out a way to fix that as v3 is being setup to explicitly handle creating empty sections for your type situations so that might actually become more of a problem without something to get around it.


    On that note, I'm actually coming close to completing the core of v3! Will have more info soon!

    Leave a comment:


  • replied
    Originally posted by wilberolive View Post
    [MENTION=141752]Koderz[/MENTION] - So I've worked out what the problem is. It turns out you cannot set a material on a mesh section if that mesh section either doesn't exist already or is not created in the same tick.

    My actors add an empty RMC to themselves in the constructor. No materials or mesh sections are set at this point. Later on as the game dictates for a given actor, a material needs to be set and a mesh section needs to be created. The problem is that these two conditions are not met in exactly the same tick. For example, the player may choose a material and then it takes a few ticks before the mesh section needs to be created.

    So the problem was that I was setting a material into slot 0 on the RMC, but I'm guessing slot 0 doesn't exist as there is no mesh section yet. However if I force it to create the mesh section in the same tick, then it works fine. Even if I set the material before creating the mesh section. This explains why it would fail the first time and then work each time after that as the mesh section was now created.

    Unfortunately, I cannot set the material and create the mesh section in the same tick. So to get around the problem I need to create a dummy mesh section in the constructor, so the RMC is not empty. To do this, I'm just using three vertices all at the world origin so they effectively make an invisible triangle and then create a mesh section from that. This ensures that material slot 0 exists and I can then set the material when needed. Later on, when the real mesh section is created, it simply overwrites the three dummy vertices.

    So, not an ideal solution, but I can't think of any other way around this issue. I'm not sure if this is a bug with RMC or just a limitation?
    I'm conquering the same issue. Unfortunately I'm not able to solve it they you were able to. It happens on my end after clearing and than creating the section + setting the material again. To solve it, I just made sure the create + set material is happing only once.

    Leave a comment:


  • replied
    Originally posted by wilberolive View Post
    Don't understand why I'm seemingly the only person hitting this problem, unless nobody else uses RMC in C++... surely not.
    I also saw that issue, and I just fixed it with commenting out that ensure in the source, that ensure is just for telling you that something is wrong, but since everything works, its just not needed. If you don't want to edit the UE4 source, you obviously can't just comment it out.

    And the reason why it's only "failing" once is that ensures in general in UE4 are only breaking execution on the first time they are called. Later, they are ignored.

    Leave a comment:


  • replied
    [MENTION=141752]Koderz[/MENTION] - So I've worked out what the problem is. It turns out you cannot set a material on a mesh section if that mesh section either doesn't exist already or is not created in the same tick.

    My actors add an empty RMC to themselves in the constructor. No materials or mesh sections are set at this point. Later on as the game dictates for a given actor, a material needs to be set and a mesh section needs to be created. The problem is that these two conditions are not met in exactly the same tick. For example, the player may choose a material and then it takes a few ticks before the mesh section needs to be created.

    So the problem was that I was setting a material into slot 0 on the RMC, but I'm guessing slot 0 doesn't exist as there is no mesh section yet. However if I force it to create the mesh section in the same tick, then it works fine. Even if I set the material before creating the mesh section. This explains why it would fail the first time and then work each time after that as the mesh section was now created.

    Unfortunately, I cannot set the material and create the mesh section in the same tick. So to get around the problem I need to create a dummy mesh section in the constructor, so the RMC is not empty. To do this, I'm just using three vertices all at the world origin so they effectively make an invisible triangle and then create a mesh section from that. This ensures that material slot 0 exists and I can then set the material when needed. Later on, when the real mesh section is created, it simply overwrites the three dummy vertices.

    So, not an ideal solution, but I can't think of any other way around this issue. I'm not sure if this is a bug with RMC or just a limitation?

    Leave a comment:


  • replied
    Originally posted by wilberolive View Post
    [MENTION=141752]Koderz[/MENTION] - So I eventually got everything compiling and running. Those warnings from my previous post are still there though. Looks like the build files haven't been updated as needed.

    I was so excited to upgrade as I thought I might finally get rid of that annoying bug I have... but to my great devastation, I'm still hitting that same exception breakpoint every time I try to use RMC for the first time. See my other previous post from a while ago about it. It breaks out to VS at some exception breakpoint in the engine code. I then have to click Continue to keep going. Then I can continue using RMC with no problems until I stop the current game and then click play again. Then it happens all over again. So frustrating when you have to click play, let it break to VS, click continue in VS, then go about testing your game... like 100 times a day.

    I've tried different engine versions as well as creating new fresh projects. It was all working amazingly for me back in 4.14. Don't understand why I'm seemingly the only person hitting this problem, unless nobody else uses RMC in C++... surely not. If you use it just in BP then there is no issue.

    I remember you saying that you fixed this issue... was that for v3 though?
    Yeah, forgot about the warnings, and not much point in pushing a whole new update to fix just that.

    As for the other, I've never seen it and I only work with it from C++. It has to be specific to something you're doing differently that it's not liking but I don't know what it would be. I'm still on 4.15 for work project, but work with 4.16 and 4.17 almost daily now working on the new RMC. Not sure what would cause that though. For materials the RMC should be setup almost identically to the PMC.

    Leave a comment:


  • replied
    Originally posted by wilberolive View Post
    [MENTION=141752]Koderz[/MENTION] - So I eventually got everything compiling and running. Those warnings from my previous post are still there though. Looks like the build files haven't been updated as needed.

    I was so excited to upgrade as I thought I might finally get rid of that annoying bug I have... but to my great devastation, I'm still hitting that same exception breakpoint every time I try to use RMC for the first time. See my other previous post from a while ago about it. It breaks out to VS at some exception breakpoint in the engine code. I then have to click Continue to keep going. Then I can continue using RMC with no problems until I stop the current game and then click play again. Then it happens all over again. So frustrating when you have to click play, let it break to VS, click continue in VS, then go about testing your game... like 100 times a day.

    I've tried different engine versions as well as creating new fresh projects. It was all working amazingly for me back in 4.14. Don't understand why I'm seemingly the only person hitting this problem, unless nobody else uses RMC in C++... surely not. If you use it just in BP then there is no issue.

    I remember you saying that you fixed this issue... was that for v3 though?
    Yeah, forgot about the warnings, and not much point in pushing a whole new update to fix just that.

    As for the other, I've never seen it and I only work with it from C++. It has to be specific to something you're doing differently that it's not liking but I don't know what it would be. I'm still on 4.15 for work project, but work with 4.16 and 4.17 almost daily now working on the new RMC. Not sure what would cause that though. For materials the RMC should be setup almost identically to the PMC.

    Leave a comment:


  • replied
    [MENTION=141752]Koderz[/MENTION] - So I eventually got everything compiling and running. Those warnings from my previous post are still there though. Looks like the build files haven't been updated as needed.

    I was so excited to upgrade as I thought I might finally get rid of that annoying bug I have... but to my great devastation, I'm still hitting that same exception breakpoint every time I try to use RMC for the first time. See my other previous post from a while ago about it. It breaks out to VS at some exception breakpoint in the engine code. I then have to click Continue to keep going. Then I can continue using RMC with no problems until I stop the current game and then click play again. Then it happens all over again. So frustrating when you have to click play, let it break to VS, click continue in VS, then go about testing your game... like 100 times a day.

    I've tried different engine versions as well as creating new fresh projects. It was all working amazingly for me back in 4.14. Don't understand why I'm seemingly the only person hitting this problem, unless nobody else uses RMC in C++... surely not. If you use it just in BP then there is no issue.

    I remember you saying that you fixed this issue... was that for v3 though?

    Leave a comment:


  • replied
    [MENTION=141752]Koderz[/MENTION] - So just updated to 4.16 (installed the updated RMC from the marketplace) and get the following warnings when compiling. This only comes up in C++ projects and I get them in both VS and when hitting Compile in the editor. I tried created a new blank project and still get the same warnings. My compile then fails after this, so I haven't been able to use RMC with 4.16 yet. I'm not sure if these warnings are causing the compile to fail or something else, but thought I better report this just in case.

    CompilerResultsLog: Info C:\Program Files\Epic Games\UE_4.16\Engine\Plugins\Marketplace\RuntimeMeshComponent\Source\RuntimeMeshComponent\RuntimeMeshComponent.Build.cs: warning: Module constructors should take a ReadOnlyTargetRules argument (rather than a TargetInfo argument) and pass it to the base class constructor from 4.15 onwards. Please update the method signature.
    CompilerResultsLog: Info C:\Program Files\Epic Games\UE_4.16\Engine\Plugins\Marketplace\RuntimeMeshComponent\Source\RuntimeMeshComponentEditor\RuntimeMeshComponentEditor.Build.cs: warning: Module constructors should take a ReadOnlyTargetRules argument (rather than a TargetInfo argument) and pass it to the base class constructor from 4.15 onwards. Please update the method signature.
    CompilerResultsLog: Info C:\Program Files\Epic Games\UE_4.16\Engine\Plugins\Marketplace\RuntimeMeshComponent\Source\RuntimeMeshComponentSlicer\RuntimeMeshComponentSlicer.Build.cs: warning: Module constructors should take a ReadOnlyTargetRules argument (rather than a TargetInfo argument) and pass it to the base class constructor from 4.15 onwards. Please update the method signature.

    Leave a comment:


  • replied
    Originally posted by Koderz View Post
    1) Sounds like a mass problem, have you altered the collision/gravity settings at all? If so what are they. Only other guess is if it started moving before convex cooked, but I doubt it since that version doesn't have async cooking.
    2) That's expected. PhysX (The underlying physics engine in UE4) doesn't support moving mesh collision, only static. There's various reasons for this, but nothing can be done about that. Every movable object in the engine will be some combination of box/sphere/sphyl primitives or convex bodies, potentially multiple of any of those. For concave objects the engine generates a set of convex shapes to approximate it using V-HACD unless you import the collision hulls from an outside tool.
    You were right, it was something ridiculous on my end. Thanks for the clarification and quick response!

    Leave a comment:


  • replied
    Originally posted by uw19 View Post
    I'm trying out the 4.16 plugin, but I'm having weird results when attempting to get collision up and running.

    My goal is have the player generate the procedural mesh at runtime and when they are finished, allow them to interact with the mesh (grabbing, throwing, etc.) and have it simulate physics. My attempts at this:
    1.) Create a simple box mesh and use 'add collision convex mesh' exactly like in your example template. The box falls extremely quickly then bounces into the stratosphere. No idea why.
    2.) Create a simple box mesh and use 'set mesh collision section' and 'set mesh section collision enabled' currently has no effect. The object falls right through the floor.

    Could this be a problem with the 4.16 update? Any help would be appreciated.

    And thanks for the awesome work on the plugin! Cheers to all the hard work.
    1) Sounds like a mass problem, have you altered the collision/gravity settings at all? If so what are they. Only other guess is if it started moving before convex cooked, but I doubt it since that version doesn't have async cooking.
    2) That's expected. PhysX (The underlying physics engine in UE4) doesn't support moving mesh collision, only static. There's various reasons for this, but nothing can be done about that. Every movable object in the engine will be some combination of box/sphere/sphyl primitives or convex bodies, potentially multiple of any of those. For concave objects the engine generates a set of convex shapes to approximate it using V-HACD unless you import the collision hulls from an outside tool.

    Leave a comment:


  • replied
    I'm trying out the 4.16 plugin, but I'm having weird results when attempting to get collision up and running.

    My goal is have the player generate the procedural mesh at runtime and when they are finished, allow them to interact with the mesh (grabbing, throwing, etc.) and have it simulate physics. My attempts at this:
    1.) Create a simple box mesh and use 'add collision convex mesh' exactly like in your example template. The box falls extremely quickly then bounces into the stratosphere. No idea why.
    2.) Create a simple box mesh and use 'set mesh collision section' and 'set mesh section collision enabled' currently has no effect. The object falls right through the floor.

    Could this be a problem with the 4.16 update? Any help would be appreciated.

    And thanks for the awesome work on the plugin! Cheers to all the hard work.

    Leave a comment:


  • replied
    Originally posted by a_prototype View Post
    Thank you for your explanation. It works now. Interestingly, i simply had to delete and recreate the 'Add RMC' node to get the collisions to work properly.

    Is there a way to READ/FETCH the vertex/normal/uv etc data from a mesh section?

    And is there a comfortable way to have multiple mesh sections share a set of triangles?
    Well that's good it works, but hilarious that it worked after that...

    There are ways to read it in c++, BP on the other hand is severely limited. That's something I want to look into for v3 but that might be a while. As for sections sharing triangles, what are you trying to do? Multiple sections within one RMC use the same vertices? partial sharing between sections in the same RMC? Or sharing mesh data between multiple RMCs? The last one there is coming in v3, and is part of the core so it'll be ready relatively quickly hopefully, the other 2 I'm not sure I'd want to try to support unless there was a really good case, the first one wouldn't be too bad, the second would be interesting to near impossible.

    Leave a comment:


  • replied
    Originally posted by Koderz View Post
    Not quite sure what you're getting vs trying to get. You should be able to turn collision on for any/all/none of the sections and it should just work. The caveat to that though is there's no good way to tell which side you're colliding with from a ray trace or whatever. That is something that's coming, but not yet. Just to make sure you're clear, the CreateCollision flag on CreateMeshSection creates a trimesh collision shape, that only works if UseComplexAsSimple is on for the RMC (most like it is since that's default) and you don't try to turn on "SimulatePhysics". The only time you should have to manually tell it to CookCollisionNow is if you want to query it with something like a ray trace in the same frame as creating it, by default collision won't update until the following frame.
    Thank you for your explanation. It works now. Interestingly, i simply had to delete and recreate the 'Add RMC' node to get the collisions to work properly.

    Is there a way to READ/FETCH the vertex/normal/uv etc data from a mesh section?

    And is there a comfortable way to have multiple mesh sections share a set of triangles?
    Last edited by a_prototype; 06-26-2017, 09:59 AM.

    Leave a comment:


  • replied
    Originally posted by ToastyFirePlace View Post
    Downloaded the 4.16 plugin, all seems to be working great. Quick couple of questions, wondering if anyone knows about either....

    1) Converting from a RMC mesh to a Static Mesh. I saw in the notes this should be possible, “RMC -> SMC in editor. (new)” but cannot figure out how to actually hook this up in blueprints. Had a quick look in the docs and didn't see much.

    2) Updating an instance of a RMC, being used as a component inside a blueprint, from an existing RMC. For example, I have a RMC instance as part of an actor blueprint. I want to update this existing component at runtime, but currently cannot as far as I can tell. If using normal static meshes, I can just call Set Static Mesh, but can find no comparable for either the existing UE4 procedural mesh component or the RMC. Ideally I'd like to be able to call Set RMC Mesh and pass in an existing RMC, the result from a slice operation for example.

    Thoughts?
    1) Unfortunately right now it's not really possible in blueprints. I'll keep that in mind for the next version.

    2) Well first up, the next version is being redesigned so it could do exactly this. As for slicing, you'd end up with a new full RMC which can be added to the current actor or a separate actor so not exactly sure what you're attempting to do here.

    Leave a comment:

Working...
X