As a first step I exported the model to OBJ (meshes only).
Please note that I had to perform the following changes:
- store geometry as an attribute when previewing
- add save button
- assign a name to each material else there was a crash when exporting
I want to have a textured mesh in standard GLTF format.
I can see two main options:
- Generate OBJ file along with MTL file and use some converter such as https://github.com/CesiumGS/obj2gltf or https://github.com/javagl/JglTF/tree/master/jgltf-obj
- When previewing, as we have one mesh node having N scan nodes as children with the texture information, we can maybe in some way export this scene kit node or the whole ARSCNView in apple format USDZ which can then be converted to GLTF.
Do you have any clue about the way I should process?
EDIT:
Update:
The second approach is the correct one, the following code allows to export the USDZ file with textured mesh:
let fileName = "Mesh"
let documentDirURL = try! FileManager.default.url(for: .documentDirectory,
in: .userDomainMask,
appropriateFor: nil,
create: true)
let fileURL = documentDirURL.appendingPathComponent(fileName).appendingPathExtension("usdz")
self.arView.scene.write(to: fileURL, options: nil, delegate: nil, progressHandler: nil)
As a first step I exported the model to OBJ (meshes only).
Please note that I had to perform the following changes:
I want to have a textured mesh in standard GLTF format.
I can see two main options:
Do you have any clue about the way I should process?
EDIT:
Update:
The second approach is the correct one, the following code allows to export the USDZ file with textured mesh: