How to Convert .Dae to .Scn Files in Scenekit

how to convert .dae to .scn files in SceneKit

Exporting the .dae is unnecessary; you can place the object directly into a .scn file:

Sample Image

Create the new .scn file in the .scnassets folder, then drag the .dae file into the scene.

.DAE or .SCN files are not displaying correctly in Xcode

After converting a .dae model into .scn Xcode's native format, you need to apply all available textures to your 3D model via Properties slots in Material Inspector.

Sample Image

The best format for textures in Xcode could be .png (not a .tga), because .png files have relatively small size and can hold four channels – RGBA (.jpg holds only RGB).

You can't combine Albedo, AO, and Normals because these files are for different slots of Material Inspector: Albedo for diffuse color, AO for Ambient Occlusion soft shadows, Normals for bump effect.

Or, you can assign these textures programmatically using Swift 4.1:

let material = SCNMaterial()

material.diffuse.contents = UIImage(named: "Albedo.png")
material.ambientOcclusion.contents = UIImage(named: "AO.png")
material.normal.contents = UIImage(named: "Normals.png")

P.S. If you can't see any parts of your 3D model in Xcode's Scene Graph, there's a normals issue. You need to reverse polygon's normals in 3D authoring software.

Batch Converting Apple SCN files into DAE

You can try the xcrun command to run scntool and provide it input/output files, then the format.

xcrun scntool --convert fileIn.scn --output fileOut.dae --format dae


Related Topics



Leave a reply



Submit