📄 像素着色器 (pixel shaders).htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0055)http://www.gesoftfactory.com/developer/PixelShaders.htm -->
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word"><HEAD><TITLE>Pixel Shaders</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content=Word.Document name=ProgId>
<META content="MSHTML 6.00.2900.3314" name=GENERATOR>
<META content="Microsoft Word 10" name=Originator><LINK
href="PixelShaders_files/filelist.xml" rel=File-List><LINK
href="PixelShaders_files/editdata.mso" rel=Edit-Time-Data><!--[if !mso]>
<STYLE>v\:* {
BEHAVIOR: url(#default#VML)
}
o\:* {
BEHAVIOR: url(#default#VML)
}
w\:* {
BEHAVIOR: url(#default#VML)
}
.shape {
BEHAVIOR: url(#default#VML)
}
</STYLE>
<![endif]--><!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>SGuy</o:Author>
<o:LastAuthor>SGuy</o:LastAuthor>
<o:Revision>3</o:Revision>
<o:TotalTime>154</o:TotalTime>
<o:LastPrinted>2003-07-26T11:38:00Z</o:LastPrinted>
<o:Created>2003-07-27T11:00:00Z</o:Created>
<o:LastSaved>2003-07-27T11:01:00Z</o:LastSaved>
<o:Pages>10</o:Pages>
<o:Words>2094</o:Words>
<o:Characters>11939</o:Characters>
<o:Company>S3 Graphics, Inc</o:Company>
<o:Lines>99</o:Lines>
<o:Paragraphs>28</o:Paragraphs>
<o:CharactersWithSpaces>14005</o:CharactersWithSpaces>
<o:Version>10.3501</o:Version>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:Compatibility>
<w:UseFELayout/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]-->
<STYLE>@font-face {
font-family: Wingdings;
}
@font-face {
font-family: 宋体;
}
@font-face {
font-family: 黑体;
}
@font-face {
font-family: @宋体;
}
@font-face {
font-family: @黑体;
}
@page Section1 {size: 612.0pt 792.0pt; margin: 72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin: 36.0pt; mso-footer-margin: 36.0pt; mso-even-footer: url("PixelShaders_files/header.htm") ef1; mso-footer: url("PixelShaders_files/header.htm") f1; mso-paper-source: 0; }
P.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; mso-fareast-language: EN-US; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: 宋体
}
LI.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; mso-fareast-language: EN-US; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: 宋体
}
DIV.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; mso-fareast-language: EN-US; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: 宋体
}
H1 {
FONT-WEIGHT: bold; FONT-SIZE: 24pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; FONT-FAMILY: 宋体; mso-fareast-language: EN-US; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 1; mso-hansi-font-family: "Times New Roman"
}
H2 {
FONT-WEIGHT: bold; FONT-SIZE: 18pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; FONT-FAMILY: 宋体; mso-fareast-language: EN-US; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 2; mso-hansi-font-family: "Times New Roman"
}
H3 {
FONT-WEIGHT: bold; FONT-SIZE: 13.5pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; FONT-FAMILY: 宋体; mso-fareast-language: EN-US; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 3
}
P.MsoFooter {
FONT-SIZE: 9pt; MARGIN: 0cm 0cm 0pt; LAYOUT-GRID-MODE: char; FONT-FAMILY: "Times New Roman"; mso-fareast-language: EN-US; mso-pagination: widow-orphan; mso-fareast-font-family: 宋体; tab-stops: center 207.65pt right 415.3pt
}
LI.MsoFooter {
FONT-SIZE: 9pt; MARGIN: 0cm 0cm 0pt; LAYOUT-GRID-MODE: char; FONT-FAMILY: "Times New Roman"; mso-fareast-language: EN-US; mso-pagination: widow-orphan; mso-fareast-font-family: 宋体; tab-stops: center 207.65pt right 415.3pt
}
DIV.MsoFooter {
FONT-SIZE: 9pt; MARGIN: 0cm 0cm 0pt; LAYOUT-GRID-MODE: char; FONT-FAMILY: "Times New Roman"; mso-fareast-language: EN-US; mso-pagination: widow-orphan; mso-fareast-font-family: 宋体; tab-stops: center 207.65pt right 415.3pt
}
A:link {
COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
P {
FONT-SIZE: 12pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; FONT-FAMILY: 宋体; mso-fareast-language: EN-US; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-hansi-font-family: "Times New Roman"; mso-bidi-font-family: "Times New Roman"
}
PRE {
FONT-SIZE: 10pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: 黑体; mso-fareast-language: EN-US; mso-pagination: widow-orphan; mso-hansi-font-family: "Courier New"; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt; mso-bidi-font-family: "Courier New"
}
DIV.Section1 {
page: Section1
}
OL {
MARGIN-BOTTOM: 0cm
}
UL {
MARGIN-BOTTOM: 0cm
}
</STYLE>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";}
</style>
<![endif]--></HEAD>
<BODY lang=ZH-CN style="tab-interval: 36.0pt" vLink=purple link=blue>
<DIV class=Section1>
<H1><SPAN style="mso-fareast-language: ZH-CN">像素着色器<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN></H1>
<DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN lang=EN-US>
<HR align=center width="100%" SIZE=1>
</SPAN></DIV>
<P><SPAN style="mso-fareast-language: ZH-CN">在<SPAN lang=EN-US>Microsoft
DirectX</SPAN></SPAN><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-ascii-font-family: 宋体">®</SPAN><SPAN
lang=EN-US style="mso-fareast-language: ZH-CN"> 8.0之前,Microsoft</SPAN><SPAN
lang=EN-US
style="FONT-FAMILY: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-ascii-font-family: 宋体">®</SPAN><SPAN
lang=EN-US style="mso-fareast-language: ZH-CN"> Direct3D</SPAN><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-ascii-font-family: 宋体">®</SPAN><SPAN
style="mso-fareast-language: ZH-CN">使用固定功能流水线把三维几何体转换为屏幕上的像素。用户通过设置流水线的属性来控制<SPAN
lang=EN-US>Direct3D进行变换、光照和渲染像素的方式。固定功能顶点格式在编译的时候定义并决定输入顶点的格式,一旦定义,用户在运行的时候就几乎无法控制流水线的改变。<o:p></o:p></SPAN></SPAN></P>
<P><SPAN
style="mso-fareast-language: ZH-CN">通过允许对顶点的变换、光照和对每个像素的着色等功能进行编程,着色器把图形流水线引入了一个新的高度。像素着色器是一些小程序,在对三角形进行光栅化操作时运行。这在渲染像素的方法上给了用户更高一级的灵活性。<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P><SPAN style="mso-fareast-language: ZH-CN">像素着色器包含由<SPAN
lang=EN-US>ASCII文本组成的像素着色器指令。算术指令可以用来进行漫反射和/或镜面反射光照计算。纹理寻址指令提供了多种读取和应用纹理数据的操作。着色器具有这样的功能,可以给颜色分量设置掩码以及交换颜色分量。着色器的正文看起来有点像汇编语言,它用Direct3D扩展(D3DX)进行汇编,输入可以是文本字符串或是文件。汇编器的输出是一系列操作码,应用程序可以通过<U>IDirect3DDevice9::CreatePixelShader</U>方法把这些操作码提供给Direct3D。像素着色器有几个版本,请参阅<U>着色器参考手册</U>。<o:p></o:p></SPAN></SPAN></P>
<UL type=disc>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l2 level1 lfo7"><U><SPAN
lang=EN-US style="mso-fareast-language: ZH-CN"><A
href="http://www.gesoftfactory.com/developer/PixelShaders.htm#_创建像素着色器"><SPAN
style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">创建像素着色器</SPAN></A></SPAN></U><SPAN
lang=EN-US style="mso-fareast-language: ZH-CN"> – </SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-fareast-language: ZH-CN; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">包含了示例代码,用像素着色器对物体的漫反射色进行高洛德插值。本示例包含了对所使用方法的详细描述。</SPAN><SPAN
lang=EN-US style="mso-fareast-language: ZH-CN"><o:p></o:p></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l2 level1 lfo7"><U><SPAN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -