mcpField
A
axiom-scenekit-ref

axiom-scenekit-ref

github.com/charleswiltgen開発1.2k130 回インストール今日更新
リポジトリ

axiom-scenekit-ref について

SceneKit 開発者向けのAPIリファレンスで、主要APIとRealityKitの概念との対応を説明します。対応する機能と異なる実装が必要な箇所を示し、移行計画に役立ちます。

主な機能

  1. 01SceneKitとRealityKitの概念対応
  2. 02シーングラフと変換のリファレンス
  3. 03マテリアルとライティングの比較
  4. 04物理APIの対応表
  5. 05アニメーションと操作のリファレンス
  6. 06AR連携の対応表

活用シーン

  1. 01移行時にRealityKitの対応APIを探す
  2. 02SceneKitクラスのプロパティやメソッドを確認
  3. 03SceneKit機能の代替方法を計画
  4. 04シーングラフとECS設計を比較

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/charleswiltgen/axiom --skill axiom-scenekit-ref

インストール後、Claude Code で/axiom-scenekit-refを入力して読み込まれたか確認します。

詳細

SceneKit API リファレンスと移行マッピング

SceneKit の主要な概念すべてについて、RealityKit での相当機能を示す完全な API リファレンスです。

このリファレンスを使用する場面

次の場合に、このリファレンスを使用してください。

  • 移行中に SceneKit → RealityKit の API 相当機能を調べる
  • SceneKit の特定のクラスのプロパティやメソッドを確認する
  • RealityKit に直接対応する SceneKit の機能を把握する
  • シーングラフと ECS のアーキテクチャ上の違いを理解する

パート 1:SceneKit → RealityKit の概念マッピング

コアアーキテクチャ
SceneKitRealityKit備考
SCNSceneRealityViewContent / Entity(ルート)RealityKit のシーンはエンティティ階層です
SCNNodeEntityどちらも軽量なコンテナーです
SCNViewRealityView(SwiftUI)iOS の UIKit では ARView を使用します
SceneView(SwiftUI)RealityViewSceneView は iOS 26 で非推奨です
SCNRendererRealityRenderer低レベルの Metal レンダリング
ノードのプロパティコンポーネントECS ではデータと階層を分離します
SCNSceneRendererDelegateSystem / SceneEvents.Updateフレーム単位の更新
.scn ファイル.usdz / .usda ファイルxcrun scntool で変換します
ジオメトリとレンダリング
SceneKitRealityKit備考
SCNGeometryMeshResourceRealityKit ではコードから生成するか、USD を読み込みます
SCNBox、SCNSphere などMeshResource.generateBox()、.generateSphere()同様の組み込み形状
SCNMaterialSimpleMaterial、PhysicallyBasedMaterialRealityKit では PBR が基本です
SCNMaterial.lightingModel = .physicallyBasedPhysicallyBasedMaterialRealityKit ではデフォルトです
SCNMaterial.diffusePhysicallyBasedMaterial.baseColorプロパティ名が異なります
SCNMaterial.metalnessPhysicallyBasedMaterial.metallicプロパティ名が異なります
SCNMaterial.roughnessPhysicallyBasedMaterial.roughness同じ概念です
SCNMaterial.normalPhysicallyBasedMaterial.normal同じ概念です
シェーダーモディファイアShaderGraphMaterial / CustomMaterial直接移植できないため、書き直しが必要です
SCNProgram(カスタムシェーダー)Metal 関数を使用する CustomMaterialAPI の構成が異なります
SCNGeometrySourceMeshResource.Contents低レベルのメッシュデータ
トランスフォームと階層
SceneKitRealityKit備考
node.positionentity.positionどちらも SCNVector3 / SIMD3 です
node.eulerAnglesentity.orientation(クォータニオン)RealityKit ではクォータニオンが優先されます
node.scaleentity.scaleどちらも SIMD3 です
node.transformentity.transform4×4 行列
node.worldTransformentity.transform(relativeTo: nil)ワールド空間のトランスフォーム
node.addChildNode(_:)entity.addChild(_:)同じ階層の概念です
node.removeFromParentNode()entity.removeFromParent()同じ概念です
node.childNodesentity.children子のコレクション
node.parententity.parent親への参照
node.childNode(withName:recursively:)entity.findEntity(named:)名前による検索
ライティング
SceneKitRealityKit備考
SCNLight(.omni)PointLightComponent点光源
SCNLight(.directional)DirectionalLightComponent太陽光/指向性ライト
SCNLight(.spot)SpotLightComponent円錐状のライト
SCNLight(.area)直接相当する機能なし複数の点光源を使用します
SCNLight(.ambient)EnvironmentResource(IBL)イメージベースドライティングが推奨されます
SCNLight(.probe)EnvironmentResource環境プローブ
SCNLight(.IES)直接相当する機能なしライトの強度プロファイルを使用します
カメラ
SceneKitRealityKit備考
SCNCameraPerspectiveCamera entityカメラコンポーネントを持つエンティティ
camera.fieldOfViewPerspectiveCameraComponent.fieldOfViewInDegrees同じ概念
camera.zNear / camera.zFarPerspectiveCameraComponent.near / .farクリッピング平面
camera.wantsDepthOfFieldポストプロセスエフェクト仕組みが異なります
camera.motionBlurIntensityポストプロセスエフェクト仕組みが異なります
allowsCameraControlカスタムジェスチャー処理組み込みのオービットカメラはありません
物理演算
SceneKitRealityKit備考
SCNPhysicsBodyPhysicsBodyComponentコンポーネントベースです
.dynamic.dynamic同じモード
.static.static同じモード
.kinematic.kinematic同じモード
SCNPhysicsShapeCollisionComponent / ShapeResourceRealityKitではボディとは別です
categoryBitMaskCollisionGroup生のビットマスクではなく、名前付きグループです
collisionBitMaskCollisionFilterフィルターベースです
contactTestBitMaskCollisionEvents.Began subscriptionイベントベースの接触判定
SCNPhysicsContactDelegatescene.subscribe(to: CollisionEvents.Began.self)Combineスタイルのイベント
SCNPhysicsFieldPhysicsBodyComponent の力力を直接適用します
SCNPhysicsJointPhysicsJoint類似したジョイントタイプ
アニメーション
SceneKitRealityKit備考
SCNActionentity.move(to:relativeTo:duration:)トランスフォームのアニメーション
SCNAction.sequenceアニメーションの連結RealityKitでは宣言的ではありません
SCNAction.group並列アニメーション異なるエンティティに適用します
SCNAction.repeatForeverAnimationPlaybackController repeatAPIが異なります
SCNTransaction (implicit)直接対応するものはありません明示的なアニメーションのみです
CAAnimation bridgeentity.playAnimation()USDから読み込みます
SCNAnimationPlayerAnimationPlaybackController再生制御
モーフターゲットUSDのブレンドシェイプUSDファイル経由で読み込みます
インタラクション
SceneKitRealityKit備考
hitTest(_:options:)RealityViewContent.entities(at:)APIが異なります
SCNView上のジェスチャーレコグナイザーManipulationComponentドラッグ/回転/スケール変更機能を内蔵
allowsCameraControlカスタム実装組み込みのオービット機能はありません
AR統合
SceneKitRealityKit備考
ARSCNViewRealityView + AnchorEntityレガシー → モダン
ARSCNViewDelegateAnchorEntity の自動トラッキングイベント駆動型
renderer(_:didAdd:for:)AnchorEntity(.plane)宣言的なアンカリング
ARWorldTrackingConfigurationSpatialTrackingSessioniOS 18以降

パート2:シーングラフAPI

SCNScene
// Loading
let scene = SCNScene(named: "scene.usdz")!
let scene = try SCNScene(url: url, options: [
    .checkConsistency: true,
    .convertToYUp: true
])

// Properties
scene.rootNode                    // Root of node hierarchy
scene.background.contents        // Skybox (UIImage, UIColor, MDLSkyCubeTexture)
scene.lightingEnvironment.contents // IBL environment map
scene.fogStartDistance            // Fog near
scene.fogEndDistance              // Fog far
scene.fogColor                   // Fog color
scene.isPaused                   // Pause simulation
SCNNode
// Creation
let node = SCNNode()
let node = SCNNode(geometry: SCNBox(width: 1, height: 1, length: 1, chamferRadius: 0))

// Transform
node.position = SCNVector3(x, y, z)
node.eulerAngles = SCNVector3(pitch, yaw, roll)
node.scale = SCNVector3(1, 1, 1)
node.simdPosition = SIMD3<Float>(x, y, z)  // SIMD variants available
node.pivot = SCNMatrix4MakeTranslation(0, -0.5, 0) // Offset pivot point

// Visibility
node.isHidden = false
node.opacity = 1.0
node.castsShadow = true
node.renderingOrder = 0   // Lower = rendered first

// Hierarchy
node.addChildNode(child)
node.removeFromParentNode()
node.childNodes
node.childNode(withName: "name", recursively: true)
node.enumerateChildNodes { child, stop in }

パート3:マテリアル

ライティングモデル
モデル説明用途
.physicallyBasedPBRの金属度・粗さモデルリアルなレンダリング(推奨)
.blinnBlinn-Phong鏡面反射シンプルな光沢のある表面
.phongPhong鏡面反射従来の鏡面ハイライト
.lambert拡散反射のみ、鏡面反射なしマットな表面
.constantライティングなし、フラットカラーUI要素、デバッグ用の可視化
.shadowOnly目に見えず、影を受け取るARの地面
マテリアルのプロパティ
let mat = SCNMaterial()
mat.lightingModel = .physicallyBased

// Textures or scalar values
mat.diffuse.contents = UIImage(named: "albedo")    // Base color
mat.metalness.contents = 0.0                        // 0 = dielectric, 1 = metal
mat.roughness.contents = 0.5                        // 0 = mirror, 1 = rough
mat.normal.contents = UIImage(named: "normal")      // Normal map
mat.ambientOcclusion.contents = UIImage(named: "ao") // AO map
mat.emission.contents = UIColor.blue                // Glow
mat.displacement.contents = UIImage(named: "height") // Height map

// Options
mat.isDoubleSided = false        // Render both sides
mat.writesToDepthBuffer = true
mat.readsFromDepthBuffer = true
mat.blendMode = .alpha           // .add, .subtract, .multiply, .screen
mat.transparencyMode = .aOne     // .rgbZero for pre-multiplied alpha

パート4:物理演算

ボディタイプとプロパティ
// Dynamic body with custom shape
let shape = SCNPhysicsShape(geometry: SCNSphere(radius: 0.5), options: nil)
let body = SCNPhysicsBody(type: .dynamic, shape: shape)
body.mass = 1.0
body.friction = 0.5
body.restitution = 0.3       // Bounciness
body.damping = 0.1            // Linear damping
body.angularDamping = 0.1     // Angular damping
body.isAffectedByGravity = true
body.allowsResting = true     // Sleep optimization
node.physicsBody = body

// Compound shapes
let compound = SCNPhysicsShape(shapes: [shape1, shape2],
    transforms: [transform1, transform2])

// Concave (static only)
let concave = SCNPhysicsShape(geometry: mesh, options: [
    .type: SCNPhysicsShape.ShapeType.concavePolyhedron
])
ジョイントタイプ
ジョイント説明
SCNPhysicsHingeJoint単一軸の回転(ドア)
SCNPhysicsBallSocketJoint点を中心とした自由回転(振り子)
SCNPhysicsSliderJoint軸に沿った直線運動(引き出し)
SCNPhysicsConeTwistJoint制限付き回転(ラグドールの四肢)

パート5:アニメーションAPI

SCNAction カタログ
カテゴリアクション
移動move(by:duration:)、move(to:duration:)
回転rotate(by:around:duration:)、rotateTo(x:y:z:duration:)
スケールscale(by:duration:)、scale(to:duration:)
フェードfadeIn(duration:)、fadeOut(duration:)、fadeOpacity(to:duration:)
表示状態hide()、unhide()
オーディオplayAudio(source:waitForCompletion:)
カスタムrun { node in }、customAction(duration:action:)
合成sequence([])、group([])、repeat(_:count:)、repeatForever(_:)
制御wait(duration:)、removeFromParentNode()
タイミング関数
action.timingMode = .linear        // Default
action.timingMode = .easeIn        // Slow start
action.timingMode = .easeOut       // Slow end
action.timingMode = .easeInEaseOut // Slow start and end
action.timingFunction = { t in     // Custom curve
    return t * t  // Quadratic ease-in
}

パート 6:制約

制約目的
SCNLookAtConstraintノードを常にターゲットに向けます
SCNBillboardConstraintノードを常にカメラに向けます
SCNDistanceConstraint最小/最大距離を維持します
SCNReplicatorConstraintターゲットのトランスフォームをコピーします
SCNAccelerationConstraintトランスフォームの変化を滑らかにします
SCNSliderConstraint軸上に固定します
SCNIKConstraint逆運動学チェーン
let lookAt = SCNLookAtConstraint(target: targetNode)
lookAt.isGimbalLockEnabled = true  // Prevent roll
lookAt.influenceFactor = 0.8       // Partial constraint
node.constraints = [lookAt]

RealityKit の場合:直接的な制約システムはありません。System の更新ロジック、または entity.look(at:from:relativeTo:) を使って実装します。


パート 7:シーン構成

SCNView の構成
プロパティデフォルト説明
antialiasingMode.multisampling4XMSAA レベル
preferredFramesPerSecond60目標フレームレート
allowsCameraControlfalse組み込みのオービット/パン/ズーム
autoenablesDefaultLightingfalseライトがない場合にデフォルトのライトを追加します
showsStatisticsfalseFPS/ノード数/描画数のオーバーレイ
isTemporalAntialiasingEnabledfalseTAA によるスムージング
isJitteringEnabledfalseTAA 用の時間的ジッター
debugOptions[].showPhysicsShapes、.showBoundingBoxes、.renderAsWireframe

リソース

WWDC:2014-609、2014-610、2017-604、2019-612

ドキュメント:/scenekit、/scenekit/scnscene、/scenekit/scnnode、/scenekit/scnmaterial、/scenekit/scnphysicsbody、/scenekit/scnaction

スキル:axiom-scenekit、axiom-realitykit、axiom-realitykit-ref

コメント