Aspose 3D for .NET
Version: 23.11.0
I’m having some issues when exporting an OBJ file. Ultimately, after some processing, I would like to be able to export the imported OBJ to either: OBJ, FBX or GLTF/GLB, depending on business logic factors.
It looks like the mapping of textures is incorrect. As a test, all I am doing is importing the OBJ, then exporting it without any processing. See images for before and after:
Original imported OBJ:
correct_input.jpg (48.8 KB)
exported OBJ:
incorrect_output.jpg (44.3 KB)
We can see that grass texture has been overlayed onto a car in the incorrect version. I have other examples which are much worse than the above, but the files are too big.
OBJ Load snippet:
var loadOpts = new ObjLoadOptions
{
FileName = fileName,
EnableMaterials = true
};
ModelScene = Scene.FromFile(filePath, loadOpts);
OBJ save snippet:
var saveOptions = new ObjSaveOptions
{
FileName = fileName,
Verbose = false,
ExportTextures = true,
EnableMaterials = true
};
ModelScene.Save(savePath, saveOptions);
Texture files are copied to the correct output directory using the above FYI. Here are the input and output files: (won’t upload - I’ll put in a separate post)
The original OBJ file seems to have a lot of redundant texture files, and the mtl file seems to point to a lot of redundant images also, but the OBJ is visually correct. This is because the user ‘cut out’ this OBJ from a larger OBJ file, and the mtl file kept these references. But it is a valid OBJ, and should be exporting correctly via Aspose.
What could be causing this issue?