OGRECave / ogre

scene-oriented, flexible 3D engine (C++, Python, C#, Java)
https://ogrecave.github.io/ogre/
MIT License
4.03k stars 982 forks source link

FBX format embedded media #3146

Closed ikcppdeveloper closed 5 months ago

ikcppdeveloper commented 5 months ago

It seems that when using EXP_FBX_EMBEDDED property when exporting FBX format viewer do not take this settings into account and use the media relative file path instead when loading textures.

Logs:

Mesh: Loading palm06.fbx. Assimp: Info, T0: Load palm06.fbx Assimp: Info, T0: Found a matching importer for this file format: Autodesk FBX Importer. Assimp: Info, T0: Import root directory is './' Assimp: Info, T0: Entering post processing pipeline Assimp: Info, T0: Points: 0, Lines: 0, Triangles: 1, Polygons: 0 (Meshes, X = removed) Assimp: Info, T0: Leaving post processing pipeline Texture 'palm06.fbx../../../../../../Data/matrix/obj/palm/palm06.png0.png': Loading 1 faces(PF_A8B8G8R8,256x256x1) with 8 hardware generated mipmaps from Image. Internal format is PF_A8B8G8R8,256x256x1. Error: preparing texture 'palm06.fbx../../../../../../Data/matrix/obj/palm/palm06.png./../../../../../Data/matrix/obj/palm/palm06.png.png'. Texture layer will be blank: Cannot locate resource palm06.fbx../../../../../../Data/matrix/obj/palm/palm06.png./../../../../../Data/matrix/obj/palm/palm06.png.png in resource group UserData.

Preview: image

Source: palm06.zip

Blender: image

Unity3D: image

Autodesk: image

Any suggestions of how to fix or have a workaround?

sercero commented 5 months ago
Texture 'palm06.fbx../../../../../../Data/matrix/obj/palm/palm06.png0.png': Loading 1 faces(PF_A8B8G8R8,256x256x1) with 8 hardware generated mipmaps from Image. Internal format is PF_A8B8G8R8,256x256x1.
Error: preparing texture 'palm06.fbx../../../../../../Data/matrix/obj/palm/palm06.png./../../../../../Data/matrix/obj/palm/palm06.png.png'. Texture layer will be blank: Cannot locate resource palm06.fbx../../../../../../Data/matrix/obj/palm/palm06.png./../../../../../Data/matrix/obj/palm/palm06.png.png in resource group UserData.

Well, aren't those some pretty paths... 😂

I don't know about that option, but can you try to export everything into a single folder and try again?

Also why is it that the name of the texture is palm06.png.png?

ikcppdeveloper commented 5 months ago

FBX SDK implements support to embed textures inside the fbx file using the EXP_FBX_EMBEDDED flag set to 'true' in the export settings, like if you use the raw buffers with 'image/png' mime type in glTF so the image will be stored inside the model file.

I checked the path value which is passed to the FBX SDK and it is a valid full file path, also you can check the file path's inside source fbx file, and it seems that they are also correct:

image

I don't know why the viewer shows such "strange" path's in logs :), but anyway why does importer use path's and tries to search texture file if it's embedded inside fbx file ...

image

Also when I don't use EXP_FBX_EMBEDDED setting the png file is placed beside the fbx file and all works as expected.

sercero commented 5 months ago

Do you know if this embedding of the textures is supported by ASSIMP?

OGRE uses that library to open FBX files because the native OGRE format is .mesh.

ikcppdeveloper commented 5 months ago

I'm not 100% sure but it's seems that yes

paroj commented 5 months ago

I'm not 100% sure but it's seems that yes

as per the docs, we should set AI_CONFIG_IMPORT_FBX_EMBEDDED_TEXTURES_LEGACY_NAMING