HLSL 起步
作者:XX
目录
目录.......................................................................................................................................................................1
前言...............................................................................................................................................................................................2
1.HLSL 入门...............................................................................................................................................................................14
1.1 什么是着色器.......................................................................................................................................14
1.2 什么是 HLSL........................................................................................................................................15
1.3 怎么写 HLSL 着色器...........................................................................................................................15
1.3.1 全局变量....................................................................................................................................16
1.3.2 输入输出....................................................................................................................................16
1.3.3 入口函数....................................................................................................................................17
1.3.4 总结............................................................................................................................................17
1.4 怎么用 HLSL 着色器...........................................................................................................................17
1.4.1 声明全局变量............................................................................................................................18
1.4.2 编译着色器................................................................................................................................18
1.4.3 创建着色器................................................................................................................................18
1.4.4 把着色器设定到渲染管道中....................................................................................................19
1.4.5 整个渲染过程如下....................................................................................................................19
2.顶点着色器..............................................................................................................................................................................44
2.1 可编程数据流模型...............................................................................................................................44
2.2 顶点声明...............................................................................................................................................45
2.2.1 描述顶点声明............................................................................................................................45
2.2.2 创建顶点声明............................................................................................................................46
2.2.3 设置顶点声明............................................................................................................................46
2.3 用顶点着色器实现渐变动画...............................................................................................................47
2.3.1 渐变动画(Morphing)............................................................................................................47
2.3.2 渐变动画中的顶点声明............................................................................................................47
2.3.3 渐变动画中的顶点着色器........................................................................................................48
2.3.4 应用程序....................................................................................................................................49
2.3.5 对应用程序的一点说明............................................................................................................52
3.像素着色器..............................................................................................................................................................................54
3.1 多纹理化...............................................................................................................................................54
3.2 多纹理效果的像素着色器...................................................................................................................54
3.2.1HLSL 采样器和纹理..................................................................................................................55
3.3 应用程序...............................................................................................................................................56
4.HLSL Effect(效果框架).....................................................................................................................................................60
4.1Effect 代码结构.....................................................................................................................................60
4.2 用 Effect 实现多纹理化效果...............................................................................................................60
4.2.1 着色器........................................................................................................................................61
4.2.2 应用程序....................................................................................................................................63
结语.....................................................................................................................................................................66
参考资料.............................................................................................................................................................66