⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 三维坐标系与几何学.htm

📁 此文件是微软MSDN中d3d部分资料的翻译文件
💻 HTM
📖 第 1 页 / 共 5 页
字号:
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><!--[if gte vml 1]><v:shape 
id=_x0000_i1054 style="WIDTH: 200.25pt; HEIGHT: 95.25pt" type = "#_x0000_t75" 
coordsize = "21600,21600"><v:imagedata o:title="flatvert" src = 
"3DCS_files/image006.gif"></v:imagedata></v:shape><![endif]--><![if !vml]><img border=0 width=267 height=127
src="3DCS_files/image006.gif" v:shapes="_x0000_i1054"><![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">但是,更可能的情况是物体由三角形带(<SPAN 
lang=EN-US>triangle 
strips)组成且三角形不共面。要对整个三角形带的三角形平滑着色的一个简单方法是首先计算与顶点相关联的每个多边形表面的表面法向量。可以这样计算顶点法向,使顶点法向与顶点所属的每个表面的法向的夹角相等。但是,对复杂图元来说这种方法可能不够有效。<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">这种方法如下图所示。图中有两个表面,<SPAN 
lang=EN-US>S1与S2,它们的邻边在上方。S1与S2的法向量用蓝色显示。顶点的法向量用红色显示。顶点法向量与S1表面法向的夹角和顶点法向量与S2表面法向的夹角相同。当对这两个表面进行光照计算和高洛德着色时,得到结果是中间的边被平滑着色,看起来像是弧形的(而不是有棱角的)。<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><!--[if gte vml 1]><v:shape 
id=_x0000_i1055 style="WIDTH: 254.25pt; HEIGHT: 344.25pt" type = "#_x0000_t75" 
coordsize = "21600,21600"><v:imagedata o:title="gvert" src = 
"3DCS_files/image007.gif"></v:imagedata></v:shape><![endif]--><![if !vml]><img border=0 width=339 height=459
src="3DCS_files/image007.gif" v:shapes="_x0000_i1055"><![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">如果顶点法向偏向与它相关联的某个面,那么会导致那个面上的点光强度的增加或减少。下图显示了一个例子。这些面的邻边依然朝上。顶点法向倾向<SPAN 
lang=EN-US>S1,与顶点法向与表面法向有相同的夹角相比,这使顶点法向与光源间的夹角变小。<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><!--[if gte vml 1]><v:shape 
id=_x0000_i1056 style="WIDTH: 198.75pt; HEIGHT: 331.5pt" type = "#_x0000_t75" 
coordsize = "21600,21600"><v:imagedata o:title="gvert2" src = 
"3DCS_files/image008.gif"></v:imagedata></v:shape><![endif]--><![if !vml]><img border=0 width=265 height=442
src="3DCS_files/image008.gif" v:shapes="_x0000_i1056"><![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">可以用高洛德着色在三维场景中显示一些有清晰边缘的物体。要达到这个目的,只要在需要产生清晰边缘的表面交线处,把表面法向复制给交线处顶点的法向,如下图所示。<SPAN 
lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><!--[if gte vml 1]><v:shape 
id=_x0000_i1051 style="WIDTH: 259.5pt; HEIGHT: 170.25pt" type = "#_x0000_t75" 
coordsize = "21600,21600"><v:imagedata o:title="shade1" src = 
"3DCS_files/image009.gif"></v:imagedata></v:shape><![endif]--><![if !vml]><img border=0 width=346 height=227
src="3DCS_files/image009.gif" v:shapes="_x0000_i1051"><![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">如果使用<SPAN 
lang=EN-US>DrawPrimitive方法渲染场景,要将有锋利边缘的物体定义为三角形表,而非三角形带。当将物体定义为三角形带时,Direct3D会将它作为由多个三角形组成的单个多边形处理。高洛德着色被同时应用于多边形每个表面的内部和表面之间。结果产生表面之间平滑着色的物体。因为三角形表由一系列不相连的三角形面组成,所以Direct3D对多边形每个面的内部使用高洛德着色。但是,没有在表面之间应用高洛德着色。如果三角形表的两个或更多的三角形是相邻的,那么在它们之间看起来会有一条锋利边缘。<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">另一种可选的方法是在渲染具有锋利边缘的物体时改变到平面着色模式。这在计算上是最有效的方法,但它可能导致场景中的物体不如用高洛德着色渲染的物体真实。<SPAN 
lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">
<HR align=center width="100%" SIZE=1>
</SPAN></DIV>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 1"><A 
name=三角形光栅化法则><B><SPAN 
style="FONT-SIZE: 24pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 18.0pt; mso-fareast-language: ZH-CN">三角形光栅化法则<SPAN 
lang=EN-US><o:p></o:p></SPAN></SPAN></B></A></P><SPAN 
style="mso-bookmark: 三角形光栅化法则"></SPAN>
<DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">
<HR align=center width="100%" SIZE=1>
</SPAN></DIV>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">顶点指定的点经常不能精确地对应到屏幕上的像素。此时,<SPAN 
lang=EN-US>Microsoft&reg; 
Direct3D&reg;使用三角形光栅化法则决定对于给定三角形使用哪个像素。<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 lfo4"><U><SPAN 
  lang=EN-US 
  style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><A 
  href="http://www.gesoftfactory.com/developer/3DCS.htm#三角形光栅化法则">三角形光栅化法则</A></SPAN></U><SPAN 
  lang=EN-US 
  style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; 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 lfo4"><U><SPAN 
  lang=EN-US 
  style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><A 
  href="http://www.gesoftfactory.com/developer/3DCS.htm#点、线光栅化法则">点、线光栅化法则</A></SPAN></U><SPAN 
  lang=EN-US 
  style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; 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 lfo4"><U><SPAN 
  lang=EN-US 
  style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><A 
  href="http://www.gesoftfactory.com/developer/3DCS.htm#点精灵光栅化法则">点精灵光栅化法则</A></SPAN></U><SPAN 
  lang=EN-US 
  style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><o:p></o:p></SPAN> 
  </LI></UL>
<H2>三角形光栅化法则</H2>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">Direct3D在填充几何图形时使用左上填充约定(top-left 
filling convention)。这与Microsoft 
Windows&reg;的图形设备接口(GUI)和OpenGL中的矩形使用的约定相同。Direct3D中,像素的中心是决定点。如果中心在三角形内,那么该像素就是三角形的一部分。像素中心用整数坐标表示。<o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">这里描述的<SPAN 
lang=EN-US>Direct3D使用的三角形光栅化法则不一定适用于所有可用的硬件。测试可以发现这些法则的实现间的细微变化。<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">下图显示了一个左上角为(<SPAN 
lang=EN-US>0,0),右下角为(5,5)的矩形。正如大家想象的那样,此矩形填充25个像素。矩形的宽度由right减left定义。高度由bottom减top定义。<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><!--[if gte vml 1]><v:shape 
id=_x0000_i1052 style="WIDTH: 248.25pt; HEIGHT: 245.25pt" type = "#_x0000_t75" 
coordsize = "21600,21600"><v:imagedata o:title="pixmap" src = 
"3DCS_files/image010.gif"></v:imagedata></v:shape><![endif]--><![if !vml]><img border=0 width=331 height=327
src="3DCS_files/image010.gif" v:shapes="_x0000_i1052"><![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">在左上填充约定中,<I 
style="mso-bidi-font-style: normal">上</I>表示水平<SPAN lang=EN-US>span在垂直方向上的位置,<I 
style="mso-bidi-font-style: normal">左</I>表示span中的像素在水平方向上的位置。一条边除非是水平的,否则不可能是顶边——一般来说,大多数三角形只有左边或右边。<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><!--[if gte vml 1]><v:shape 
id=_x0000_i1057 style="WIDTH: 414.75pt; HEIGHT: 215.25pt" type = "#_x0000_t75" 
coordsize = "21600,21600"><v:imagedata o:title="triedge" src = 
"3DCS_files/image011.png"></v:imagedata></v:shape><![endif]--><![if !vml]><img border=0 width=553 height=287
src="3DCS_files/image012.jpg" v:shapes="_x0000_i1057"><![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">左上填充约定确定当一个三角形穿过像素的中心时<SPAN 
lang=EN-US>Direct3D采取的动作。下图显示了两个三角形,一个在(0,0),(5,0)和(5,5),另一个在(0,5),(0,0)和(5,5)。在这种情况下第一个三角形得到15个像素(显示为黑色),而第二个得到10个像素(显示为灰色),因为公用边是第一个三角形的左边。<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><!--[if gte vml 1]><v:shape 
id=_x0000_i1042 style="WIDTH: 248.25pt; HEIGHT: 245.25pt" type = "#_x0000_t75" 
coordsize = "21600,21600"><v:imagedata o:title="twotris" src = 
"3DCS_files/image013.gif"></v:imagedata></v:shape><![endif]--><![if !vml]><img border=0 width=331 height=327
src="3DCS_files/image013.gif" v:shapes="_x0000_i1042"><![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">如果应用程序定义一个左上角为(<SPAN 
lang=EN-US>0.5,0.5),右下角为(2.5,4.5)的矩形,那么这个矩形的中心在(1.5,2.5)。当Direct3D光栅化器tessellate这个矩形时,每个像素的中心都毫无异义地分别位于四个三角形中,此时就不需要左上填充约定。下图显示了这种情况。矩形内的像素根据在Direct3D中被哪个三角形包含做了相应的标注。<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><!--[if gte vml 1]><v:shape 
id=_x0000_i1043 style="WIDTH: 174.75pt; HEIGHT: 245.25pt" type = "#_x0000_t75" 
coordsize = "21600,21600"><v:imagedata o:title="noambig" src = 
"3DCS_files/image014.gif"></v:imagedata></v:shape><![endif]--><![if !vml]><img border=0 width=233 height=327
src="3DCS_files/image014.gif" v:shapes="_x0000_i1043"><![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">如果将上例中的矩形移动,使之左上角为(<SPAN 
lang=EN-US>1.0,1.0),右下角为(3.0,5.0),中心为(2.0,3.0),那么Direct3D使用左上角填充约定。这个矩形中大多数的像素跨越两个或更多的三角形的边界,如下图所示。<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><!--[if gte vml 1]><v:shape 
id=_x0000_i1044 style="WIDTH: 302.25pt; HEIGHT: 245.25pt" type = "#_x0000_t75" 
coordsize = "21600,21600"><v:imagedata o:title="fillrule" src = 
"3DCS_files/image015.gif"></v:imagedata></v:shape><![endif]--><![if !vml]><img border=0 width=403 height=327
src="3DCS_files/image015.gif" v:shapes="_x0000_i1044"><![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN">这两个矩形会影响到相同的像素。<SPAN 
lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN lang=EN-US 
style="FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-fareast-language: ZH-CN"><!--[if gte vml 1]><v:shape 
id=_x0000_i1045 style="WIDTH: 414.75pt; HEIGHT: 247.5pt" type = "#_x0000_t75" 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -