Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.
I'm creating an FBX file and write it with texture. But when I want to move it on another PC the texture isn't loading because filepath for it has been obviously changed. I've decided to embed texture in FBX file. How can I do it?
Now it works so:
auto aPhongSurface = fbxsdk::FbxSurfacePhong::Create (&theScene, "");
fbxsdk::FbxFileTexture* aFBXTexture = fbxsdk::FbxFileTexture::Create (&theScene, "");
aFBXTexture->SetTextureUse (fbxsdk::FbxTexture::eStandard);
aFBXTexture->SetSwapUV (false);
aFBXTexture->SetMaterialUse (fbxsdk::FbxFileTexture::eModelMaterial);
aFBXTexture->SetAlphaSource (fbxsdk::FbxTexture::eNone);
aPhongSurface .Diffuse.ConnectSrcObject (a);
theNode.AddMaterial (aPhongSurface);
Also during writing I use
theTarget.SetBoolProp (EXP_FBX_TEXTURE, true);
But output model still contained only path references without embedded texture image.
Hello,
I tried exporting a model with non embedded texture using one of the examples (in particular ExportScene03)
with those options above, but no media were embedded in the output file.
I modified the example using this call in order to try embedding the texture:
The ExportScene03 sample worked for me when I set pEmbedMedia=true. You just need to be sure that the image files can be resolved. In this example, the file names of the textures being specified as: "scene03.jpg", "gradient.jpg" and "spotty.jpg", the FBX SDK will try to find them from the current executable directory (you can see it as "./scene03.jpg"). Depending on how you are setup when building & executing the sample, it is possible that the jpg files are not in the "working" directory. For example, if you are inside VisualStudio, make sure that the "Working Directory" in the "Debug" tab of the project is set to the same value as the "Output Directory" in the "General" tab.
I am using this in Unity, so it is a little different, but same concept. I am iterating through the models being exported and grabbing all the materials and texture files. Obviously they have to be specific and the path needs to be correct to them.
Ok thanks I found that my images were in a wrong absolute file path.
I put them in the correct file path and now external media are embedded.
Can't find what you're looking for? Ask the community or share your knowledge.