当前位置:网站首页>ozzanimation-基于sse的动作系统
ozzanimation-基于sse的动作系统
2022-06-12 01:57: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。
边栏推荐
- 大一下期:学习总结
- Make ads more relevant by searching for additional information about ads
- Several visualization methods of point cloud 3D object detection results (second, pointpillars, pointrcnn)
- LeetCode Algorithm 1791. 找出星型图的中心节点
- Modification of system module information of PHP security development 12 blog system
- PCA from 0 to 1
- Wide match modifier symbol has been deprecated, do not use
- [C language] summary of basic knowledge points of pointer
- 混泥土(地面+墙面)+ 山体裂缝数据集汇总(分类及目标检测)
- Comprehensive quality of teaching resources in the second half of 2019 - subjective questions
猜你喜欢

Bracket generation (backtracking)

如何为Excel中的单元格自动填充颜色

Introduction to prism framework - Modular introduction

pip运行报错:Fatal error in launcher: Unable to create process using

Unit tests in golang

Point cloud perception algorithm interview knowledge points (II)

Kmeans from 0 to 1

kali安装empire过程中遇到的各种报错解决方案

决定广告质量的三个主要因素

Huawei intermodal game or application review rejected: the application detected payment servicecatalog:x6
随机推荐
How much coverage is appropriate for children's serious illness insurance? Which product is the best?
Blog recommended | bookkeeper - Apache pulsar high availability / strong consistency / low latency storage implementation
联调这夜,我把同事打了...
如何定位关键词使得广告精准投放。
Simulated 100 questions and simulated examination for safety management personnel of metal and nonmetal mines (small open pit quarries) in 2022
Modification of system module information of PHP security development 12 blog system
Database
The establishment and introduction of the announcement module of PHP development blog system
php安全开发 13博客系统的栏目模块的编写
TIOBE - 2022年6月编程语言排行
pip运行报错:Fatal error in launcher: Unable to create process using
What are the preparations for setting up Google search advertising series?
php开发 博客系统的公告模块的建立和引入
Simulated 100 questions and simulated examination for safety management personnel of metal and nonmetal mines (small open pit quarries) in 2022
How to locate keywords to make advertising accurate.
通用树形结构的迭代与组合模式实现方案
C language programming classic games - minesweeping
Redis集群更换节点IP后如何恢复集群并保留完整集群数据
LeetCode Algorithm 1791. Find the central node of the star chart
Knowledge points of mall development