How to create a DAE file for use in SceneKit?

How to create a .dae file from a 3D model? I created a 3D model based on the drone range, and now I have a very large file that I can import into Photoshop, but I can’t figure out how to create a .dae file that can be used in SceneKit.

The default game example for Xcode is SceneKit, which shows a rotating aircraft, and the asset is a .dae file, but I don’t see documentation on how to create one of them from the 3D model and how to apply texture to it.

+7
source share
1 answer

To create a 3D model and export it to a Collada .dae file, you can do this if you use any of the following 3D authoring tools: Blender, Autodesk Maya, Autodesk 3dsMax, The Foundry Modo, Maxon Cinema 4D, SideFX Houdini, etc. .d. The easiest way is to use the nonprofit student version of Autodesk Maya 2018. It's free. You can download it from HERE .

There are countless examples on YouTube how to model and dodge the map in Maya software. Have a look at this example of Maya UV mapping . So, when your 3D model (and its UV texture) is ready for use, you can export it to one of four formats supported by SceneKit:

  • animated collage DAE
  • animated Pixar USDZ (supported on iOS 12 and above)
  • single-frame Sony Alembic
  • single-frame wavefront OBJ

enter image description here

In Maya Export Type your 3D geometry should have DAE_FBX export :

enter image description here

The texture for your model (square UV display 1K, 2K, 4K, etc.) you can export as a JPEG or PNG file. It might look like this:

enter image description here

You must assign this UV-square texture to the Diffuse slot of the properties in the Lighting Model (shader) in Show the Material Inspector.

enter image description here

And here is the Swift 4.1 code if you want to do this programmatically:

 let scene = SCNScene(named: "art.scnassets/mushroom.scn")! let mushroom = scene.rootNode.childNode(withName: "mushroom", recursively: true)! let mushroomMaterial = SCNMaterial() mushroomMaterial.diffuse.contents = UIImage(named: "mushroom.png") 

PS Work with the Pixar USD file format :

If you have a .usda model instead of .usdz for your 3D scene, you can convert .usda using the command line method in Terminal:

 xcrun usdz_convertor file.usda file.usdz 

The usdz_convertor method is only available with Xcode 10 installed.

+2
source

Source: https://habr.com/ru/post/1207314/


All Articles