0

In the WWDC 2015 fox demo, there is a SCN file representing the 3D fox. If you want to incorporate the fox in a different app, you import the fox's SCN file and its texture maps.

But if you have 3D characters made in an authoring program like Cinema 4D (https://www.maxon.net/en/products/cinema-4d/overview/), how do you generate similar SCN files for the different characters? Cinema4D cannot export SCN files like this so what do you do?

And does the process change if the characters are animated?

Crashalot
  • 33,605
  • 61
  • 269
  • 439

2 Answers2

1

Xcode supports collada (dae) files. You can import them into your assets folder and convert them to .scn files. Or Xcode will automatically convert them when you compile your app.

Collada files can also contain animation data, and can be exported from most 3D authoring programs.

James P
  • 4,786
  • 2
  • 35
  • 52
  • Cool thanks! Will the .DAE files also include all the relevant texture maps? – Crashalot Sep 01 '16 at 15:32
  • OK thanks so much! Also do you need to create different resolutions for the different devices (e.g., 3x, 2x) like you do with buttons or other visual assets? – Crashalot Sep 01 '16 at 16:10
  • DAE files can include texture maps, just include the texture in the assets folder. I don't think you need different resolutions, I've not seen it done in any examples. – James P Sep 02 '16 at 08:16
  • OK thanks! How do you use Xcode to convert the DAE file into a SCN file? Compiling the app doesn't do anything. – Crashalot Sep 02 '16 at 08:21
  • It does, if it loads in your scene Xcode has converted it. Otherwise you can go to the Editor dropdown menu and select Convert to SceneKit file format. – James P Sep 02 '16 at 08:42
  • Ah, so it will convert but still show the DAE file with the DAE extension? The only way that showed the file conversion in Xcode was using the Editor dropdown menu. – Crashalot Sep 02 '16 at 10:23
1

I'm using C4D r12, I imagine the process should be the same for later releases.

One option is to create a separate file for each character. Pay attention to the organization in the Object Manager: the hierarchy of objects as listed there will be the scene graph of nodes in your imported scene file. This includes nulls which will end up as container nodes in SceneKit. The names of your objects and nulls in C4D will be the names of the SCNNodes in the scene file. When you have this set up as desired, save via File > Export... > COLLADA(*.dae)

Alternatively, you could create all your characters with one file and then parse them in SceneKit using the unique name of that character's container node (previously a "container" null in C4D).

bpedit
  • 1,176
  • 8
  • 22
  • Cool thanks! Will the .DAE files also include all the relevant texture maps? – Crashalot Sep 01 '16 at 15:32
  • I think so. Thus far I've only assigned materials w/o textures in C4D, these were properly imported. I don't know if the export-to-COLLADA process re-formats textures, you might need to use a SceneKit compatible map within C4D. – bpedit Sep 01 '16 at 15:49
  • OK thanks so much! Also do you need to create different resolutions for the different devices (e.g., 3x, 2x) like you do with buttons or other visual assets? – Crashalot Sep 01 '16 at 16:10
  • My mistake, I have used a texture. It's stored in Xcode as a PNG separate from the DAE I suspect you could provide different resolutions, I didn't. I think I had to, within C4D, save the tex separately from the DAE (with the exact name, of course). I'm guessing the reference is stored in the DAE then the app's resources are automatically searched to find the tex. – bpedit Sep 01 '16 at 17:13
  • ok good to know about saving the textures separately. thanks! – Crashalot Sep 01 '16 at 20:02
  • How do you use Xcode to convert the DAE file into a SCN file? Compiling the app as someone suggested below doesn't do anything. – Crashalot Sep 02 '16 at 08:21
  • http://stackoverflow.com/questions/36490351/transform-and-rotate-in-scenekit/36512210#36512210 You only need the first line of code in that ansswer. Read on if you wish to assign parts of your scene to particular nodes. – bpedit Sep 02 '16 at 14:32
  • oh you don't access the DAE file as a reference node, but as a SCNScene? – Crashalot Sep 02 '16 at 19:58