Exporting DAE animations for Scenekit

I checked out the FOX2 example for Scenekit that showcases the new animation protocol. I was rooting around in the character files trying to

discover how they were organizned, and noticed that the following files had no geometry only the rig for the animation and hence the animation

data as well.


These are the files that I'm referring to:


•max_idle.sc

•max_jump.scn

•max_spin.scn


How were these created and exported for Scenekit and with which exporter? Maya, Max, C4D? OpenCollada?

What are the recommended settings? How do you export just rigs and animation data for Scenekit without the model?


A shoutout to the Scenkit dev team: you guys are creating an amazing game engine(thank you), it's well organized and easy to use.


However but you're neglecting a very important aspect. There are no tutorials on how to export authored content files(modles with rigs and animation) for Scenekit. This is super important information, and without putting some more thought into how to teach people how to do this, your framework will continue to see very little adoption.

Please, please begin to address this. With ARKit combined with Scenekit you have good chance of seeing many people use this framework.

Replies

And as always, feel free to file feature requests via the bug reporter for things you like to see going forward.

This has been my major complain also, year after year they dont explain or post a clear workflow to export and import 3D assets to Scenekit

I could not agree more. This tech has great potential and yet there is barely anything that I have been able to find in the developer docs, or anywhere else for that matter, that clearly explains the recommended workflow to export 3d assets (with animation and rigs/deformers) into scenekit and how best to troubleshoot the inevitable bumps on the way.


Please, please, please Apple, help the people who want to help put your amazing tech on the pedestal it deserves.

"How were these created and exported for Scenekit and with which exporter? Maya, Max, C4D? OpenCollada?

What are the recommended settings? How do you export just rigs and animation data for Scenekit without the model?”


I haven’t been able to get dae with animations from OpenCollada and 3ds Max into Xcode (or the Preview app on Mac OS) directly, but, a possible working route is to go from 3ds Max FBX export to Blender to Blender DAE export to SceneKit.


I have not been able to go the first part working yet, 3ds Max to Blender yet and retain animations properly, but if I rig and animate something in Blender, it will appear and animate correctly in SceneKit. Where I can then remove the geometry, keep only the bone structure and its animation, and convert to .scn. The skinner object of the node with the geometry of the model contains the weights and how the model is linked to the bones. The bones itself contain the animation. In Blender you can delete the geometry and still export the bones separately but I haven't tested that yet.


"Please, please, please Apple, help the people who want to help put your amazing tech on the pedestal it deserves.”

Yes, well said.

Apple engineers* could create blog for ScneKit/ARKit/Metal stuff and call it Apple Game Development journal and let the community to enjoy and contribute. They already have done that but for ML (https://machinelearning.apple.com). The developer community would really appreciate that. And yeah, that is my main complain about this amazing technilogy - lack of "glue" that "sticks" the community together.

* - it could be specifically engineers, just a figure of speech

Were you able to come up with a usable workflow?


I'm looking to try to export animations from Maya to .dae file to use in SceneKit.


So far whenever I try to do that, I get a "file could not be opened" error -- in Xcode, when opening the .dae.


Any solution?

I'm having the same problem and it's really frustrating because I got it to work with XCode 9 for a short while. Now, XCode 10 can't even open my 3DS Max exported .dae files. For the models, exporting into alembic files (.abc) then to collada (.dae) seems to work, but it looks like the model looses it's "skin" and the mesh doesn't get animated by animations copied from a second collada file. Like everyone here, I'm asking Apple to give us a hint on a workable workflow from 3ds Max (as it is an industry standard tool) to Scenekit. Scenekit is amazing but the documentation isn't great and it's a major pain point!

Apparently in 2014, I successfully exported a rigged model and animations from 3ds max9 with the openCollada plugins to the DAE format. I have a base sample project running that demonstrates the loaded model and exported animations with data I created in 2014. Fast forward to 2018, I’m running into Xcode 10 and 9.4.1 crashing my Mac Pro in Mojave when attempting to preview assets that work in my app. The funny thing is that they don’t crash MacOS every time with an unusable beachballed system. Sometimes I’ll click on an asset and it appears for my interrogation in the UI. other times, it crashes with a beachball when attempting to display a preview. Whilst attempting to find a usable export path this weekend, I had 5 crashes in a row where I had to physically hold the power button to force a power off, before I gave up for the evening. I can say there is a method that supports the export from an old version of 3ds max. Getting back to that state with clearly unstable development tools is today’s challenge. I may be forced to install a legacy version of MacOS to get past the fubar preview crash.

Following up to my last post... I found an email detailing the missing sauce. ——— snip from 2014 ———- I’m working on sharing animations beween models / skins that have the same bones. This post talks how the exporter outputs our animations for each bone… and how to fix. http://stackoverflow.com/questions/24539607/how-can-i-export-dae-files-for-use-in-scene-kit-without-seeing-untitled-animati with this automator tool that allows for a right click and fix with an service from automator: https://drive.google.com/file/d/0B1_uvI21ZYGUaGdJckdwaTRZUEk/edit Once fixed this doc showed the format and how to name the animation with an ID: https://www.khronos.org/files/collada_spec_1_4.pdf from: to With that named - in the apple scenekitAnimations demo that Crashed loading a Nil structure with my files in the past, now loads and plays multiple animations for a file with their custom method: [self loadAnimation:ASCAnimationRun inSceneNamed:@“walk" withIdentifier:@"walkID”]; before this step,

Have you figured out that how to export only animation in .dae ?

  1. Download Blender for macOS

https://blender.org

  1. Install Collada Exporter plugin

https://github.com/godotengine/collada-exporter

  1. Download a .blend file containing animations

https://opengameart.org/content/bird

  1. Open the .blend file and click the Editor Type icon

  1. Select Nonlinear Animation

  1. Make sure the NLA Action strip (the animation) is unmuted by clicking the check icon next to the Animation Name.

DAE models only support one animation, so only one can be checked.

  1. Click File > Export > Better Collada (.dae)

  1. Toggle the Export Animation option and click Export DAE

Collada (DAE) only supports one animation per .dae file.

From Blender, save each animation (NLA Action strip) as a unique .dae file.

For example:

Bird_Idle.dae Bird_Walk.dae Bird_Fly.dae

Once you have the various .DAE files, each containing a single animation, you load the animation from a .DAE file with animation and play it in another without the animation:

    // MARK: - Animations -
    
    func loadAnimation(sceneName: String, extensionName: String, targetNode: SCNNode) {

        // source of .dae with animation

        let sceneURL = Bundle.main.url(forResource: sceneName, withExtension: extensionName)
        let sceneSource = SCNSceneSource(url: sceneURL!, options: nil)
        
        for key in sceneSource?.identifiersOfEntries(withClass: CAAnimation.self) ?? [] {
                        
            if let animationObj = sceneSource?.entryWithIdentifier(key,
                                                         withClass: CAAnimation.self) {
                                
                if animationObj.isKind(of: CAAnimationGroup.self) {
                    
                    animationObj.repeatCount = .infinity
                    animationObj.fadeInDuration = CGFloat(0)
                    animationObj.fadeOutDuration = CGFloat(0.0)
                                        
                   // play animation in target .dae node

                    playAnimation(animation: animationObj, node: targetNode)
                    
                    return
                    
                }
                
            }
                
        }

    }
    
    func playAnimation(animation: CAAnimation, node: SCNNode) {

        let player = SCNAnimationPlayer.init(animation: SCNAnimation.init(caAnimation: animation))
        
        node.addAnimationPlayer(player, forKey: "myAnimation")
                
        player.play()
                
    }

Example

        // idle
        
        self.loadAnimation(sceneName: "assets.scnassets/models/bird/bird_idle", extensionName: "dae", targetNode: birdNode)

        // walk
        
        self.loadAnimation(sceneName: "assets.scnassets/models/bird/bird_walk", extensionName: "dae", targetNode: birdNode)

        // fly
        
        self.loadAnimation(sceneName: "assets.scnassets/models/bird/bird_fly", extensionName: "dae", targetNode: birdNode)