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

Viewed 3825

I purchased a few 3D models to use in an app I am making. The purchased files came in a .fbx format, so I have converted them to .dae.

Unfortunately, when I put them into the art.scnassets folder in Xcode and view them, they just display as an orange outline of what the model should be. There is no texture. The same happens if I select the .dae then go to Editor, and "Convert to SceneKit scene file format (.scn).

I found the .tga files for the texture of the models. Each model has 3 .tga texture files (albedo, ao, and normals). Can I combine these files to make one texture for use in Xcode?

Also, when the 3d model is selected, I cannot open the material inspector, it says it is Not Applicable. I have always used the material inspector to apply the texture file to the specific model.

1 Answers

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.

enter image description here

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.

Related