You can find all relevant details at: Convert FBX to glTF, GLB, or vice versa using C#
Last active
September 28, 2023 17:39
-
-
Save aspose-com-gists/81b3c2b6c99bdfbe125cc828651731b0 to your computer and use it in GitHub Desktop.
C# Convert FBX to glTF GLB or glTF to FBX Programmatically in .NET
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initialize Scene class object. | |
Scene scene = new Scene(); | |
// Initiate FBXLoadOptions class object. | |
FBXLoadOptions opt = new FBXLoadOptions(); | |
// Output all properties defined in GlobalSettings in FBX file. | |
opt.KeepBuiltinGlobalSettings = true; | |
// Load input FBX file | |
scene.Open("test.FBX", opt); | |
// Export scene and embed the dependencies inside the target file. | |
GLTFSaveOptions options = new GLTFSaveOptions(FileContentType.ASCII); | |
options.EmbedAssets = true; | |
// Customize the name of the buffer file which defines model. | |
options.BufferFile = "mybuf.bin"; | |
// Save glTF file. | |
scene.Save(dataDir + "glTFSaveOptions_out.gltf", options); | |
// OR save GLB file using KHR_binary_glTF extension | |
scene.Save("glTFSaveOptions_out.glb", FileFormat.GLTF_Binary); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initialize Scene class object | |
Scene scene = new Scene(); | |
// Set glTF load options | |
GLTFLoadOptions loadOpt = new GLTFLoadOptions(); | |
scene.Open("Test.gltf", loadOpt); | |
// Initialize FBXSaveOptions object | |
FBXSaveOptions saveOpts = new FBXSaveOptions(FileFormat.FBX7500ASCII); | |
// Save output FBX file | |
scene.Save("output.fbx", saveOpts); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment