Hello! Recently I’m working on a project which needs to import .glb files in runtime. My approach is from UsingDatasmithAtRuntime.
But there was some issues of material and texture attachment.
This is the test scene I used, created by blender (Includes basic materials and textures, without cycles-specific nodes):
And you can see the bug of texture attachment from this video below. I just tried to debug again and then the texture appeared. Sometimes the material attachment will be wrong, too https://youtu.be/ucgLi4uWpZg
I’ve seen a similar issue from this topic: Ue4.27 datasmith Runtime import But I didn’t use MateriallnstanceDynamic. The materials and textures are in the glb files. Could you help me with this?
You seem to be loading on begin play, could you load on a key event. Let see what happens when the engine do a few frame before loading.
your performances (gpu time) are abysmal for such a scene. You should be running at 120fps. I am confused what it is so. Could you try to find out? press “ctrl” + “shift” + “,” and try to see what is slowing down your gpu like that.
The issue on texture import might be a side effect of either loading too fast or something slowing down the engine.
I’ve tried key event. The problem may still happen. Note that there is a very low probability(About 5%) that the problem happens. Most times the pipeline is fine.
The image below represents the bug I met. It’s weird that the output log even doesn’t send any warning.
If you wonder whether the problem is in BP, you can get all my files and the output log of the above texture problem in this folder: Datasmith Runtime
It’s not very comlicated.
Brief Pipeline:
BP_Fileloader loads the json file test.json using custom blueprint function library BPFL_DataTableLoader. It will get glb paths and several properties, then put the information into a datatable.
Datasmith loads the models using those paths. Datasmith should deal with the whole importing process (Mesh, Material, Texture)
BP_SceneModifier do some simple transform changes on actors. This may not affect the importing.
The datatable importing part should be fine. I think the problem is datasmith from that message log of material problem I sent.
If you want to check my BP. You may want to check the file paths in test.json and BP_Fileloader. I’m using absolute paths. If the BP can’t work, please tell me.
I was tring the same for the .udatasmith import from sketchup. In editor viewport it works fine but in the packaged project, I am getting the same green wierd material for all the meshes. glb import works fine for me.