Download

RuntimeMeshImportExport - Import and Export runtime created static meshes using Assimp library

Description
Import and export of static mesh data at runtime. Can be used in conjunction with ProceduralMeshComponent or RuntimeMeshComponent. Both, import and export is possible synchrounous and asynchrounous. The plugin uses Assimp library to achieve this (Assimp). Using Assimp library also means huge list of supported file formats for import as well as export.

The Plugin makes use of v5.0 of Assimp (Assimp Github). Means there is no custom build of Assimp used in the Plugin which allows you to freely create your own Assimp build or Update to a newer version.

This plugin started from RuntimeMeshLoader Github and was hugely modified, improved and added async support.

Features

  • Sync and Async import and export
  • Thanks to Assimp the plugin supports lots of formats
  • Useable via Blueprint and C++
  • Normalize the import (crunch the imported scene into 100cm cube)
  • Combine meshes and/or sections on import
  • Debug and Release Binaries
  • Import of Material data (see below)

Media https://youtube.com/watch?v=FNSt9x9a_6c

Download RuntimeMeshImportExport on Marketplace](https://www.unrealengine.com/marketplace/en-US/slug/runtimemeshimportexport)

Material DATA Import
-Material DATA import is supported since version 1.3

  • Strong dependency on exporting application, file format support and what assimp imports from the file

-Texture files are supported as separate files and embedded

  • Embedded: Must be an embedded format (jpg, png, …)! Raw pixel data is not supported at the moment
  • Separate: The texture must be relative to the mesh file (best case is within the same folder)

-Supported Texture formats: Everything the ImageWrapper module of Unreal supports

  • PNG, JPEG, JPG, GrayscaleJPEG, BMP, ICO, EXR, ICNS
  • NOTE: Yes, Unreal is able to handle TGA files, but ONLY IN EDITOR! Thus not supported with the plugin.

-Materials are only imported as parameters. You must provide a Material that accepts these parameters (#40](https://forums.unrealengine.com/unreal-engine/marketplace/1653161-runtimemeshimportexport-import-and-export-runtime-created-static-meshes-using-assimp-library?p=1725805#post1725805)). A function is provided to create a loggable string representation of the imported material data.
[SPOILER]
Example output of function MaterialInfoToLogString


-------------------- MaterialInfo -------------------
Material Name: phong4
     bWireframe: false
     bTwoSided: false
     ShadingModel: Blinn, as int: 3
     BlendMode: , as int: -1
     ScalarParameter
           Opacity: 1.000000
           Transparency: 1.000000
           Reflectivity: 0.500000
     VectorParameter
     TextureParameter
           TexDiffuse: width: 312510, height: 0, byteDescription: jpg, byteCount: 312510
           TexNormal: width: 266491, height: 0, byteDescription: jpg, byteCount: 266491
-----------------------------------------------------

[/SPOILER]

  • ScalarParam:

[SPOILER]
Opacity
Transparency
BumpScaling
Shininess
ShininessStrength
Reflectivity
Refraction
[/SPOILER]

  • VectorParam:

[SPOILER]
Diffuse
Specular
Emissive
Transparent
Reflective
[/SPOILER]

  • TextureParam:

[SPOILER]
TexDiffuse
TexSpecular
TexEmissive
TexHeight
TexNormal
TexShininess
TexOpacity
TexDisplacement
TexLightmap
TexReflection
TexBaseColor
TexNormalCamera
TexEmissive
TexMetallic
TexRoughness
TexAmbientOcclusion
[/SPOILER]

Using the Plugin on a platform other than Win32/64
The plugin itself does not include any platform specific code and sticks to Unreals functions (which are multi platform). However the plugin comes only with Win32/64 binaries for Assimp.
That means you need to compile Assimp on your own and add it to the Plugin in RuntimeMeshImportExport/Source/Thirdparty/assimp/…
That also includes modifying


RuntimeMeshImportExport.uplugin

and


FRuntimeMeshImportExportModule::StartupModule() in RuntimeMeshImportExport.cpp

**to load the correct binaries.

FAQ**
[SPOILER]
Does the plugin support creation of StaticMeshes from the imported data?
-No, and there is no intention of trying to add that functionality.

Can we Import Animations/SkeletalMeshes?
-No, and there is no intention of trying to add that functionality. Though Assimp supports that, if tyou want to implement it on your own.

Will you add support for other platforms than Win32/64?
-No, and there is no itention to do that.
[/SPOILER]

Changes
[SPOILER]
Version 1.11
-Import parameters were collapsed into a structure for easier handling
-Import parameters now contain mesh Post Process flags for assimp
-Converted a crash to a log: Import of faces with less then 3 indices

Version 1.10
-Export is now possible with no VertexColor (interface function GetMeshData). In that case the plugin will set all vertex colors to white.

Version 1.9
-Fixed transform of ImportScene node was not applied to the imported scene
-Fixed seperate texture files for material data import did not support unicode characters

Version 1.8
-Fixed up transform mess that was created with update 1.6

Version 1.7
-Changed how Normals are treated regarding scaling. Previously these were not affected, now they seem to fit.
-When using negative scale on the object on import, triangle winding order is flipped for 1 and 3 negative values (x,y,z). This will prevent inside out models.
-TexAmbient (TextureParameter) and Ambient (VectorParameter) are not imported for materials anymore as they seem to be a duplicate of TexDiffuse/Diffuse.

Version 1.6
-Changed progress update. Instead of a string, an enum and the progress numbers are returned. This allows for custom text that can also be translated as part of the application.
-Async import now also returnes progress
-Progress is expanded to contain progress of Assimp import and export process.

Version 1.5
-Fixed weird crash with name given to the DynamicMaterial create from MaterialData

Version 1.4
-Fixed Vector parameter import not working for MaterialData import

Version 1.3
-Added support for MaterialData on import

Version 1.2
-Fixed: Export can’t create directory trees

Version 1.1
-Refactored the import result. Instead of returning a mess, meshes are now seperated, return their name and their material sections. Each material section now also contains its material name.
-ImportMethode is now split up into Mesh and Section
-Mesh: Keep, Merge
-Section: Keep, Merge, MergeSameMaterial
-Some smaller code cleanups (API did change a bit)

Version 1.0
-Release
[/SPOILER]

Examples Arrow.png

Example Project
Shipping version to test model import without buying the plugin
https://drive.google.com/open?id=1zu…XShIMet2mUdA-J

Editor EngineVersion 4.23, requires the Plugin installed to the engine
https://drive.google.com/open?id=1Z5…0GYBWcmRf1kulO

Example Code
Click the Images to enlarge them

Import

Material Data to Material
1: Create a material that provides the parameters you want to get applied from the imported material data (#40)](https://forums.unrealengine.com/unreal-engine/marketplace/1653161-runtimemeshimportexport-import-and-export-runtime-created-static-meshes-using-assimp-library?p=1725805#post1725805)
2: Place the material in “Material Info To Dynamic Material” node and feed it the material data to apply.
3: Set the resulting dynamic material to the mesh component.

Export

Hows progress on this plugin going? Coming from what you posted on the runtime mesh loader github pull request :slight_smile:

Thanks for your interest. We wanted to release with UE4.23, but just yesterday we needed to make an addition. I try to make the Marketplace push on Monday, though it might take awhile for the Marketplace team to check it.

Ok cool! Cant wait to check it out

Hi. Is this plugin completed?

still playing pingpong with the marketplace team. Currently in the legal stage cause of third party code.

I’m happy to announce the release of the Plugin. It is now available for Unreal 4.21+ and makes use of the Assimp v5.0 release.

I just discovered it on the Marketplace and brought it instantly. Fantastic.
I need clarification about how you handle materials from obj. What is the “Material Index” output in RuntimeMeshImportMeshInfo?
I only need the name of the material, no values, only the string name.

Much of that is taken over from the originating Github project. The Index (Tooltip seems to be messed up) is the element ID if the material when opening a static mesh viewer.

It is basically useless as original objects are not retained in the import. Yes, the material name should be added to the result. Maybe return that more properly (Keep sections of a mesh together in the returned data).
This might cause some trouble with making the import Uniform on request, but will see to it tomorrow.

Update pushed to the Marketplace. See Changelog in #1](RuntimeMeshImportExport - Import and Export runtime created static meshes using Assimp library - Unreal Engine Forums) and changed Import example in #2](https://forums.unrealengine.com/unreal-engine/marketplace/1653161-runtimemeshimportexport-import-and-export-runtime-created-static-meshes-using-assimp-library?p=1654091#post1654091).

Thanks a lot man! One quick question - does it work with Skeletal meshes? I saw on your plugin’s marketplace page that “Only raw mesh information is supported” so I think skeletal meshes may not be possible. Basically I’m trying to import a skeletal mesh at runtime which means the skeleton as well. If it’s not possible straightforward, is there any workaround that you can enlighten me with please?
Thanks again!

[USER=“3422878”]Shikhar Arora[/USER] No, it does not work out of the box. Assimp itself does support skeletal meshes, so you can extent the plugin. Most of the work is done, should not be so much trouble to add skeletal to it.

Though the actual problem you will encounter is, that there is no runtime skeletal mesh component like ProceduralMeshComponent/CustomMeshComponent/RuntimeMeshComponent for StaticMesh. MAYBE you can just spawn a USkeletalMesh at runtime, feed it the imported data and give it to the USkeletalMeshComponent, but that something behind my knowledge.

I personally did not use any SkeletalMeshes, so can’t help you there.

Ok I’ll look into Uskeletal mesh possibilities. Thanks a lot!!
​​​​​​​

Yes, you delivered 1.1 bulls eye. Perfect (for my actual project) material handling and you fixed a strange import problem (same geometry imported differently in different Unreal levels) I’ve also encountered in my project. BIG THANKS.

Glad I hit it!

That problem with import in different levels sounds realy strange. I did not fix anything about the actual mesh data.

Example project can now be found here #2](https://forums.unrealengine.com/unreal-engine/marketplace/1653161-runtimemeshimportexport-import-and-export-runtime-created-static-meshes-using-assimp-library?p=1654091#post1654091)

When importing a model, does it also import the collision? If not then it would be kind of useless?
Also is it possible to have it imported as a UStaticMesh instead of a procedural one?

ProceduralMeshComponent::CreateMeshSection has a CreateCollision checkbox. At least on the RuntimeMeshComponent there are additional functions to create Collision section. Though these would be imported as Meshes as well. You can prefix them and filter in import.

It might be possible to also create a UStaticMesh from the data, but you would need to check that for yourself. Keep in mind that there is Editor and Shipped. Things that work in the Editor might not work in a Shipping game. I gues there are reasons for why Unreal created ProceduralMeshComponent.

The plugin download is currently messed up by Epic. Though 4.24 is released, don’t try to update. Other versions should also be affected.