当前位置:网站首页>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。
边栏推荐
- State owned assets into shares, has Jianye real estate stabilized?
- 初探性能优化!从2个月到4小时的性能提升!
- Advantages of Google ads
- Redis实现消息队列的4种方案
- [learn FPGA programming from scratch -20]: quick start chapter - operation steps 4-2-quick use of Altera quartz II tool (Modelsim co simulation, program download to altera development board)
- Pagination writing of PHP security open 10 article list module
- 广泛匹配修饰符符号已经被弃用,请勿使用
- Websocket is closed after 10 seconds of background switching
- LeetCode Algorithm 1791. Find the central node of the star chart
- Don't write about the full screen explosion, try the decorator mode, this is the elegant way!!
猜你喜欢

Knowledge points of mall development

SQL calculates KS, AUC, IV, psi and other risk control model indicators

Is the bidding price fixed for each click?

Operating mechanism of Google ads bidding

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

"C'est plus sûr d'apprendre une technologie!" Hangzhou Campus Little Brother transfer software test, Hi - Ti 10K + double break!

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

leetcodeSQL:612. Nearest distance on plane

Bracket generation (backtracking)

pip运行报错:Fatal error in launcher: Unable to create process using
随机推荐
matplotlib. pyplot. Bar chart (II)
Dataset how to use dataset gracefully. After reading this article, you can fully understand the dataset in c7n/choerodon/ toothfish UI
Sogou Pinyin official website screenshot tool pycharm installation
Linux (centos7) installer mysql - 5.7
联调这夜,我把同事打了...
How to buy children's serious illness insurance, what to pay attention to and how to choose products
What are the preparations for setting up Google search advertising series?
SQL calculates KS, AUC, IV, psi and other risk control model indicators
LeetCode Algorithm 1791. Find the central node of the star chart
PyGame alien invasion
[learn FPGA programming from scratch -19]: quick start chapter - operation steps 4-1- Verilog software download and construction of development environment - Altera quartz II version
"Xilin chain" of Southwest Forestry University passed the functional test of Electronic Standards Institute of the Ministry of industry and information technology | FISCO bcos case
[untitled]
The road of global evolution of vivo global mall -- multilingual solution
MySQL table common operation mind map
LeetCode Algorithm 997. 找到小镇的法官
Glfwpollevents() program crash
Ozzanmation action system based on SSE
Software engineering course: Chapter 2 software problem definition and feasibility analysis after class exercises
Introduction to prism framework - Modular introduction