Any easy explanation about how Model I/O works combined wiht Scenekit?

Hello as the topic says, is there anyone who cna explain me how to use Model I/O to import models DAE or OBJ and how to use it with scenekit?

Replies

Well, yesterday's WWDC video has already been posted:


https://developer.apple.com/videos/wwdc/2015/?id=602


I haven't watched it yet, but I'd assume it's exactly the explanation you're looking for.

Is there any code examples anywhere? I foudn the one of fox with scenekit but seems they not use model IO

Hi Josepadilla,


We are currently working on releasing sample code that demonstrates how to use Model I/O + Scenekit.


Thank you.

Hi Josepadilla,


Thank you for reaching out.


You will want to leverage the various MDL <--> SCN methods. For example, you can create an MDLAsset from an SCNScene by calling the MDLAsset class member assetWithSCNScene. An SCNScene can be created from various file formats, please check SCNSceneSource Class Reference for a list of supported formats. Likewise, you can create an SCNScene from an MDLAsset by calling the SCNScene class member sceneWithMDLAsset. To create an MDLAsset and for information on supported file formats please check MDLAsset Class Reference.


There are similar functions for SCNCamera/MDLCamera, SCNLight/MDLLight, MDLMaterial/SCNMaterial, SCNGeometry/MDLMesh, etc. These functions allow you to easily move between Model I/O obejcts and SceneKit objects.


I hope you have found this informatiaon helpful.

Hi Josepadilla,


Thank you for your patience. Sample code has been released and can be found out https://developer.apple.com/library/mac/samplecode/VoxelPanda/Introduction/Intro.html


Please feel free to reach out to us with any other questions or concerns.

Hi VCR,


I loaded a DAE->SCN

Then I tried to go SCN->MDL.

But doing so seems to create items which are not using the buffer allocator, and I could not use them for Metal rendering.


Am I missing something?

Yeah. Model I/O is a statement of intent, not a finished service.


Think of it like that memorandum you get after a meeting that lists the contents of the meeting.

I downloaded this and testing it on XCode 9 Beta, and seems to always crash on me. With this error message:


Assertion failed: ([url isKindOfClass:NSURL.class]), function -[AAPLSceneViewController voxelize:], file /Users/justme/Documents/_DEVELOPMENT/VoxelPandaGettingStartedwithVoxelsUsingModelIOandSceneKit/VoxelPanda/VoxelPanda/AAPLSceneViewController.m, line 79.

(lldb)

Maybe my MacBookPro is too old?

The assert is failing because is returning an NSString instead of NSURL.


Try

        NSURL *url = [NSURL URLWithString: _character.childNodes[0].geometry.firstMaterial.diffuse.contents];