4
votes

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
Greetings! After conversion from .fbx to .dae, you should convert your .dae file into .scn file format inside XCode. Next step you need to add appropriate materials to every part of object in material inspector. You can easily use .tga as material. This should work. Best of luck!Eugene
Thanks for the reply. So I converted the .fbx to .dae. I then dragged them into the .scnassets folder. From there, I went to the editor menu, and converted them to .scn files. Unfortunately, whether they are .dae or .scn files, I cannot open the materials inspector to apply the texture to it. It just says it is Not Applicable. All the other inspectors work fine.burgoyne

1 Answers

3
votes

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.