[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6E6MJJF8NSKXDP8FTAXC5JH":3,"skill-same:01M6E6MJJF8NSKXDP8FTAXC5JH":63},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":33,"linkOnly":34,"markdownContent":35,"markdownBody":36,"frontMatter":37,"refName":40,"commitSha":41,"skillDirectory":42,"forksCount":43,"repositoryHtmlUrl":44,"repositoryHomepageUrl":45,"ownerHtmlUrl":46,"ownerBlogUrl":6,"ownerDescription":47,"updatedAt":48,"install":49,"resources":62},"01M6E6MJJF8NSKXDP8FTAXC5JH","axiom-scenekit",null,"Use when working with SceneKit 3D scenes, migrating SceneKit to RealityKit, or maintaining legacy SceneKit code. Covers scene graph, materials, physics, animation, SwiftUI bridge, migration decision tree.","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FCharlesWiltgen\u002FAxiom\u002Faxiom-scenekit\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32],"scenekit","axiom scenekit","code","graph","Animation","3D","swiftui","decision","bridge","use","migration","Legacy","scenes","physics","2026-11-10 10:12:30",false,"---\nname: axiom-scenekit\ndescription: Use when working with SceneKit 3D scenes, migrating SceneKit to RealityKit, or maintaining legacy SceneKit code. Covers scene graph, materials, physics, animation, SwiftUI bridge, migration decision tree.\nlicense: MIT\nmetadata:\n  version: \"1.0.0\"\n---\n\n# SceneKit Development Guide\n\n**Purpose**: Maintain existing SceneKit code safely and plan migration to RealityKit\n**iOS Version**: iOS 8+ (SceneKit), deprecated iOS 26+\n**Xcode**: Xcode 15+\n\n## When to Use This Skill\n\nUse this skill when:\n- Maintaining existing SceneKit code\n- Building a SceneKit prototype (with awareness of deprecation)\n- Planning migration from SceneKit to RealityKit\n- Debugging SceneKit rendering, physics, or animation issues\n- Integrating SceneKit content with SwiftUI\n- Loading 3D models via Model I\u002FO or SCNSceneSource\n\nDo NOT use this skill for:\n- New 3D projects (use `axiom-realitykit`)\n- AR experiences (use `axiom-realitykit`)\n- visionOS development (use `axiom-realitykit`)\n- SpriteKit 2D games (`axiom-spritekit`)\n- Metal shader programming (`axiom-metal-migration-ref`)\n\n---\n\n## Deprecation Context\n\nSceneKit is **soft-deprecated as of iOS 26** (WWDC 2025). This means:\n- Existing apps continue to work\n- No new features or general bug fixes\n- Only critical security patches\n- `SceneView` (SwiftUI) is formally deprecated in iOS 26\n\n**Apple's forward path is RealityKit.** All new 3D projects should use RealityKit. SceneKit knowledge remains valuable for maintaining legacy code and understanding concepts during migration.\n\n**In RealityKit**: ECS architecture replaces scene graph. See `axiom-scenekit-ref` for the complete concept mapping table.\n\n---\n\n## 1. Mental Model\n\n### Scene Graph Architecture\n\nSceneKit uses a **tree of nodes** (SCNNode) attached to a root node in an SCNScene. Each node has a transform (position, rotation, scale) relative to its parent.\n\n```\nSCNScene\n└── rootNode\n    ├── cameraNode (SCNCamera)\n    ├── lightNode (SCNLight)\n    ├── playerNode (SCNGeometry + SCNPhysicsBody)\n    │   ├── weaponNode\n    │   └── particleNode (SCNParticleSystem)\n    └── environmentNode\n        ├── groundNode\n        └── wallNodes\n```\n\n**In RealityKit**: Entities replace nodes. Components replace node properties. The hierarchy concept persists, but behavior is driven by Systems rather than node callbacks.\n\n### Coordinate System\n\nSceneKit uses a **right-handed Y-up** coordinate system:\n\n```\n     +Y (up)\n      |\n      |\n      +──── +X (right)\n     \u002F\n    \u002F\n  +Z (toward viewer)\n```\n\nThis matches RealityKit's coordinate system, so spatial concepts transfer directly during migration.\n\n### Transform Hierarchy\n\nTransforms cascade parent → child. A child's world transform = parent's world transform × child's local transform.\n\n```swift\nlet parent = SCNNode()\nparent.position = SCNVector3(10, 0, 0)\n\nlet child = SCNNode()\nchild.position = SCNVector3(0, 5, 0)\nparent.addChildNode(child)\n\n\u002F\u002F child.worldPosition = (10, 5, 0)\n\u002F\u002F child.position (local) = (0, 5, 0)\n```\n\n**In RealityKit**: Same concept. `entity.position` is local, `entity.position(relativeTo: nil)` gives world position.\n\n---\n\n## 2. Scene Setup and Rendering\n\n### SCNView (UIKit)\n\n```swift\nlet sceneView = SCNView(frame: view.bounds)\nsceneView.scene = SCNScene(named: \"scene.scn\")\nsceneView.allowsCameraControl = true\nsceneView.showsStatistics = true\nsceneView.backgroundColor = .black\nview.addSubview(sceneView)\n```\n\n### SceneView (SwiftUI) — Deprecated iOS 26\n\n```swift\n\u002F\u002F Still works but deprecated. Use SCNViewRepresentable for new code.\nimport SceneKit\n\nSceneView(\n    scene: scene,\n    pointOfView: cameraNode,\n    options: [.allowsCameraControl, .autoenablesDefaultLighting]\n)\n```\n\n### SCNViewRepresentable (SwiftUI replacement)\n\n```swift\nstruct SceneKitView: UIViewRepresentable {\n    let scene: SCNScene\n\n    func makeUIView(context: Context) -> SCNView {\n        let view = SCNView()\n        view.scene = scene\n        view.allowsCameraControl = true\n        view.autoenablesDefaultLighting = true\n        return view\n    }\n\n    func updateUIView(_ view: SCNView, context: Context) {}\n}\n```\n\n**In RealityKit**: Use `RealityView` in SwiftUI — no UIViewRepresentable needed.\n\n---\n\n## 3. Geometry and Materials\n\n### Built-in Geometries\n\n```swift\nlet box = SCNBox(width: 1, height: 1, length: 1, chamferRadius: 0.1)\nlet sphere = SCNSphere(radius: 0.5)\nlet cylinder = SCNCylinder(radius: 0.3, height: 1)\nlet plane = SCNPlane(width: 2, height: 2)\nlet torus = SCNTorus(ringRadius: 1, pipeRadius: 0.3)\nlet capsule = SCNCapsule(capRadius: 0.3, height: 1)\nlet cone = SCNCone(topRadius: 0, bottomRadius: 0.5, height: 1)\nlet tube = SCNTube(innerRadius: 0.3, outerRadius: 0.5, height: 1)\nlet text = SCNText(string: \"Hello\", extrusionDepth: 0.2)\n```\n\n### PBR Materials\n\n```swift\nlet material = SCNMaterial()\nmaterial.lightingModel = .physicallyBased\nmaterial.diffuse.contents = UIColor.red          \u002F\u002F or UIImage\nmaterial.metalness.contents = 0.8\nmaterial.roughness.contents = 0.2\nmaterial.normal.contents = UIImage(named: \"normal_map\")\nmaterial.ambientOcclusion.contents = UIImage(named: \"ao_map\")\n\nlet node = SCNNode(geometry: sphere)\nnode.geometry?.firstMaterial = material\n```\n\n**In RealityKit**: Use `PhysicallyBasedMaterial` with similar properties but different API surface. See `axiom-scenekit-ref` Part 1 for the mapping.\n\n### Shader Modifiers\n\nSceneKit supports GLSL\u002FMetal shader snippets injected at specific entry points:\n\n```swift\n\u002F\u002F Fragment modifier — custom effect on surface\nmaterial.shaderModifiers = [\n    .fragment: \"\"\"\n    float stripe = sin(_surface.position.x * 20.0);\n    _output.color.rgb *= step(0.0, stripe);\n    \"\"\"\n]\n```\n\nEntry points: `.geometry`, `.surface`, `.lightingModel`, `.fragment`\n\n**In RealityKit**: Use `ShaderGraphMaterial` with Reality Composer Pro, or `CustomMaterial` with Metal functions.\n\n---\n\n## 4. Lighting\n\n### Light Types\n\n| Type | Description | Shadows |\n|------|-------------|---------|\n| `.omni` | Point light, radiates in all directions | No |\n| `.directional` | Parallel rays (sun) | Yes |\n| `.spot` | Cone-shaped beam | Yes |\n| `.area` | Rectangle emitter (soft shadows) | Yes |\n| `.IES` | Real-world light profile | Yes |\n| `.ambient` | Uniform, no direction | No |\n| `.probe` | Environment lighting from cubemap | No |\n\n```swift\nlet light = SCNLight()\nlight.type = .directional\nlight.intensity = 1000\nlight.castsShadow = true\nlight.shadowRadius = 3\nlight.shadowSampleCount = 8\n\nlet lightNode = SCNNode()\nlightNode.light = light\nlightNode.eulerAngles = SCNVector3(-Float.pi \u002F 4, 0, 0)\nscene.rootNode.addChildNode(lightNode)\n```\n\n**In RealityKit**: Use `DirectionalLightComponent`, `PointLightComponent`, `SpotLightComponent` as components on entities. Image-based lighting via `EnvironmentResource`.\n\n---\n\n## 5. Animation\n\n### SCNAction (Declarative)\n\n```swift\nlet moveUp = SCNAction.moveBy(x: 0, y: 2, z: 0, duration: 1)\nlet fadeOut = SCNAction.fadeOut(duration: 0.5)\nlet sequence = SCNAction.sequence([moveUp, fadeOut])\nlet forever = SCNAction.repeatForever(moveUp.reversed())\nnode.runAction(sequence)\n```\n\n### Implicit Animation (SCNTransaction)\n\n```swift\nSCNTransaction.begin()\nSCNTransaction.animationDuration = 0.5\nnode.position = SCNVector3(0, 5, 0)\nnode.opacity = 0.5\nSCNTransaction.commit()\n```\n\n### Explicit Animation (CAAnimation bridge)\n\n```swift\nlet animation = CABasicAnimation(keyPath: \"rotation\")\nanimation.toValue = NSValue(scnVector4: SCNVector4(0, 1, 0, Float.pi * 2))\nanimation.duration = 2\nanimation.repeatCount = .infinity\nnode.addAnimation(animation, forKey: \"spin\")\n```\n\n### Loading Animations from Files\n\n```swift\nlet scene = SCNScene(named: \"character.dae\")!\nlet animationPlayer = scene.rootNode\n    .childNode(withName: \"mixamorig:Hips\", recursively: true)!\n    .animationPlayer(forKey: nil)!\n\ncharacterNode.addAnimationPlayer(animationPlayer, forKey: \"walk\")\nanimationPlayer.play()\n```\n\n**In RealityKit**: Use `entity.playAnimation()` with animations loaded from USD files. Transform animations via `entity.move(to:relativeTo:duration:)`.\n\n---\n\n## 6. Physics\n\n### Physics Bodies\n\n```swift\n\u002F\u002F Dynamic — simulation controls position\nnode.physicsBody = SCNPhysicsBody(type: .dynamic,\n    shape: SCNPhysicsShape(geometry: node.geometry!, options: nil))\n\n\u002F\u002F Static — immovable collision surface\nground.physicsBody = SCNPhysicsBody(type: .static, shape: nil)\n\n\u002F\u002F Kinematic — code controls position, participates in collisions\nplatform.physicsBody = SCNPhysicsBody(type: .kinematic, shape: nil)\n```\n\n### Collision Categories\n\n```swift\nstruct PhysicsCategory {\n    static let player:    Int = 1 \u003C\u003C 0   \u002F\u002F 1\n    static let enemy:     Int = 1 \u003C\u003C 1   \u002F\u002F 2\n    static let projectile: Int = 1 \u003C\u003C 2  \u002F\u002F 4\n    static let wall:      Int = 1 \u003C\u003C 3   \u002F\u002F 8\n}\n\nplayerNode.physicsBody?.categoryBitMask = PhysicsCategory.player\nplayerNode.physicsBody?.collisionBitMask = PhysicsCategory.wall | PhysicsCategory.enemy\nplayerNode.physicsBody?.contactTestBitMask = PhysicsCategory.enemy | PhysicsCategory.projectile\n```\n\n### Contact Delegate\n\n```swift\nclass GameScene: SCNScene, SCNPhysicsContactDelegate {\n    func setupPhysics() {\n        physicsWorld.contactDelegate = self\n    }\n\n    func physicsWorld(_ world: SCNPhysicsWorld,\n                      didBegin contact: SCNPhysicsContact) {\n        let nodeA = contact.nodeA\n        let nodeB = contact.nodeB\n        \u002F\u002F Handle collision\n    }\n}\n```\n\n**In RealityKit**: Use `PhysicsBodyComponent`, `CollisionComponent`, and collision event subscriptions via `scene.subscribe(to: CollisionEvents.Began.self)`.\n\n---\n\n## 7. Hit Testing and Interaction\n\n```swift\n\u002F\u002F In SCNView tap handler\nlet results = sceneView.hitTest(tapLocation, options: [\n    .searchMode: SCNHitTestSearchMode.closest.rawValue,\n    .boundingBoxOnly: false\n])\n\nif let hit = results.first {\n    let tappedNode = hit.node\n    let worldPosition = hit.worldCoordinates\n}\n```\n\n**In RealityKit**: Use `ManipulationComponent` for drag\u002Frotate\u002Fscale gestures, or collision-based hit testing.\n\n---\n\n## 8. Asset Pipeline\n\n### Supported Formats\n\n| Format | Extension | Notes |\n|--------|-----------|-------|\n| USD\u002FUSDZ | `.usdz`, `.usda`, `.usdc` | Preferred format, works in both SceneKit and RealityKit |\n| Collada | `.dae` | Legacy, still supported |\n| SceneKit Archive | `.scn` | Xcode-specific, not portable to RealityKit |\n| Wavefront OBJ | `.obj` | Geometry only, no animations |\n| Alembic | `.abc` | Animation baking |\n\n### Loading Models\n\n```swift\n\u002F\u002F From bundle\nlet scene = SCNScene(named: \"model.usdz\")!\n\n\u002F\u002F From URL\nlet scene = try SCNScene(url: modelURL, options: nil)\n\n\u002F\u002F Via Model I\u002FO (for format conversion)\nlet asset = MDLAsset(url: modelURL)\nlet scene = SCNScene(mdlAsset: asset)\n```\n\n**Migration tip**: Convert `.scn` files to `.usdz` using `xcrun scntool --convert file.scn --format usdz` before migrating to RealityKit.\n\n---\n\n## 9. ARKit Integration (Legacy)\n\n```swift\n\u002F\u002F ARSCNView — SceneKit + ARKit (legacy approach)\nlet arView = ARSCNView(frame: view.bounds)\narView.delegate = self\narView.session.run(ARWorldTrackingConfiguration())\n\n\u002F\u002F Adding virtual content at anchors\nfunc renderer(_ renderer: SCNSceneRenderer,\n              didAdd node: SCNNode, for anchor: ARAnchor) {\n    let box = SCNBox(width: 0.1, height: 0.1, length: 0.1, chamferRadius: 0)\n    node.addChildNode(SCNNode(geometry: box))\n}\n```\n\n**In RealityKit**: Use `RealityView` with `AnchorEntity` types. ARSCNView is legacy — all new AR development should use RealityKit.\n\n---\n\n## 10. Anti-Patterns\n\n### Anti-Pattern 1: Starting New Projects in SceneKit\n\n**Time cost**: Weeks of rework when you eventually must migrate\n\nSceneKit is deprecated. New projects should use RealityKit from the start, even if the learning curve is steeper initially.\n\n### Anti-Pattern 2: Using .scn Files Without USDZ Conversion\n\n**Time cost**: Hours when migration begins\n\n`.scn` files are SceneKit-specific and cannot be loaded in RealityKit. Convert early:\n```bash\nxcrun scntool --convert model.scn --format usdz --output model.usdz\n```\n\n### Anti-Pattern 3: Deep Shader Modifier Customization\n\n**Time cost**: Complete rewrite during migration\n\nSceneKit shader modifiers use a proprietary entry-point system. Heavy investment here has zero portability to RealityKit's `ShaderGraphMaterial`.\n\n### Anti-Pattern 4: Relying on SCNRenderer for Custom Pipelines\n\n**Time cost**: Architecture redesign during migration\n\nIf you need custom render pipelines, build on Metal directly or use `RealityRenderer` (RealityKit's Metal-level API).\n\n### Anti-Pattern 5: Ignoring Deprecation Warnings\n\n**Time cost**: Surprise breakage when Apple removes APIs\n\nTrack `SceneView` deprecation warnings and plan UIViewRepresentable fallback or RealityKit migration.\n\n### Anti-Pattern 6: Creating Hundreds of Nodes in a Loop\n\n**Time cost**: 2-4 hours debugging frame drops, often misdiagnosed as GPU issue\n\n```swift\n\u002F\u002F ❌ WRONG: Each SCNNode has overhead (transform, bounding box, hit test)\nfor i in 0..\u003C500 {\n    let node = SCNNode(geometry: SCNSphere(radius: 0.05))\n    node.position = randomPosition()\n    scene.rootNode.addChildNode(node)  \u002F\u002F 500 nodes = terrible frame rate\n}\n\n\u002F\u002F ✅ RIGHT: Use SCNParticleSystem for particle-like effects\nlet particles = SCNParticleSystem()\nparticles.birthRate = 500\nparticles.particleSize = 0.05\nparticles.emitterShape = SCNBox(width: 5, height: 5, length: 5, chamferRadius: 0)\nparticleNode.addParticleSystem(particles)\n\n\u002F\u002F ✅ RIGHT: Use geometry instancing for identical objects\nlet source = SCNGeometrySource(\u002F* instance transforms *\u002F)\ngeometry.levelsOfDetail = [SCNLevelOfDetail(geometry: lowPoly, screenSpaceRadius: 20)]\n```\n\n**Rule**: If >50 identical objects, use SCNParticleSystem or flatten geometry. If different objects, use `SCNNode.flattenedClone()` to reduce draw calls.\n\n---\n\n## 11. Migration Decision Tree\n\n```\nShould you migrate to RealityKit?\n│\n├─ Is this a new project?\n│   └─ YES → Use RealityKit from the start. No question.\n│\n├─ Does the app need AR features?\n│   └─ YES → Migrate. ARSCNView is legacy, RealityKit is the only forward path.\n│\n├─ Does the app target visionOS?\n│   └─ YES → Must migrate. SceneKit doesn't support visionOS spatial features.\n│\n├─ Is the codebase heavily invested in SceneKit?\n│   ├─ YES, and app is stable → Maintain in SceneKit for now, plan phased migration.\n│   └─ YES, but needs new features → Migrate incrementally (new features in RealityKit).\n│\n├─ Is performance a concern?\n│   └─ YES → RealityKit is optimized for Apple Silicon with Metal-first rendering.\n│\n└─ Is the app in maintenance mode?\n    └─ YES → Keep SceneKit until critical. Security patches will continue.\n```\n\n---\n\n## 12. Pressure Scenarios\n\n### Scenario 1: \"Just Use SceneKit, It Works Fine\"\n\n**Pressure**: Team familiarity with SceneKit, deadline to ship\n\n**Wrong approach**: Start new project in SceneKit because the team knows it.\n\n**Correct approach**: Invest in RealityKit learning. SceneKit will receive no new features. The longer you wait, the larger the migration debt.\n\n**Push-back template**: \"SceneKit is deprecated as of iOS 26. Starting new work in it creates migration debt that grows with every feature we add. RealityKit's ECS model is different but learnable — let's invest the time now.\"\n\n### Scenario 2: \"We Don't Have Time to Learn RealityKit\"\n\n**Pressure**: Tight deadline, team unfamiliar with ECS\n\n**Wrong approach**: Build everything in SceneKit to meet the deadline.\n\n**Correct approach**: Build the prototype in SceneKit if necessary, but document every SceneKit dependency and plan the migration. Use USDZ assets from the start so they're portable.\n\n**Push-back template**: \"Let's use USDZ assets and keep the SceneKit layer thin. When we migrate, the assets transfer directly and only the code layer changes.\"\n\n### Scenario 3: \"Port Everything At Once\"\n\n**Pressure**: Desire for a clean migration\n\n**Wrong approach**: Attempt to rewrite the entire SceneKit codebase in RealityKit at once.\n\n**Correct approach**: Migrate incrementally. New features in RealityKit. Existing SceneKit code stays until it needs changes. Modularize with Swift packages (per Apple's migration guide).\n\n**Push-back template**: \"Apple's own migration guide recommends modularizing into Swift packages and migrating system by system. A big-bang rewrite risks introducing new bugs across the entire app.\"\n\n---\n\n## Code Review Checklist\n\n- [ ] No new SceneKit code in projects targeting iOS 26+ without migration plan\n- [ ] Assets in USDZ format (not .scn) for portability\n- [ ] No deep shader modifier customization without RealityKit equivalent identified\n- [ ] SCNTransaction used for implicit animations (not direct property changes without animation context)\n- [ ] Physics categoryBitMask explicitly set (not relying on defaults)\n- [ ] Contact delegate set and protocol conformance added\n- [ ] `[weak self]` in completion handlers and closures\n- [ ] Debug overlays enabled during development (`showsStatistics = true`)\n\n---\n\n## Resources\n\n**WWDC**: 2014-609, 2014-610, 2017-604, 2019-612\n\n**Docs**: \u002Fscenekit, \u002Fscenekit\u002Fscnscene, \u002Fscenekit\u002Fscnnode, \u002Fscenekit\u002Fscnmaterial, \u002Fscenekit\u002Fscnphysicsbody\n\n**Skills**: axiom-scenekit-ref, axiom-realitykit, axiom-realitykit-ref\n\n","# SceneKit Development Guide\n\n**Purpose**: Maintain existing SceneKit code safely and plan migration to RealityKit\n**iOS Version**: iOS 8+ (SceneKit), deprecated iOS 26+\n**Xcode**: Xcode 15+\n\n## When to Use This Skill\n\nUse this skill when:\n- Maintaining existing SceneKit code\n- Building a SceneKit prototype (with awareness of deprecation)\n- Planning migration from SceneKit to RealityKit\n- Debugging SceneKit rendering, physics, or animation issues\n- Integrating SceneKit content with SwiftUI\n- Loading 3D models via Model I\u002FO or SCNSceneSource\n\nDo NOT use this skill for:\n- New 3D projects (use `axiom-realitykit`)\n- AR experiences (use `axiom-realitykit`)\n- visionOS development (use `axiom-realitykit`)\n- SpriteKit 2D games (`axiom-spritekit`)\n- Metal shader programming (`axiom-metal-migration-ref`)\n\n---\n\n## Deprecation Context\n\nSceneKit is **soft-deprecated as of iOS 26** (WWDC 2025). This means:\n- Existing apps continue to work\n- No new features or general bug fixes\n- Only critical security patches\n- `SceneView` (SwiftUI) is formally deprecated in iOS 26\n\n**Apple's forward path is RealityKit.** All new 3D projects should use RealityKit. SceneKit knowledge remains valuable for maintaining legacy code and understanding concepts during migration.\n\n**In RealityKit**: ECS architecture replaces scene graph. See `axiom-scenekit-ref` for the complete concept mapping table.\n\n---\n\n## 1. Mental Model\n\n### Scene Graph Architecture\n\nSceneKit uses a **tree of nodes** (SCNNode) attached to a root node in an SCNScene. Each node has a transform (position, rotation, scale) relative to its parent.\n\n```\nSCNScene\n└── rootNode\n    ├── cameraNode (SCNCamera)\n    ├── lightNode (SCNLight)\n    ├── playerNode (SCNGeometry + SCNPhysicsBody)\n    │   ├── weaponNode\n    │   └── particleNode (SCNParticleSystem)\n    └── environmentNode\n        ├── groundNode\n        └── wallNodes\n```\n\n**In RealityKit**: Entities replace nodes. Components replace node properties. The hierarchy concept persists, but behavior is driven by Systems rather than node callbacks.\n\n### Coordinate System\n\nSceneKit uses a **right-handed Y-up** coordinate system:\n\n```\n     +Y (up)\n      |\n      |\n      +──── +X (right)\n     \u002F\n    \u002F\n  +Z (toward viewer)\n```\n\nThis matches RealityKit's coordinate system, so spatial concepts transfer directly during migration.\n\n### Transform Hierarchy\n\nTransforms cascade parent → child. A child's world transform = parent's world transform × child's local transform.\n\n```swift\nlet parent = SCNNode()\nparent.position = SCNVector3(10, 0, 0)\n\nlet child = SCNNode()\nchild.position = SCNVector3(0, 5, 0)\nparent.addChildNode(child)\n\n\u002F\u002F child.worldPosition = (10, 5, 0)\n\u002F\u002F child.position (local) = (0, 5, 0)\n```\n\n**In RealityKit**: Same concept. `entity.position` is local, `entity.position(relativeTo: nil)` gives world position.\n\n---\n\n## 2. Scene Setup and Rendering\n\n### SCNView (UIKit)\n\n```swift\nlet sceneView = SCNView(frame: view.bounds)\nsceneView.scene = SCNScene(named: \"scene.scn\")\nsceneView.allowsCameraControl = true\nsceneView.showsStatistics = true\nsceneView.backgroundColor = .black\nview.addSubview(sceneView)\n```\n\n### SceneView (SwiftUI) — Deprecated iOS 26\n\n```swift\n\u002F\u002F Still works but deprecated. Use SCNViewRepresentable for new code.\nimport SceneKit\n\nSceneView(\n    scene: scene,\n    pointOfView: cameraNode,\n    options: [.allowsCameraControl, .autoenablesDefaultLighting]\n)\n```\n\n### SCNViewRepresentable (SwiftUI replacement)\n\n```swift\nstruct SceneKitView: UIViewRepresentable {\n    let scene: SCNScene\n\n    func makeUIView(context: Context) -> SCNView {\n        let view = SCNView()\n        view.scene = scene\n        view.allowsCameraControl = true\n        view.autoenablesDefaultLighting = true\n        return view\n    }\n\n    func updateUIView(_ view: SCNView, context: Context) {}\n}\n```\n\n**In RealityKit**: Use `RealityView` in SwiftUI — no UIViewRepresentable needed.\n\n---\n\n## 3. Geometry and Materials\n\n### Built-in Geometries\n\n```swift\nlet box = SCNBox(width: 1, height: 1, length: 1, chamferRadius: 0.1)\nlet sphere = SCNSphere(radius: 0.5)\nlet cylinder = SCNCylinder(radius: 0.3, height: 1)\nlet plane = SCNPlane(width: 2, height: 2)\nlet torus = SCNTorus(ringRadius: 1, pipeRadius: 0.3)\nlet capsule = SCNCapsule(capRadius: 0.3, height: 1)\nlet cone = SCNCone(topRadius: 0, bottomRadius: 0.5, height: 1)\nlet tube = SCNTube(innerRadius: 0.3, outerRadius: 0.5, height: 1)\nlet text = SCNText(string: \"Hello\", extrusionDepth: 0.2)\n```\n\n### PBR Materials\n\n```swift\nlet material = SCNMaterial()\nmaterial.lightingModel = .physicallyBased\nmaterial.diffuse.contents = UIColor.red          \u002F\u002F or UIImage\nmaterial.metalness.contents = 0.8\nmaterial.roughness.contents = 0.2\nmaterial.normal.contents = UIImage(named: \"normal_map\")\nmaterial.ambientOcclusion.contents = UIImage(named: \"ao_map\")\n\nlet node = SCNNode(geometry: sphere)\nnode.geometry?.firstMaterial = material\n```\n\n**In RealityKit**: Use `PhysicallyBasedMaterial` with similar properties but different API surface. See `axiom-scenekit-ref` Part 1 for the mapping.\n\n### Shader Modifiers\n\nSceneKit supports GLSL\u002FMetal shader snippets injected at specific entry points:\n\n```swift\n\u002F\u002F Fragment modifier — custom effect on surface\nmaterial.shaderModifiers = [\n    .fragment: \"\"\"\n    float stripe = sin(_surface.position.x * 20.0);\n    _output.color.rgb *= step(0.0, stripe);\n    \"\"\"\n]\n```\n\nEntry points: `.geometry`, `.surface`, `.lightingModel`, `.fragment`\n\n**In RealityKit**: Use `ShaderGraphMaterial` with Reality Composer Pro, or `CustomMaterial` with Metal functions.\n\n---\n\n## 4. Lighting\n\n### Light Types\n\n| Type | Description | Shadows |\n|------|-------------|---------|\n| `.omni` | Point light, radiates in all directions | No |\n| `.directional` | Parallel rays (sun) | Yes |\n| `.spot` | Cone-shaped beam | Yes |\n| `.area` | Rectangle emitter (soft shadows) | Yes |\n| `.IES` | Real-world light profile | Yes |\n| `.ambient` | Uniform, no direction | No |\n| `.probe` | Environment lighting from cubemap | No |\n\n```swift\nlet light = SCNLight()\nlight.type = .directional\nlight.intensity = 1000\nlight.castsShadow = true\nlight.shadowRadius = 3\nlight.shadowSampleCount = 8\n\nlet lightNode = SCNNode()\nlightNode.light = light\nlightNode.eulerAngles = SCNVector3(-Float.pi \u002F 4, 0, 0)\nscene.rootNode.addChildNode(lightNode)\n```\n\n**In RealityKit**: Use `DirectionalLightComponent`, `PointLightComponent`, `SpotLightComponent` as components on entities. Image-based lighting via `EnvironmentResource`.\n\n---\n\n## 5. Animation\n\n### SCNAction (Declarative)\n\n```swift\nlet moveUp = SCNAction.moveBy(x: 0, y: 2, z: 0, duration: 1)\nlet fadeOut = SCNAction.fadeOut(duration: 0.5)\nlet sequence = SCNAction.sequence([moveUp, fadeOut])\nlet forever = SCNAction.repeatForever(moveUp.reversed())\nnode.runAction(sequence)\n```\n\n### Implicit Animation (SCNTransaction)\n\n```swift\nSCNTransaction.begin()\nSCNTransaction.animationDuration = 0.5\nnode.position = SCNVector3(0, 5, 0)\nnode.opacity = 0.5\nSCNTransaction.commit()\n```\n\n### Explicit Animation (CAAnimation bridge)\n\n```swift\nlet animation = CABasicAnimation(keyPath: \"rotation\")\nanimation.toValue = NSValue(scnVector4: SCNVector4(0, 1, 0, Float.pi * 2))\nanimation.duration = 2\nanimation.repeatCount = .infinity\nnode.addAnimation(animation, forKey: \"spin\")\n```\n\n### Loading Animations from Files\n\n```swift\nlet scene = SCNScene(named: \"character.dae\")!\nlet animationPlayer = scene.rootNode\n    .childNode(withName: \"mixamorig:Hips\", recursively: true)!\n    .animationPlayer(forKey: nil)!\n\ncharacterNode.addAnimationPlayer(animationPlayer, forKey: \"walk\")\nanimationPlayer.play()\n```\n\n**In RealityKit**: Use `entity.playAnimation()` with animations loaded from USD files. Transform animations via `entity.move(to:relativeTo:duration:)`.\n\n---\n\n## 6. Physics\n\n### Physics Bodies\n\n```swift\n\u002F\u002F Dynamic — simulation controls position\nnode.physicsBody = SCNPhysicsBody(type: .dynamic,\n    shape: SCNPhysicsShape(geometry: node.geometry!, options: nil))\n\n\u002F\u002F Static — immovable collision surface\nground.physicsBody = SCNPhysicsBody(type: .static, shape: nil)\n\n\u002F\u002F Kinematic — code controls position, participates in collisions\nplatform.physicsBody = SCNPhysicsBody(type: .kinematic, shape: nil)\n```\n\n### Collision Categories\n\n```swift\nstruct PhysicsCategory {\n    static let player:    Int = 1 \u003C\u003C 0   \u002F\u002F 1\n    static let enemy:     Int = 1 \u003C\u003C 1   \u002F\u002F 2\n    static let projectile: Int = 1 \u003C\u003C 2  \u002F\u002F 4\n    static let wall:      Int = 1 \u003C\u003C 3   \u002F\u002F 8\n}\n\nplayerNode.physicsBody?.categoryBitMask = PhysicsCategory.player\nplayerNode.physicsBody?.collisionBitMask = PhysicsCategory.wall | PhysicsCategory.enemy\nplayerNode.physicsBody?.contactTestBitMask = PhysicsCategory.enemy | PhysicsCategory.projectile\n```\n\n### Contact Delegate\n\n```swift\nclass GameScene: SCNScene, SCNPhysicsContactDelegate {\n    func setupPhysics() {\n        physicsWorld.contactDelegate = self\n    }\n\n    func physicsWorld(_ world: SCNPhysicsWorld,\n                      didBegin contact: SCNPhysicsContact) {\n        let nodeA = contact.nodeA\n        let nodeB = contact.nodeB\n        \u002F\u002F Handle collision\n    }\n}\n```\n\n**In RealityKit**: Use `PhysicsBodyComponent`, `CollisionComponent`, and collision event subscriptions via `scene.subscribe(to: CollisionEvents.Began.self)`.\n\n---\n\n## 7. Hit Testing and Interaction\n\n```swift\n\u002F\u002F In SCNView tap handler\nlet results = sceneView.hitTest(tapLocation, options: [\n    .searchMode: SCNHitTestSearchMode.closest.rawValue,\n    .boundingBoxOnly: false\n])\n\nif let hit = results.first {\n    let tappedNode = hit.node\n    let worldPosition = hit.worldCoordinates\n}\n```\n\n**In RealityKit**: Use `ManipulationComponent` for drag\u002Frotate\u002Fscale gestures, or collision-based hit testing.\n\n---\n\n## 8. Asset Pipeline\n\n### Supported Formats\n\n| Format | Extension | Notes |\n|--------|-----------|-------|\n| USD\u002FUSDZ | `.usdz`, `.usda`, `.usdc` | Preferred format, works in both SceneKit and RealityKit |\n| Collada | `.dae` | Legacy, still supported |\n| SceneKit Archive | `.scn` | Xcode-specific, not portable to RealityKit |\n| Wavefront OBJ | `.obj` | Geometry only, no animations |\n| Alembic | `.abc` | Animation baking |\n\n### Loading Models\n\n```swift\n\u002F\u002F From bundle\nlet scene = SCNScene(named: \"model.usdz\")!\n\n\u002F\u002F From URL\nlet scene = try SCNScene(url: modelURL, options: nil)\n\n\u002F\u002F Via Model I\u002FO (for format conversion)\nlet asset = MDLAsset(url: modelURL)\nlet scene = SCNScene(mdlAsset: asset)\n```\n\n**Migration tip**: Convert `.scn` files to `.usdz` using `xcrun scntool --convert file.scn --format usdz` before migrating to RealityKit.\n\n---\n\n## 9. ARKit Integration (Legacy)\n\n```swift\n\u002F\u002F ARSCNView — SceneKit + ARKit (legacy approach)\nlet arView = ARSCNView(frame: view.bounds)\narView.delegate = self\narView.session.run(ARWorldTrackingConfiguration())\n\n\u002F\u002F Adding virtual content at anchors\nfunc renderer(_ renderer: SCNSceneRenderer,\n              didAdd node: SCNNode, for anchor: ARAnchor) {\n    let box = SCNBox(width: 0.1, height: 0.1, length: 0.1, chamferRadius: 0)\n    node.addChildNode(SCNNode(geometry: box))\n}\n```\n\n**In RealityKit**: Use `RealityView` with `AnchorEntity` types. ARSCNView is legacy — all new AR development should use RealityKit.\n\n---\n\n## 10. Anti-Patterns\n\n### Anti-Pattern 1: Starting New Projects in SceneKit\n\n**Time cost**: Weeks of rework when you eventually must migrate\n\nSceneKit is deprecated. New projects should use RealityKit from the start, even if the learning curve is steeper initially.\n\n### Anti-Pattern 2: Using .scn Files Without USDZ Conversion\n\n**Time cost**: Hours when migration begins\n\n`.scn` files are SceneKit-specific and cannot be loaded in RealityKit. Convert early:\n```bash\nxcrun scntool --convert model.scn --format usdz --output model.usdz\n```\n\n### Anti-Pattern 3: Deep Shader Modifier Customization\n\n**Time cost**: Complete rewrite during migration\n\nSceneKit shader modifiers use a proprietary entry-point system. Heavy investment here has zero portability to RealityKit's `ShaderGraphMaterial`.\n\n### Anti-Pattern 4: Relying on SCNRenderer for Custom Pipelines\n\n**Time cost**: Architecture redesign during migration\n\nIf you need custom render pipelines, build on Metal directly or use `RealityRenderer` (RealityKit's Metal-level API).\n\n### Anti-Pattern 5: Ignoring Deprecation Warnings\n\n**Time cost**: Surprise breakage when Apple removes APIs\n\nTrack `SceneView` deprecation warnings and plan UIViewRepresentable fallback or RealityKit migration.\n\n### Anti-Pattern 6: Creating Hundreds of Nodes in a Loop\n\n**Time cost**: 2-4 hours debugging frame drops, often misdiagnosed as GPU issue\n\n```swift\n\u002F\u002F ❌ WRONG: Each SCNNode has overhead (transform, bounding box, hit test)\nfor i in 0..\u003C500 {\n    let node = SCNNode(geometry: SCNSphere(radius: 0.05))\n    node.position = randomPosition()\n    scene.rootNode.addChildNode(node)  \u002F\u002F 500 nodes = terrible frame rate\n}\n\n\u002F\u002F ✅ RIGHT: Use SCNParticleSystem for particle-like effects\nlet particles = SCNParticleSystem()\nparticles.birthRate = 500\nparticles.particleSize = 0.05\nparticles.emitterShape = SCNBox(width: 5, height: 5, length: 5, chamferRadius: 0)\nparticleNode.addParticleSystem(particles)\n\n\u002F\u002F ✅ RIGHT: Use geometry instancing for identical objects\nlet source = SCNGeometrySource(\u002F* instance transforms *\u002F)\ngeometry.levelsOfDetail = [SCNLevelOfDetail(geometry: lowPoly, screenSpaceRadius: 20)]\n```\n\n**Rule**: If >50 identical objects, use SCNParticleSystem or flatten geometry. If different objects, use `SCNNode.flattenedClone()` to reduce draw calls.\n\n---\n\n## 11. Migration Decision Tree\n\n```\nShould you migrate to RealityKit?\n│\n├─ Is this a new project?\n│   └─ YES → Use RealityKit from the start. No question.\n│\n├─ Does the app need AR features?\n│   └─ YES → Migrate. ARSCNView is legacy, RealityKit is the only forward path.\n│\n├─ Does the app target visionOS?\n│   └─ YES → Must migrate. SceneKit doesn't support visionOS spatial features.\n│\n├─ Is the codebase heavily invested in SceneKit?\n│   ├─ YES, and app is stable → Maintain in SceneKit for now, plan phased migration.\n│   └─ YES, but needs new features → Migrate incrementally (new features in RealityKit).\n│\n├─ Is performance a concern?\n│   └─ YES → RealityKit is optimized for Apple Silicon with Metal-first rendering.\n│\n└─ Is the app in maintenance mode?\n    └─ YES → Keep SceneKit until critical. Security patches will continue.\n```\n\n---\n\n## 12. Pressure Scenarios\n\n### Scenario 1: \"Just Use SceneKit, It Works Fine\"\n\n**Pressure**: Team familiarity with SceneKit, deadline to ship\n\n**Wrong approach**: Start new project in SceneKit because the team knows it.\n\n**Correct approach**: Invest in RealityKit learning. SceneKit will receive no new features. The longer you wait, the larger the migration debt.\n\n**Push-back template**: \"SceneKit is deprecated as of iOS 26. Starting new work in it creates migration debt that grows with every feature we add. RealityKit's ECS model is different but learnable — let's invest the time now.\"\n\n### Scenario 2: \"We Don't Have Time to Learn RealityKit\"\n\n**Pressure**: Tight deadline, team unfamiliar with ECS\n\n**Wrong approach**: Build everything in SceneKit to meet the deadline.\n\n**Correct approach**: Build the prototype in SceneKit if necessary, but document every SceneKit dependency and plan the migration. Use USDZ assets from the start so they're portable.\n\n**Push-back template**: \"Let's use USDZ assets and keep the SceneKit layer thin. When we migrate, the assets transfer directly and only the code layer changes.\"\n\n### Scenario 3: \"Port Everything At Once\"\n\n**Pressure**: Desire for a clean migration\n\n**Wrong approach**: Attempt to rewrite the entire SceneKit codebase in RealityKit at once.\n\n**Correct approach**: Migrate incrementally. New features in RealityKit. Existing SceneKit code stays until it needs changes. Modularize with Swift packages (per Apple's migration guide).\n\n**Push-back template**: \"Apple's own migration guide recommends modularizing into Swift packages and migrating system by system. A big-bang rewrite risks introducing new bugs across the entire app.\"\n\n---\n\n## Code Review Checklist\n\n- [ ] No new SceneKit code in projects targeting iOS 26+ without migration plan\n- [ ] Assets in USDZ format (not .scn) for portability\n- [ ] No deep shader modifier customization without RealityKit equivalent identified\n- [ ] SCNTransaction used for implicit animations (not direct property changes without animation context)\n- [ ] Physics categoryBitMask explicitly set (not relying on defaults)\n- [ ] Contact delegate set and protocol conformance added\n- [ ] `[weak self]` in completion handlers and closures\n- [ ] Debug overlays enabled during development (`showsStatistics = true`)\n\n---\n\n## Resources\n\n**WWDC**: 2014-609, 2014-610, 2017-604, 2019-612\n\n**Docs**: \u002Fscenekit, \u002Fscenekit\u002Fscnscene, \u002Fscenekit\u002Fscnnode, \u002Fscenekit\u002Fscnmaterial, \u002Fscenekit\u002Fscnphysicsbody\n\n**Skills**: axiom-scenekit-ref, axiom-realitykit, axiom-realitykit-ref\n\n",{"name":5,"license":15,"metadata":38,"description":7},{"version":39},"1.0.0","main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FCharlesWiltgen\u002FAxiom\u002Faxiom-scenekit",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":50,"prompt":60,"zipAvailable":61},[51,54,57],{"tool":52,"command":53},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill axiom-scenekit",{"tool":55,"command":56},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill axiom-scenekit",{"tool":58,"command":59},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill axiom-scenekit","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FCharlesWiltgen\u002FAxiom\u002Faxiom-scenekit\u002FSKILL.md",true,[],[64,73,82,91,97,103],{"skillNo":65,"name":66,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":33},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[70,71,72],"model","model hierarchy","model hierarchy skill",{"skillNo":74,"name":75,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":33},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[79,80,81],"MCP","zoom","zoom mcp",{"skillNo":83,"name":84,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":33},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[88,89,90,80],"sdk","zoom apps sdk","apps",{"skillNo":92,"name":93,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":33},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[93],{"skillNo":98,"name":99,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":33},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[99],{"skillNo":104,"name":105,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":33},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[105]]