在好例子网,分享、交流、成长!
您当前所在位置:首页C/C++ 开发实例图形和图像处理 → HLSL and Pixel Shaders for XAML Developers

HLSL and Pixel Shaders for XAML Developers

图形和图像处理

下载此实例
  • 开发语言:C/C++
  • 实例大小:25.22M
  • 下载次数:16
  • 浏览次数:113
  • 发布时间:2022-03-19
  • 实例类别:图形和图像处理
  • 发 布 人:rexswang
  • 文件格式:.pdf
  • 所需积分:2
 相关标签: developers develop shader XAML dev

实例介绍

【实例简介】HLSL and Pixel Shaders for XAML Developers

shader相关书籍

【实例截图】

【核心代码】

Table of Contents
Preface ..................................................................... ix
Foreword ................................................................... xv
1. Shader 101 ............................................................. 1
Why Should XAML Developers Learn HLSL? 1
The Tale of the Shader 2
HLSL and DirectX 3
Understanding the Graphics Pipeline 5
XAML and Shaders 7
Summary 9
2. Getting Started ........................................................ 11
Setting Up Your Development Computer 11
Silverlight Development 11
WPF Development 12
Expression Blend 4 12
Choosing a Shader Compiler 12
DirectX Compiler 12
WPF Build Task 13
Shazzam Shader Editor 13
Other Tools to Consider 13
FX Composer 13
NShader 14
Visual Studio 2012 14
A First Shader Project 15
Using Prebuilt Effects 16
Adding Effects 19
Debrief 22
Custom Shader 22
Create a Shader Algorithm 23
iii
Compile the HLSL Code 24
Add to Visual Studio XAML Project 24
Create a .NET Wrapper Class 25
Compile the Project 26
Instantiate the Shader 27
Summary 28
3. Commonplace Pixel Shaders ............................................. 29
A Word About Pseudocode 30
Our Sample Image 30
Color Modification 30
Common Techniques 31
Black, White, and Gray 32
Color Replacement 34
Color Enhancement and Correction 34
Distinctive Effects 36
Distortion and Displacement 37
Magnify 38
Embossed 39
Testing Distortion Effects 40
Other Displacement Effects 42
Blurs 42
Motion Blur 43
Zoom Blur 43
Sharpening 43
Generative Effects 43
Multiple Inputs 44
Sampler Transition 44
Texture Map 46
Color Combination 47
Photoshop Blend Modes 49
Darken Modes 49
Lighten Modes 51
Contrast Modes 52
Comparative Modes 52
Other Modes 52
Blend Modes in HLSL 53
Practical Uses for Shader Effects 53
Motion Blur in Moving Parts 54
Blurs to Emphasize UI Focus 54
Desaturate for Emphasis 55
Summary 55
iv | Table of Contents
4. How WPF and Silverlight Use Shaders ..................................... 57
Framework Effects 57
BlurEffect 58
DropShadowEffect 59
Nested Effects 59
Multiple Effects on One Element 59
Expression Blend Effects 60
Using a Blend Effect 61
Custom Effects 63
Creating a Custom ShaderEffect 63
Working with Samplers 65
Multi-Input Shaders 72
Understanding Sampler Size 73
Creating Parameterized Effects 75
Padding 77
Effect Mapping 78
Summary 83
5. Using Expression Blend and Visual Studio with Shaders ...................... 85
Creating a Project 85
New Project 86
Adding Assets 87
Adding Effects 88
Setting Effect Properties 90
Visual Studio Editor 90
Using Custom Effects in Blend 92
Multi-Input Effects 94
Transition Effects in Blend 98
Create a State Group 98
Add the States 99
Set the Properties 99
Adding a Transition Effect 100
Summary 102
6. Using the Shazzam Shader Editor ........................................ 103
UI Tour 103
Create a Custom Shader 103
Exploring the HLSL Code Editor 105
Compiling and Testing the Shader 106
Editor Status Bar 109
Exploring the Generated Code 109
Changing Options 110
Working with HLSL Parameters 112
Table of Contents | v
Testing Parameters 113
Default Values for Parameters 114
Shazzam Tags 115
Input Parameter Types 117
Influencing the .NET Type 117
Multi-Input Shaders 119
Shader Loader 121
More Shazzam Tools 123
Copying the Files into a Visual Studio Project 123
Summary 124
7. HLSL in Detail ........................................................ 125
Parallel Processing in Shaders 125
Parallelism and the GPU 126
One-Pixel-at-a-Time Algorithm 126
The Relationship Between DirectX and the GPU 127
Understanding Registers 127
Basic Structure of an HLSL Program 128
User-Defined Functions 129
Semantics 130
Data Types 132
Type Casting 138
Local Variables 139
Shader Inputs 139
TEXCOORD Input 139
Global Variables 140
Global Inputs 140
Texture and Sampler Input 141
Sampler Declarations 142
Other Code Constructs 143
Flow Control—Branching 143
Flow Control—Loops 144
Operators 144
Built-in Functions 145
Texture Functions 146
Math Functions 146
Useful Built-in Functions 147
Summary 147
8. The Zen of Shader Programming ........................................ 149
Zen of Pixel Programming 149
Sampling a Pixel Color 149
Sampling a Color from Another Texture 150
vi | Table of Contents
Colors 151
Color Channel Manipulation 151
Conditional Colors 152
Replace a Color 153
Other Color Modifier Examples 154
Coordinates 158
Distortion and Displacement Effects 165
Random Values 170
Noise Textures 172
Perlin Noise in Shaders 175
Summary 179
A. Resources ........................................................... 181
B. Shazzam Settings ..................................................... 183

实例下载地址

HLSL and Pixel Shaders for XAML Developers

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警