当前位置:网站首页>ozzanimation-基於sse的動作系統
ozzanimation-基於sse的動作系統
2022-06-12 02:02:00 【VT LI】
簡介:
ozzanimation是利用sse也就是用simd單指令多數據的形式來處理animation的動作變化、轉換坐標以及ik等的處理方式。可以比傳統的直接矩陣轉換快。
sample_additive.cc是最簡單的例子

初始化
OnInitialize做初始化,LoadSkeleton加載骨骼,LoadAnimation加載動畫,context_.Resize來確定平移旋轉縮放的大小,locals_.resize確定局部空間的數據大小,models_.resize確定模型空間的數據大小,blended_locals_.resize確定局部空間混合的大小。
simd更新動作矩陣
核心在OnUpdate中做動畫處理,controller_.Update設置播放動作的比率ratio,通過ozz::animation::SamplingJob來設置動作數據並指定輸出到locals_。通過sampling_job.Run來執行動作數據采樣,UpdateCacheCursor是更新緩存的指針比特置,然後UpdateInterpKeyframes是通過指針比特置的索引來獲取具體的數值,然後平移和縮放都是通過DecompressFloat3來獲取到simd運算後的值,縮放是四元數所以是DecompressQuaternion。
獲取到平移縮放旋轉的數據後,Interpolates來進行插值,插值也是通過simd來執行的。最終輸出給output。
以上都是在SamplingJob中完成的事情。
混合:
然後如果有多個層級混合則執行ozz::animation::BlendingJob::Layer獲取層的數據,然後ozz::animation::BlendingJob來混合,在BlendingJob::Run()中

首先是BlendLayers,他有兩種混合方式,一種是一維的混合,直接執行OZZ_BLEND_1ST_PASS,另一種是多維的OZZ_BLEND_N_PASS。
然後是BlendRestPose,這裏是如果累計權重小於閾值,則將靜止姿勢混合到輸出。
然後是Normalize,規格化輸出旋轉。四元數長度不能為零,因為在混合過程中,四元數的相對長度已固定。平移和縮放已經標准化,因為權重已預先乘以標准化比率。
然後是AddLayers,這裏是關注的是每個層是否要添加到混合中,或者删除混合。
最後還得執行ozz::animation::LocalToModelJob來轉換到模型空間,
然後顯示在OnDisplay通過gl來顯示模型或骨骼,shader代碼直接寫在

這些類裏面。
相關的蒙皮運算等都是傳統的方式。
多線程版本:
sample_multithread.cc中ParallelUpdate是執行更新角色的行為,grain_size是多少個對象並行處理,如果超過數量就通過std::async選擇异步的方式std::launch::async,他會在另一個線程執行。ParallelUpdate。

然後UpdateCharacter中還是通過simd執行SamplingJob和LocalToModelJob。
边栏推荐
- LeetCode LCP 07. 传递信息
- “中国东信杯”广西大学第四届程序设计竞赛(同步赛)
- 决定广告质量的三个主要因素
- Ozzanmation action system based on SSE
- 括号生成(回溯)
- How to automatically color cells in Excel
- 如何最大化的利用各种匹配方式? ——Google SEM
- Quatre schémas de mise en file d'attente des messages pour redis
- 小程序111111
- Don't miss it! Five large data visualization screens that HR must collect
猜你喜欢

Four schemes for redis to implement message queue

Redis實現消息隊列的4種方案

The resignation of the chief oracle engineer was furious: MySQL is a terrible database, so it is recommended to consider PostgreSQL!

“還是學一門技術更保險!”杭州校區小哥哥轉行軟件測試,喜提10K+雙休!

Data system provider Jidao technology joins dragon lizard community

Huawei, this is too strong

php开发 博客系统的公告模块的建立和引入

商城开发知识点

Summary of concrete (ground + wall) + Mountain crack data set (classification and target detection)

Huawei intermodal game or application review rejected: the application detected payment servicecatalog:x6
随机推荐
Modification of system module information of PHP security development 12 blog system
Basic use of MATLAB
Dataset how to use dataset gracefully. After reading this article, you can fully understand the dataset in c7n/choerodon/ toothfish UI
Point cloud perception algorithm interview knowledge points (II)
Software engineering - system flow chart
[C language] summary of basic knowledge points of pointer
Huawei intermodal game or application review rejected: the application detected payment servicecatalog:x6
Database
如何让杀毒软件停止屏蔽某个网页?以GDATA为例
How much coverage is appropriate for children's serious illness insurance? Which product is the best?
MySQL表常用操作思维导图
LeetCode Algorithm 1791. Find the central node of the star chart
Design practice of rongyun Im on electron platform
MySQL table common operation mind map
Software engineering course: Chapter 2 software problem definition and feasibility analysis after class exercises
Freshman year: learning summary
C language programming classic games - minesweeping
Sogou Pinyin official website screenshot tool pycharm installation
How can low code platforms improve cost effectiveness?
Graphic data analysis | business cognition and data exploration