青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

地形共享面的頂點法線的計算

Terrain Tutorial
地形教程

Computing Normals
法線的計算

To apply lighting to a terrain, either using OpenGL lights, or simulating them, it is necessary to first compute normals. A normal is a vector that defines how a surface responds to lighting, i.e. how it is lit. The amount of light reflected by a surface is proportional to the angle between the lights direction and the normal. The smaller the angle the brighter the surface will look.
為了給地形進行光照,任意一個OpenGL的光照,或者模擬它們, 那么我們必須要首先計算法線. 法線是一個向量定義了表面對光照的響應.例如,如何去照亮它.表面的反射光量是與光線方向與法線方向的夾角成正比. 夾角越小表面就會看起來越亮.

Normals in OpenGL can be defined per face or per vertex. If defining a normal per face then the normal is commonly defined as a vector which is perpendicular to the surface. In order to find a perpendicular vector to a face, two vectors coplanar with the face are needed. Afterwards the cross product will provide the normal vector, i.e. a perpendicular vector to the face.
OpenGL里面可以定義面法線和頂點法線. 如果定義了面法線,那么這個法線向量一般都要正交于這個表面. 為了去找到面的正交向量, 需要兩個共面向量. 然后它們叉乘就會產生法向量, 一個正交于面的向量.

So the first step is to compute two vectors coplanar to a face. Assuming the the faces are triangles defined by points t1,t2,t3, then two possible vectors are:
所以首先來計算面的兩個共面的向量.假設面是三角形用t1,t2,t3定義, 然后兩個可能的向量是:
v1 = t2 - t1
v2 = t3 - t1



With the two vectors, v1 and v2, it is now possible to compute the cross product between them to find a perpendicular vector to the face.
有了兩個向量v1和v2, 現在我們就可以計算叉乘,來找到正交于面的一個向量.



The equations bellow show the necessary steps to compute a normal vector v. The required opeartion is called cross product, and it is represented by "x".
下面的等式展示了計算法線v的必要的一些步驟. 這個需要的運算叫做叉乘, 我們把它表示為"X"
v = v1 x v2

v = [vx,vy,vz] where,

vx = v1y * v2z - v1z * v2y

vy = v1z * v2x - v1x * v2z

vz = v1x * v2y - v1y * v2x
Another necessary step to obtain proper lighting is to normalise the vector, i.e. make it unit length. OpenGL takes into consideration the length of the normal vector when computing lighting. Normalisation implies first computing the lenght of the vector, and then dividing each component by the vectors length.
另一個必要的步驟獲得正確的光照是歸一化這個向量, 就是讓它是單位長度. OpenGL在計算光照的時候需要考慮歸一化的法向量.歸一化的過程意味著第一步首先計算向量的長度,然后向量的每個部分除以此長度.

The length of a vector is computed as:
向量的長度是以下公式計算來:



Therefore the normalized vector nv is computed as:
因此,歸一化的向量nv計算過程如下:
nv = [nvx,nvy,nvz] where,

nvx = vx / l
nvy = vy / l
nvz = vz / l
The main problem with assigning a normal per face is that the terrain looks faceted, i.e. the brightness of each face is constant, and there is a clear difference between faces with differen orientations. In order to get a smoother look normals should be computed per vertex, and not per face. When computing normals per vertex it is necessary to take into account the faces that share the vertex. So for instance if using quads, each vertex (excluding the corner and border vertices), is shared by four polygons. The normal at a vertex should be computed as the normalised sum of all the unit length normals for each face the vertex shares. Consider the following image:
為地形使用面法線最大的問題就是它看起來一塊一塊的, 因為每個面的亮度都是恒定的,并且每個方向的面上的亮度都有明顯的區別。為了看起來更加的光滑,我們必須為每個頂點計算法線,而不是每個面計算法線。當計算頂點法線的時候,我們有必要考慮到此頂點共享的所有面,所以我們用方形舉例,每個頂點(排除掉角落和邊緣的頂點)被四個多邊形共享。這個頂點的法線就應該是所有共享面法線的和在歸一化的結果。看看下面的圖:



In the above image, v represents the normal at the center vertex. Each vij represents a normal for each face that shares the center vertex. So for instance v12 is the unit lenght normal for the bottom right face.
在上面的圖里,v代表了中心頂點的法線。每個vij表示每個共享面的法線。所以例如v12是右下方面的單位長度的法線。

The vertex normal v is computed as the normalised sum of all vij vectors:
頂點法線v被計算作為所有vij向量歸一化后的和。
v = normalised(sum(v12, v23, v34, v41))

where

vij = normalised(vi x vj) // normalised cross product
It is also posible to consider the eight neighbour vertices, instead of only four. This latter option will probably look smoother in the general case.
也可以考慮8個相臨的頂點。這個是后來的選項比一般的做法看起來更加光滑。

Note that when computing the normals a scale is assumed. If the application has performed non-uniform scaling the normals will no longer be correct. If scaling the heights is required use the function terrainScale provided in the terrain library. This function recomputes the normals. If the grid needs scaling then use the function terrainDim to enlarge the terrain
注意當計算法線時假設了一個縮放。如果程序使用了一個非歸整的縮放,那么法線將不再正確。如果縮放了高度,那么就需要使用函數terrainScale來調整。這個函數重新計算了法線。如果網格需要縮放,那么就使用terrainDim函數來擴大地形。

posted on 2008-09-19 03:45 RedLight 閱讀(2645) 評論(0)  編輯 收藏 引用 所屬分類: 3D渲染技術

<2009年6月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

導航

統計

公告


Name: Galen
QQ: 88104725

常用鏈接

留言簿(3)

隨筆分類

隨筆檔案

相冊

My Friend

搜索

最新評論

閱讀排行榜

評論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲国产日韩精品| 亚洲国产日本| 欧美在线视频免费观看| 国产精品久久777777毛茸茸| 亚洲视频视频在线| 在线一区日本视频| 国产午夜精品理论片a级探花| 午夜精品久久99蜜桃的功能介绍| 亚洲一区网站| 韩国一区电影| 亚洲国产精品福利| 国产精品爱啪在线线免费观看| 午夜精品久久久久久久99樱桃| 午夜精品福利在线观看| 在线观看视频一区| 亚洲毛片在线| 国产在线精品二区| 欧美成人国产一区二区| 欧美日韩成人网| 久久国产精品72免费观看| 久久亚洲图片| 亚欧美中日韩视频| 久久影视三级福利片| 亚洲调教视频在线观看| 久久久精品国产免大香伊| 亚洲美女黄色片| 午夜精品免费| 99在线精品观看| 欧美有码视频| 一本色道久久综合亚洲精品不卡| 欧美在线国产精品| 亚洲午夜精品17c| 久久综合九色综合网站| 亚洲综合精品四区| 欧美高清在线| 久久久久久久久蜜桃| 欧美日韩国产页| 老妇喷水一区二区三区| 欧美偷拍另类| 亚洲国产精品悠悠久久琪琪| 国产精品一区久久| 日韩亚洲国产精品| 亚洲欧洲另类| 久久久久久有精品国产| 欧美一区激情| 国产精品男gay被猛男狂揉视频| 乱中年女人伦av一区二区| 国产啪精品视频| 亚洲视频图片小说| 在线视频亚洲欧美| 欧美精品一区二区精品网| 美女爽到呻吟久久久久| 国产精品色午夜在线观看| 亚洲三级电影在线观看| 亚洲国产成人不卡| 久久久久九九九| 久久免费的精品国产v∧| 国产日韩综合| 午夜欧美精品久久久久久久| 午夜精品久久久久久99热| 欧美日韩在线播| 99精品欧美一区| 一区二区三区国产| 欧美日韩亚洲综合一区| 欧美激情一区二区三区成人| 影音国产精品| 久久亚洲美女| 亚洲国产成人不卡| 一区二区日本视频| 国产精品久久久久久久第一福利| 一区二区三区精品视频| 亚洲综合色激情五月| 国产精品色午夜在线观看| 亚洲欧美中文在线视频| 久久久免费精品视频| 亚洲电影有码| 欧美国产在线观看| 日韩一级裸体免费视频| 亚洲欧美经典视频| 国产色爱av资源综合区| 久久美女艺术照精彩视频福利播放| 欧美成人资源网| 在线一区亚洲| 国产午夜亚洲精品理论片色戒| 欧美一区二区三区免费视| 蜜臀久久久99精品久久久久久| 亚洲国产日韩在线一区模特| 欧美另类人妖| 亚洲欧美在线一区| 欧美黄色免费| 亚洲自拍偷拍麻豆| 国语精品中文字幕| 欧美激情女人20p| 在线性视频日韩欧美| 久久久久久黄| 日韩小视频在线观看专区| 国产精品伦理| 欧美成人亚洲| 亚洲欧美变态国产另类| 亚洲高清色综合| 欧美一二区视频| 亚洲韩国青草视频| 国产精品入口尤物| 免费观看亚洲视频大全| 亚洲最黄网站| 欧美国产欧美亚洲国产日韩mv天天看完整| 日韩午夜在线播放| 黄色av成人| 国产精品久久久久久久久借妻| 久久精品国产77777蜜臀| 一本大道久久a久久精二百| 狼人社综合社区| 小黄鸭精品aⅴ导航网站入口| 91久久国产综合久久| 国产无遮挡一区二区三区毛片日本| 欧美高清不卡| 久久欧美肥婆一二区| 亚洲欧美bt| 中日韩视频在线观看| 亚洲国产一区二区三区青草影视| 性欧美xxxx视频在线观看| 一本色道久久88综合日韩精品| 在线电影国产精品| 国产视频自拍一区| 国产精品免费一区二区三区在线观看| 欧美国产亚洲精品久久久8v| 久久精品日韩欧美| 欧美亚洲午夜视频在线观看| 9i看片成人免费高清| 91久久线看在观草草青青| 免费欧美日韩| 欧美r片在线| 免费看的黄色欧美网站| 久久视频一区| 久久久久欧美精品| 久久精品亚洲热| 久久狠狠久久综合桃花| 欧美一级播放| 欧美一区三区二区在线观看| 午夜日韩视频| 亚洲一级影院| 亚洲影院高清在线| 午夜老司机精品| 午夜精品久久久久久久99黑人| 亚洲在线观看免费视频| 亚洲欧美中文字幕| 欧美一区二区免费| 久久国产99| 久久夜色精品国产欧美乱极品| 久久久久国产一区二区三区四区| 欧美一区二区私人影院日本| 欧美一进一出视频| 久久精品最新地址| 欧美xart系列在线观看| 欧美黄免费看| 99精品久久久| 欧美一区二区精品| 久久综合福利| 欧美日韩久久精品| 国产乱码精品一区二区三区五月婷 | 国产精品久久久久久久久免费| 国产精品久久久一区二区| 国产伦精品一区二区三区视频黑人 | 久久精品男女| 蜜臀久久久99精品久久久久久| 欧美96在线丨欧| 欧美日韩亚洲视频| 国产日韩亚洲欧美精品| 伊人久久大香线蕉av超碰演员| 亚洲国产另类久久精品| 中文日韩欧美| 久久蜜臀精品av| 亚洲精品影视在线观看| 亚洲主播在线| 免费看亚洲片| 国产精品久久久久毛片软件| 国产日韩亚洲欧美精品| 最新成人av网站| 亚洲欧美日韩爽爽影院| 欧美大片免费久久精品三p| 99在线热播精品免费| 久久久久久97三级| 欧美午夜美女看片| 亚洲国产精品一区| 香蕉成人久久| 亚洲精美视频| 久久久www成人免费无遮挡大片| 欧美巨乳波霸| 在线观看亚洲视频啊啊啊啊| 中日韩男男gay无套| 蜜臀av一级做a爰片久久 | 欧美激情影院| 欧美一区1区三区3区公司| 欧美激情一区二区久久久| 国产主播一区二区| 亚洲一区一卡| 亚洲精品免费在线播放| 久久综合综合久久综合| 国产日韩欧美日韩大片| 亚洲午夜性刺激影院|