2

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. But 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 code actually works and Export() returns success; however, the output file does not include the proper data of the mesh. Only when imported from an FBX is it correct and can be imported in Maya without problems.

I need a way to convert Assim::aiScene to be exported in the FBX format, because Assimp 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.

1 Answer 1

0

Assimp export is not related to the asset format of the data source, which was used to generate the aiScene instance.

So when not all the data will be exported the reason could be:

  • Data was modified by the post-processing and validation steps. You can find the missing information by checking the logs
  • The used exporter has an issue. To mitigate this issue you can open a bug report on the project space
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.