(This is a translation of a [Japanese [Content removed] by Kwok Ka Keung.)
When re-importing an FBX of an existing Static Mesh with a Python-based custom Interchange pipeline, I am seeing an issue where texture references become None in the material assigned to the mesh, which uses Virtual Texture samplers, failing to load.
I am re-importing assets with the attached custom pipeline. So, I’d appreciate it if you could check whether there are any inconsistencies or issues in the order or manner in which the pipeline is applied.
In the attached file (stage_assets_interchange_pipeline), inside scripted_execute_pipeline, I enable factory_node.set_custom_virtual_texture_streaming(True) so that the textures being imported are converted to Virtual Textures. With this approach, texture references become None on the second import.
On the other hand, if I do not call set_custom_virtual_texture_streaming, Virtual Textures are automatically generated with _VT appended to the original texture name, and the material’s texture references are automatically connected to those Virtual Textures. With this approach, texture references remain good even after multiple reimports. So, is there a recommended naming convention in Unreal Engine that requires Virtual Textures to always have _VT appended to their names? Must the original textures that serve as the source for Virtual Textures be kept as assets?
Thanks.
[Attachment Removed]
再現手順
(1) Create the following main material in the project:
MM_stg_base
(2) Add VT texture parameter names (Albedo, Normal, ORM) to MM_stg_base and save it.
Use import_stage_assets.py to import an FBX model containing textures via the custom pipeline stage_assets_interchange_pipeline.py.
[Attachment Removed]
Hello Masahiro,
Thanks for reporting this issue. I will investigate this further and get back to you with a workaround or a fix as soon as possible.
My apologies for the inconvenience caused.
Regards,
Vedang
[Attachment Removed]
Hello Masahiro,
Thank you for being patient! I had a chance to look at your python pipelines and investigate the issue further and you are right about the texture references being cleared out.
This happens because of how the `UInterchangeTextureFactory` handles textures at the moment. Because it doesn’t not consider the possibility of an existing asset, not finding a valid payload it marks the textures as garbage that results in textures being cleared out on the material instance.
While I was at it, I verified that there are no special naming requirements for virtual textures and the approach you mentioned above is the correct one(i.e. to set `factory_node.set_custom_virtual_texture_streaming(True)`).
That being said, currently while I work on getting this issue fixed, if you have the source code of the engine available, you can make the following changes to make your python script do reimports correctly:
In file `Engine\Plugins\Interchange\Runtime\Source\Import\Private\Texture\InterchangeTextureFactory.cpp`, inside function `UInterchangeTextureFactory::EndImportAsset_GameThread` change the line:
if (!ProcessedPayload.IsValid())to
if (!bSkipImport && !ProcessedPayload.IsValid())
This will avoid deleting the existing textures and you will get a successful reimport.
Feel free to reach out should you have any follow up questions.
Regards,
Vedang
[Attachment Removed]
[mention removed]
(This is a translation of a Japanese post by Kwok Ka Keung.)
Thank you for your reply.
At the moment, I am trying to avoid this issue by performing asset name validation within the engine.
So, if possible, I’d appreciate it if you could provide a proper solution.
I appreciate your continued support.
[Attachment Removed]
[mention removed]
(This is a translation of a Japanese post by Kwok Ka Keung.)
Thank you for your reply.
I have shared the fix you mentioned with our programmers. I’ll be getting in touch with you if there’s any problem with the fix.
Thanks.
[Attachment Removed]