I am creating my C++ game engine and I wanted to be able to export my scenes using the FBX format.
So, when I tried to export an FBX from a previously imported OBJ file, that actually renders correctly. ItBut it is not exported correctly when exporting to anything other than what it was originally imported from.
std::unique_ptr<Assimp::Exporter> exporter = std::make_unique<Assimp::Exporter>(); const auto* scene = mesh->mScene; exporter->Export(scene, "fbx", "assets/output.fbx"); Here, mesh->mScene is the aiScene imported previously. This
This code actually works and Export() returns success, butsuccess; however, the output file does not include the proper data of the mesh. Only when imported from an FBX it is thenit correct and can be imported in Maya without problems.
I need a way to convert assimp aiSceneAssim::aiScene to be exported in the FBX format., because assimpAssimp only allows to export meshes to the same format as it is imported from.
Also, I wanted to be able to modify the meshes, let's say I want to replace the diffuse texture.
//Yeah, sorry I am still a beginner :) auto* aiMaterial = mesh->mScene->mMaterials[index]; if (aiMaterial->RemoveProperty("$clr.diffuse") != 0 || aiMaterial->AddProperty(texture->getPath().c_str(), 1, "$clr.diffuse") != 0) { assert(false, "Failed to add property!"); } This code also runs fine but it does not change anything in the mesh.