[Free][Open Source] Plugin for loading meshes and textures during runtime

any one can help?

Hi @DieAlshoja3, could you specify what exactly it is you need help with?

Greetings

Hi @cconti-rr, this is very much appreciated!
I tested your PR with Windows and everything still works fine. Hence, I accepted your PR. :slight_smile:

Greetings

Hey @DieAlshoja3,
this thread is only about the RuntimeMeshLoader plugin for Unreal Engine. If you have general problems with the Epic Games Store, please contact Epic Games directly.

Thanks

Сan anyone help me with compiling assimp libraries for import/export for ANDROID on windows, I have been trying for a week now and it doesn’t come out, where is either a step-by-step instruction that contains each step or ready-made android libraries for import/export?

Hi @Cektantwork,
my experience with Android is limited, however, a quick look at the Assimp GitHub page showed me this Wiki entry detailing a step-by-step quick guide for compiling Assimp on Windows for Android: Android compilation on Windows (Quick overview) · assimp/assimp Wiki · GitHub

I hope it helps.

Greetings

Yes, and I did not succeed, I can not understand what I am doing wrong, but thanks for such a quick response)

Hi @Chrisss50,
I simplified my questions about creating a material with a texture, could you help me?
How to create a material using a texture in c++? - Development Discussion / C++ Programming - Unreal Engine Forums

If I see it correctly, your question was answered in your linked post?
Sorry that I wasn’t able to answer it, but my knowledge with the whole material-stuff in Unreal is limited. :slight_smile:

Greetings

Hi @Chrisss50,
Thanks for your help, I have another question that how to load texture path for FBX file in C++?
In your example, I do not know how to get these two texture file path in C++:


I can load texture path of OBJ file successfully by using my ImportMesh.cpp:

////materail
    FString diffusePath = "", normalPath = "", metalnessPath = "", specularPath = "";
    UMaterialInterface* ParentMaterail = LoadObject<UMaterialInterface>(NULL, TEXT("Material'/Game/test/NewMaterial.NewMaterial'"));
    UMaterialInstanceDynamic* sectionmaterial = UMaterialInstanceDynamic::Create(ParentMaterail, nullptr);
    bool isValid;
    int32 texWidth, texHeight;
    auto materialInstance = scene->mMaterials[mesh->mMaterialIndex];

    if (materialInstance->GetTextureCount(aiTextureType_DIFFUSE) > 0) {
        aiString tempTexturePath;
        FString TempTexturePath;
        materialInstance->GetTexture(aiTextureType_DIFFUSE, 0, &tempTexturePath);

        TempTexturePath = FString(tempTexturePath.C_Str());

        FString n1, n2;
        bool splitRes1 = FilePath.Split("/", &n1, &n2, ESearchCase::IgnoreCase, ESearchDir::FromEnd);
        diffusePath = n1 + "/" + TempTexturePath;
   
        UTexture2D* textureParam = LoadTexture2DFromFile(diffusePath, isValid, texWidth, texHeight);
        sectionmaterial->SetTextureParameterValue(FName("Param"), textureParam);
        
    }
    else {
        UE_LOG(LogTemp, Warning, TEXT("no diffusePath"));
    }

    if (materialInstance->GetTextureCount(aiTextureType_NORMALS) > 0) {
        aiString tempTexturePath;
        FString TempTexturePath;
        materialInstance->GetTexture(aiTextureType_NORMALS, 0, &tempTexturePath);

        TempTexturePath = FString(tempTexturePath.C_Str());

        FString n1, n2;
        bool splitRes1 = FilePath.Split("/", &n1, &n2, ESearchCase::IgnoreCase, ESearchDir::FromEnd);
        normalPath = n1 + "/" + TempTexturePath;
        UTexture2D* textureParam = LoadTexture2DFromFile(normalPath, isValid, texWidth, texHeight);
        sectionmaterial->SetTextureParameterValue(FName("Param"), textureParam);

    }
    else {
        UE_LOG(LogTemp, Warning, TEXT("no normalPath"));
    }

    if (materialInstance->GetTextureCount(aiTextureType_METALNESS) > 0) {

        aiString tempTexturePath;
        FString TempTexturePath;
        materialInstance->GetTexture(aiTextureType_METALNESS, 0, &tempTexturePath);

        TempTexturePath = FString(tempTexturePath.C_Str());

        FString n1, n2;
        bool splitRes1 = FilePath.Split("/", &n1, &n2, ESearchCase::IgnoreCase, ESearchDir::FromEnd);
        metalnessPath = n1 + "/" + TempTexturePath;
        UTexture2D* textureParam = LoadTexture2DFromFile(metalnessPath, isValid, texWidth, texHeight);
        sectionmaterial->SetTextureParameterValue(FName("Param"), textureParam);

    }
    else {
        UE_LOG(LogTemp, Warning, TEXT("no metalnessPath"));
    }

    if (materialInstance->GetTextureCount(aiTextureType_SPECULAR) > 0) {

        aiString tempTexturePath;
        FString TempTexturePath;
        materialInstance->GetTexture(aiTextureType_SPECULAR, 0, &tempTexturePath);

        TempTexturePath = FString(tempTexturePath.C_Str());

        FString n1, n2;
        bool splitRes1 = FilePath.Split("/", &n1, &n2, ESearchCase::IgnoreCase, ESearchDir::FromEnd);
        specularPath = n1 + "/" + TempTexturePath;
        UTexture2D* textureParam = LoadTexture2DFromFile(specularPath, isValid, texWidth, texHeight);
        sectionmaterial->SetTextureParameterValue(FName("Param"), textureParam);

    }
    else {
        UE_LOG(LogTemp, Warning, TEXT("no specularPath"));
    }

But when I tried to load FBX file of your example, I could not load texture successfully with these error message:


image

Hi,
as far as I can see, those warning-messages are coming from your tool?!
There, you are trying to get the texture from an obj-file, which is something I never tried. Currently, the texture-files (i.e. the png-images) need to be supplied separately.

Greetings

Thank you, I get it.

Hello,

Fairly new to UE4 and I’ve done my best to follow the installation instructions you provided in the git repo until I’ve gotten stuck at this part…

In your projec’s source panel you should now have a folder labeled RuntimeMeshLoader Content. Inside you will find an example map, which will show you how to use the plugin with an example.

I’m currently using version 4.27.2 and unfortunately, I don’t see that folder anywhere, that is if I’m looking at the right spot here.

Am I looking at the right spot or is this just not supported?

hi.@Chrisss50
Thank you for your plug-in! It helped me tremendously,This plugin allows me to provide mod support for players .
But I have some questions:
Does it save the models it reads, Or do I need to reload every time I load the game?
I don’t know if it’s a performance drain , Does it affect the performance of the game when reading a lot of mods?

I hope I can get your help.

Greetings

Perhaps you do not have this plugin enabled ? Or maybe the steps you took to add the plug-in were wrong.

Hi @Chrisss50 ,
Now I have a new problem :joy:: is this plugin working for skeletal meshes? I am trying to load a skeletal mesh fbx at runtime but it is not importing the skeleton for the mesh … I wonder if I need to do something else . This is what I get when I modify your example :

Hey any idea if it is possible to make this loaded mesh as movable, currently it spawns as static.
I tried to use the set mobility in blueprint, but all to no avail, I keep getting an error regarding my component being attached not being static, implying that the procedural mesh was not hit by my line trace and hit the ground below

I tried this:

You need to enable the plugin content in the content browser

Setting the load custom mesh event’s create mesh section as create collision as enables helps solve this problem