Export texture files while saving 3D scene
To export a scene and ensure that all associated textures are saved to the same directory, follow these steps:
Scene scene = Scene.FromFile(@"BoomBox.glb");
var opt = new ObjSaveOptions();
opt.ExportTextures = true;
scene.Save(@"D:\tmp\boombox\output.obj", opt);
All SaveOptions
objects in Aspose.3D include the ExportTextures
property, which simplifies the process of managing textures during export. This property ensures that all textures, whether external or embedded, are saved to the specified output directory. This feature is compatible with various file formats that support texture exporting, such as FBX, 3DS, OBJ, USD, GLTF, and DAE.
Explanation
- Load the Scene: The scene is loaded from the input file.
- Configure Save Options: Set
ExportTextures
totrue
. - Export the Scene: The scene is saved to the output directory with the updated texture paths.
By leveraging the ExportTextures
property in SaveOptions
, you can seamlessly export 3D scenes along with their textures, ensuring that all necessary assets are organized in a single directory. This feature enhances the portability and ease of use of 3D files across various platforms and applications.