Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Embedded textures not assigning to Materials in Python API 2020

Anonymous

Embedded textures not assigning to Materials in Python API 2020

Anonymous
Not applicable

Hi,

 

I am having trouble getting a texture to get embedded into my fbx file and assigned to the material. I am using the FBX API 2020.2 for Python in Ubuntu 18.04. I following the standard approach in the example here: https://help.autodesk.com/view/FBX/2019/ENU/?guid=FBX_Developer_Help_meshes_materials_and_textures_t...

 

I am able to create an .fbx file with an embedded texture. I can import it into unity and use the "Export Textures" to find my .png file. Also, I can see my material. The problem is that the texture is not assigned to the material diffuse channel as it should be .e.g using the line:

fbx_material.Diffuse.ConnectSrcObject(fbx_diffuse_texture)

 

To be clear, I cannot see my texture showing up in FBX Review.

 

While embedding textures seems to not be available in ASCII format (in 2020.2 anyways), I was able to debug the issue by looking at my .fbx file in ASCII compared to another ASCII .fbx file (from Mixamo) that somehow has an embedded texture (maybe previous versions of the API allowed this). I think I have tracked the problem down to an issue in the "Video:" object. When I copy the "Content: ," property of this other .fbx file, containing the binary texture data (encoded in ASCII) into my ASCII .fbx file, my .fbx file magically has a texture assigned to the material (which I can verify in FBX Review). 

So the challenge is that I don't know whats happening when I use the binary encoding. I would have assumed that the FBX API would have encoded my texture into this Content field of the Video object as I see done in the Mixamo .fbx file, but since I can't encode my own .fbx file in ASCII while embedding the texture, I have no idea.

 

Does anyone know if this is a legitimate bug or if there is something special you need to do to assign an embedded texture to a material?

 

Thanks,

 

Colin

0 Likes
Reply
380 Views
1 Reply
Reply (1)

regalir
Autodesk
Autodesk

Hi,

 

may I suggest you take a look at the ExportScene02 sample? I just modified the following lines :

 

    if len(sys.argv) > 1:
        lResult = FbxCommon.SaveScene(lSdkManager, lScene, sys.argv[1])
    # A default output file name is given otherwise.
    else:
        lResult = FbxCommon.SaveScene(lSdkManager, lScene, SAMPLE_FILENAME)

 

to

 

    if len(sys.argv) > 1:
        lResult = FbxCommon.SaveScene(lSdkManager, lScene, sys.argv[1], 1, True)
    # A default output file name is given otherwise.
    else:
        lResult = FbxCommon.SaveScene(lSdkManager, lScene, SAMPLE_FILENAME, 1, True)

 

and the generated file is in Ascii with embedded textures!

0 Likes