UNITY5.5
Manual Introduction
Animation
王聖川
Overview
• Mecanim
• Legacy Animation (官方不建議)
Animation Clip
• 動畫(動作)片段資料.
– 第三方工具製作並匯入 (FBX, …).
– 編輯器本身製作 (Animation Window).
• 在Animation Window中針對指定的GameObject編輯.
• Transform, Components(Material properties).
• Properties in scripts; timing of calling functions(event?).
– 命名規則
• Unity自動認定goober.fbx為模型來源.
• Unity自動認定goober@xxx.fbx為動作來源(只匯入動作).
Humanoid
• Mecanim特別為類人體骨架設計.
– 實現retargeting(更換骨架套用對象)
– 實現inverse kinematics(反向運動力學計算).
• 建立化身(avatar)
– 也支援非類人體骨架, Animation Type選擇Generic.
Humanoid
• 設置化身資料
– 可以編輯遮罩區域資料(mask).
• 肌肉參數調整.
• Root motion.
– Humanoid骨架會自動計算root transform.
– Generic骨架須指定Root Node(bone).
Animation Clip
• Loop Pose.
– Loop match旁燈號表示此動作是否適用Loop循環.
• Masking 動作資料之遮罩區域資訊設定.
• Animation curve. 曲線參數資訊.
– 曲線參數時間軸範圍是 [0~1], 代表動畫時間之開始與結束.
– 曲線參數命名跟Animator Controller parameter一致時, 就可
以即時套用在Animator Controller.
Animation Clip
• Animation event.
– 可在時間軸上定義事件, 對應到控制script 裡面定義好的
callback function.
– 透過此機制可完成複雜的動作/技能/特效/事件編輯.
Animation Clip
• 手動指定root motion node(bone).
– Root motion transform可自動帶動綁定物體.
• 原始euler curve資訊匯入.
– Unity自動將rotation/orientation做 resample, 轉換成
quaternion curve.
– 取消Resample curve, Unity匯入時不做resample, 保留原
本的euler curve資訊, 但即時運算中仍會轉換成
quternion運算方式.
• 注意quaternion在resampling當中, 內插計算永遠會採取最短範
圍做resampling. 例如原本表現euler 旋轉角度由 270度逆時針轉
至0度, 但經過 quternion resampling處理後, Unity 會得到由 270
度順時針轉至0度的結果.
Animation Window
• Create, 建立新動畫資料.
– 指定gameobject, 按Create按鈕並將新的animation clip存檔.
• 對應的新animator controller asset會被產生並綁定到gameobject的
Animator component.
• 新animation clip會被指定在animator controller裡的預設狀態
(default state)動作中.
Animation Window
• 歸納:
– (1)gameobject 必須有Animator component;
– (2)Animator component必須有Animator Controller;
– (3)Animator Controller必須有一個以上animation clip.
Animation Window
• Animating可編輯參數.
– Float, Color, Vector2, Vector3, Vector4, Quaternion, Boolean.
– 指定Gameobject之所有children物件裡的參數皆可以對其編
輯動畫參數.
• 指定旋轉的內插方式: euler angles / quaternions.
– 使用euler angle interpolation須注意Gimbal lock問題.
Animation Event
• 時間軸上定義動畫事件, 對應gameobject 上的
script物件則必須實作此動畫事件指定的function
name.
– Event function可指定一個傳入參數.
– 所有使用到此animation clip之物件, 都必須擁有script 去
實作此event function.
Animator Controller
• Animation state machine, 動作狀態機管理與編輯工具.
– 綁定在Animator Component.
Animation State Machine
• States.
• Animation parameter.
– 定義參數, 分Int, Float, Bool, Trigger, 這4種.
– 即時透過script去存取和改變參數值.
– 也可以在animation clip中定義相同命名的curve, 在即時
運作中取代此參數值.
Animation State Machine
• State machine transitions.
– Entry state. 此state machine啟動之狀態.
– Exit state. State machine結束/離開之狀態.
• State behavior.
– 指定script, 可實作此state運作中各種行為(enter / exit /
update / …).
Animation State Machine
• Sub-State machine.
– 數個相關聯的states可合併編成一個sub-state machine.
– Sub-state machine裡面可以再編輯內部的 sub-state machines.
• Animation Layer. 一層Layer對應一個state machine.
– 透過Layers來設計更複雜的state machines.
– Layers 之間透過權重來決定動作.
– Layer sync. 透過sync功能產生與來源Layer完全相同的state
machine. 但states 可以指定不同的animation clip.
Animation State Machine
• 進階用法.
– Target matching. 指定骨架在動作完成時對應到指定位置.
• 跳躍至指定平台.
– Inverse Kinematics. 反向運動力學計算應用.
• 指定部位去對應某物件. 例: 抓取物品.
Animation State Machine
• Root motion. (不夠熟可能有錯)
– Body transform: 物體重心.
– Root transform: 水平平面上body transform的投影.
• Generic 模式裡, 指定的root node決定root transform.
– 可設定 Rotation, Position(Y), Position(XZ) 3 個部份.
• Bake Into Pose: 位移量不影響物體.
• Based Upon: 動畫位移量決定物體位移. 可再選擇位移參考來源.
• Tutorial: root motion via scripting.
– 實作OnAnimatorMove().
Animation State Machine
• Blend tree. 相似的動作(state / motion)可編輯成同一個
blend tree, 由權重來決定最終的動作結果.
– 1D blending.
– 2D blending.
– Direct blending.
Animator Override Controller
• 由一個base animator controller當來源, 建立override
controller.
– State machine內容一致, 但對應的動作motion不同.
• Ogre Animator是NPC Animator的Animator Override Controller, 在Ogre
Animator可重新指定所有state對應的動作motion.
Performance Optimization
• 角色:注意骨架數量和Skinned mesh數量.
• 動作系統:
– Mecanim已經為了animation blending做最佳化, 不表現
animation blending反而效能較差.
– 避免動畫中含有scale animation (運算代價高).
– Humanoid animation可使用mask排除不必要部份 (inverse
kinematices / fingers…).
– 使用generic animation時, 採用root motion運算代價較高. 不
使用root motion時確認root node(bone)保持在未選取狀態.
– Script中使用hashes來執行query animator.
– 實現AI Layer來控制animator (?).
Performance Optimization
• 透過animator culling mode來設定動作系統更新模式.
– 在skinned mesh renderer當中關閉Update When Offscreen.
• 匯入資源(模型動作).
– 使用壓縮選項, 降低資源檔案大小.
• Playable API.(看不懂)

More Related Content

DOCX
矩陣 基本說明
PPTX
2017 unity5.5 manual_physics
PPTX
2017 unity5.5 manual_navigation
DOCX
[breakdown] Shadow of the Colossus. (Chinese translation中譯)
DOCX
矩陣 轉換
DOCX
Shader forge設定說明文件
PPTX
2017 unity5 manual_intro
PDF
Graphic programming in js
矩陣 基本說明
2017 unity5.5 manual_physics
2017 unity5.5 manual_navigation
[breakdown] Shadow of the Colossus. (Chinese translation中譯)
矩陣 轉換
Shader forge設定說明文件
2017 unity5 manual_intro
Graphic programming in js

Similar to 2017 unity5.5 manual_animation (16)

PPT
Flashch2(1)
PDF
Inspire dgt 網路技術分享_flash actionscritp class
PPTX
component based html5 game engine
PPTX
UE4 Animation Tutorial
PPT
testing leads fix for ppt2
PDF
设计师转型培训-工具篇
PDF
Unity遊戲程式設計 - 2D動畫製作及應用
PDF
Unity遊戲設計- 2D動畫製作及應用
PPTX
Html5 canvas 游戏开发实例详解
PDF
Axure RP Prototyping Tool
PPT
新觀念的VB6教本ch04
PDF
Nova与虚拟机管理
PDF
Flex 4 Skinning
Flashch2(1)
Inspire dgt 網路技術分享_flash actionscritp class
component based html5 game engine
UE4 Animation Tutorial
testing leads fix for ppt2
设计师转型培训-工具篇
Unity遊戲程式設計 - 2D動畫製作及應用
Unity遊戲設計- 2D動畫製作及應用
Html5 canvas 游戏开发实例详解
Axure RP Prototyping Tool
新觀念的VB6教本ch04
Nova与虚拟机管理
Flex 4 Skinning
Ad

More from River Wang (15)

PPTX
FairyGUISDK_UIPackage_Analysis.pptx
PPTX
20220529_UniTask_Intro.pptx
PPTX
zenject extenject-intro
PPTX
Unity optimize mobile game performance
PPTX
DoozyUI_基礎介紹教學
PPTX
Gamedev: Multi-threaded animate model
PDF
桌面應用工具軟體開發方案評估 (Based on Unity engine)
PPTX
OGRE v2.1 manual - Technical Overview
PPTX
OGRE v2.1 manual - Changes: Objects, Scene & Nodes
PPTX
OGRE v1.10 manual - The Core Objects
PPTX
OpenCascade Technology Overview: Modeling Data
PPTX
OpenCascade Technology Overview: OCAF
PPTX
OpenCascade Technology Overview: Visualization
PPTX
OpenCascade Technology Overview: Foundation Classes
DOCX
2017 graphics-01: 電腦圖學繪圖流程
FairyGUISDK_UIPackage_Analysis.pptx
20220529_UniTask_Intro.pptx
zenject extenject-intro
Unity optimize mobile game performance
DoozyUI_基礎介紹教學
Gamedev: Multi-threaded animate model
桌面應用工具軟體開發方案評估 (Based on Unity engine)
OGRE v2.1 manual - Technical Overview
OGRE v2.1 manual - Changes: Objects, Scene & Nodes
OGRE v1.10 manual - The Core Objects
OpenCascade Technology Overview: Modeling Data
OpenCascade Technology Overview: OCAF
OpenCascade Technology Overview: Visualization
OpenCascade Technology Overview: Foundation Classes
2017 graphics-01: 電腦圖學繪圖流程
Ad

2017 unity5.5 manual_animation

  • 2. Overview • Mecanim • Legacy Animation (官方不建議)
  • 3. Animation Clip • 動畫(動作)片段資料. – 第三方工具製作並匯入 (FBX, …). – 編輯器本身製作 (Animation Window). • 在Animation Window中針對指定的GameObject編輯. • Transform, Components(Material properties). • Properties in scripts; timing of calling functions(event?). – 命名規則 • Unity自動認定goober.fbx為模型來源. • Unity自動認定goober@xxx.fbx為動作來源(只匯入動作).
  • 4. Humanoid • Mecanim特別為類人體骨架設計. – 實現retargeting(更換骨架套用對象) – 實現inverse kinematics(反向運動力學計算). • 建立化身(avatar) – 也支援非類人體骨架, Animation Type選擇Generic.
  • 5. Humanoid • 設置化身資料 – 可以編輯遮罩區域資料(mask). • 肌肉參數調整. • Root motion. – Humanoid骨架會自動計算root transform. – Generic骨架須指定Root Node(bone).
  • 6. Animation Clip • Loop Pose. – Loop match旁燈號表示此動作是否適用Loop循環. • Masking 動作資料之遮罩區域資訊設定. • Animation curve. 曲線參數資訊. – 曲線參數時間軸範圍是 [0~1], 代表動畫時間之開始與結束. – 曲線參數命名跟Animator Controller parameter一致時, 就可 以即時套用在Animator Controller.
  • 7. Animation Clip • Animation event. – 可在時間軸上定義事件, 對應到控制script 裡面定義好的 callback function. – 透過此機制可完成複雜的動作/技能/特效/事件編輯.
  • 8. Animation Clip • 手動指定root motion node(bone). – Root motion transform可自動帶動綁定物體. • 原始euler curve資訊匯入. – Unity自動將rotation/orientation做 resample, 轉換成 quaternion curve. – 取消Resample curve, Unity匯入時不做resample, 保留原 本的euler curve資訊, 但即時運算中仍會轉換成 quternion運算方式. • 注意quaternion在resampling當中, 內插計算永遠會採取最短範 圍做resampling. 例如原本表現euler 旋轉角度由 270度逆時針轉 至0度, 但經過 quternion resampling處理後, Unity 會得到由 270 度順時針轉至0度的結果.
  • 9. Animation Window • Create, 建立新動畫資料. – 指定gameobject, 按Create按鈕並將新的animation clip存檔. • 對應的新animator controller asset會被產生並綁定到gameobject的 Animator component. • 新animation clip會被指定在animator controller裡的預設狀態 (default state)動作中.
  • 10. Animation Window • 歸納: – (1)gameobject 必須有Animator component; – (2)Animator component必須有Animator Controller; – (3)Animator Controller必須有一個以上animation clip.
  • 11. Animation Window • Animating可編輯參數. – Float, Color, Vector2, Vector3, Vector4, Quaternion, Boolean. – 指定Gameobject之所有children物件裡的參數皆可以對其編 輯動畫參數. • 指定旋轉的內插方式: euler angles / quaternions. – 使用euler angle interpolation須注意Gimbal lock問題.
  • 12. Animation Event • 時間軸上定義動畫事件, 對應gameobject 上的 script物件則必須實作此動畫事件指定的function name. – Event function可指定一個傳入參數. – 所有使用到此animation clip之物件, 都必須擁有script 去 實作此event function.
  • 13. Animator Controller • Animation state machine, 動作狀態機管理與編輯工具. – 綁定在Animator Component.
  • 14. Animation State Machine • States. • Animation parameter. – 定義參數, 分Int, Float, Bool, Trigger, 這4種. – 即時透過script去存取和改變參數值. – 也可以在animation clip中定義相同命名的curve, 在即時 運作中取代此參數值.
  • 15. Animation State Machine • State machine transitions. – Entry state. 此state machine啟動之狀態. – Exit state. State machine結束/離開之狀態. • State behavior. – 指定script, 可實作此state運作中各種行為(enter / exit / update / …).
  • 16. Animation State Machine • Sub-State machine. – 數個相關聯的states可合併編成一個sub-state machine. – Sub-state machine裡面可以再編輯內部的 sub-state machines. • Animation Layer. 一層Layer對應一個state machine. – 透過Layers來設計更複雜的state machines. – Layers 之間透過權重來決定動作. – Layer sync. 透過sync功能產生與來源Layer完全相同的state machine. 但states 可以指定不同的animation clip.
  • 17. Animation State Machine • 進階用法. – Target matching. 指定骨架在動作完成時對應到指定位置. • 跳躍至指定平台. – Inverse Kinematics. 反向運動力學計算應用. • 指定部位去對應某物件. 例: 抓取物品.
  • 18. Animation State Machine • Root motion. (不夠熟可能有錯) – Body transform: 物體重心. – Root transform: 水平平面上body transform的投影. • Generic 模式裡, 指定的root node決定root transform. – 可設定 Rotation, Position(Y), Position(XZ) 3 個部份. • Bake Into Pose: 位移量不影響物體. • Based Upon: 動畫位移量決定物體位移. 可再選擇位移參考來源. • Tutorial: root motion via scripting. – 實作OnAnimatorMove().
  • 19. Animation State Machine • Blend tree. 相似的動作(state / motion)可編輯成同一個 blend tree, 由權重來決定最終的動作結果. – 1D blending. – 2D blending. – Direct blending.
  • 20. Animator Override Controller • 由一個base animator controller當來源, 建立override controller. – State machine內容一致, 但對應的動作motion不同. • Ogre Animator是NPC Animator的Animator Override Controller, 在Ogre Animator可重新指定所有state對應的動作motion.
  • 21. Performance Optimization • 角色:注意骨架數量和Skinned mesh數量. • 動作系統: – Mecanim已經為了animation blending做最佳化, 不表現 animation blending反而效能較差. – 避免動畫中含有scale animation (運算代價高). – Humanoid animation可使用mask排除不必要部份 (inverse kinematices / fingers…). – 使用generic animation時, 採用root motion運算代價較高. 不 使用root motion時確認root node(bone)保持在未選取狀態. – Script中使用hashes來執行query animator. – 實現AI Layer來控制animator (?).
  • 22. Performance Optimization • 透過animator culling mode來設定動作系統更新模式. – 在skinned mesh renderer當中關閉Update When Offscreen. • 匯入資源(模型動作). – 使用壓縮選項, 降低資源檔案大小. • Playable API.(看不懂)