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

地形共享面的頂點(diǎn)法線的計(jì)算

Terrain Tutorial
地形教程

Computing Normals
法線的計(jì)算

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.
為了給地形進(jìn)行光照,任意一個(gè)OpenGL的光照,或者模擬它們, 那么我們必須要首先計(jì)算法線. 法線是一個(gè)向量定義了表面對(duì)光照的響應(yīng).例如,如何去照亮它.表面的反射光量是與光線方向與法線方向的夾角成正比. 夾角越小表面就會(huì)看起來越亮.

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里面可以定義面法線和頂點(diǎn)法線. 如果定義了面法線,那么這個(gè)法線向量一般都要正交于這個(gè)表面. 為了去找到面的正交向量, 需要兩個(gè)共面向量. 然后它們叉乘就會(huì)產(chǎn)生法向量, 一個(gè)正交于面的向量.

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:
所以首先來計(jì)算面的兩個(gè)共面的向量.假設(shè)面是三角形用t1,t2,t3定義, 然后兩個(gè)可能的向量是:
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.
有了兩個(gè)向量v1和v2, 現(xiàn)在我們就可以計(jì)算叉乘,來找到正交于面的一個(gè)向量.



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".
下面的等式展示了計(jì)算法線v的必要的一些步驟. 這個(gè)需要的運(yùn)算叫做叉乘, 我們把它表示為"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.
另一個(gè)必要的步驟獲得正確的光照是歸一化這個(gè)向量, 就是讓它是單位長度. OpenGL在計(jì)算光照的時(shí)候需要考慮歸一化的法向量.歸一化的過程意味著第一步首先計(jì)算向量的長度,然后向量的每個(gè)部分除以此長度.

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



Therefore the normalized vector nv is computed as:
因此,歸一化的向量nv計(jì)算過程如下:
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:
為地形使用面法線最大的問題就是它看起來一塊一塊的, 因?yàn)槊總€(gè)面的亮度都是恒定的,并且每個(gè)方向的面上的亮度都有明顯的區(qū)別。為了看起來更加的光滑,我們必須為每個(gè)頂點(diǎn)計(jì)算法線,而不是每個(gè)面計(jì)算法線。當(dāng)計(jì)算頂點(diǎn)法線的時(shí)候,我們有必要考慮到此頂點(diǎn)共享的所有面,所以我們用方形舉例,每個(gè)頂點(diǎn)(排除掉角落和邊緣的頂點(diǎn))被四個(gè)多邊形共享。這個(gè)頂點(diǎn)的法線就應(yīng)該是所有共享面法線的和在歸一化的結(jié)果。看看下面的圖:



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代表了中心頂點(diǎn)的法線。每個(gè)vij表示每個(gè)共享面的法線。所以例如v12是右下方面的單位長度的法線。

The vertex normal v is computed as the normalised sum of all vij vectors:
頂點(diǎn)法線v被計(jì)算作為所有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個(gè)相臨的頂點(diǎn)。這個(gè)是后來的選項(xiàng)比一般的做法看起來更加光滑。

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
注意當(dāng)計(jì)算法線時(shí)假設(shè)了一個(gè)縮放。如果程序使用了一個(gè)非歸整的縮放,那么法線將不再正確。如果縮放了高度,那么就需要使用函數(shù)terrainScale來調(diào)整。這個(gè)函數(shù)重新計(jì)算了法線。如果網(wǎng)格需要縮放,那么就使用terrainDim函數(shù)來擴(kuò)大地形。

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

<2008年9月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

導(dǎo)航

統(tǒng)計(jì)

公告


Name: Galen
QQ: 88104725

常用鏈接

留言簿(3)

隨筆分類

隨筆檔案

相冊(cè)

My Friend

搜索

最新評(píng)論

閱讀排行榜

評(píng)論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            欧美精品一区二区三区久久久竹菊 | 亚洲精品系列| 免费成人av在线| 亚洲精品视频免费观看| 亚洲第一精品在线| 噜噜噜久久亚洲精品国产品小说| 激情久久久久| 欧美激情视频一区二区三区免费| 久久躁狠狠躁夜夜爽| 亚洲精品日韩久久| 一本久久综合| 国产一区二区久久久| 免费成人性网站| 欧美激情视频给我| 亚洲欧美春色| 久久精品国产99精品国产亚洲性色 | 久久精品一区二区国产| 亚洲第一主播视频| 亚洲精品九九| 国产精品日韩一区二区三区| 久久综合婷婷| 欧美日一区二区三区在线观看国产免| 野花国产精品入口| 亚洲欧美欧美一区二区三区| 狠狠色伊人亚洲综合网站色| 亚洲激情av在线| 国产精品一区二区三区久久久| 久久影视三级福利片| 欧美日本一区| 久久久噜噜噜久噜久久| 欧美精品三级| 久久综合九色欧美综合狠狠| 欧美日韩国产色综合一二三四| 欧美中文字幕精品| 欧美国产欧美综合| 久久一区二区三区国产精品| 欧美日韩中文字幕| 狼人社综合社区| 国产精品久久久久久福利一牛影视| 美女被久久久| 国产精品视频免费观看| 亚洲高清在线观看| 国产一区二区视频在线观看| 99ri日韩精品视频| 亚洲国产精品第一区二区三区 | 欧美激情精品久久久六区热门| 国产精品magnet| 亚洲国产欧美日韩另类综合| 国产主播一区二区三区| 一卡二卡3卡四卡高清精品视频| 在线欧美视频| 久久精品国产免费观看| 小黄鸭精品aⅴ导航网站入口| 欧美华人在线视频| 玖玖玖免费嫩草在线影院一区| 国产精品夜色7777狼人 | 久久狠狠久久综合桃花| 欧美日韩综合视频| 最新高清无码专区| 亚洲区一区二| 欧美1级日本1级| 麻豆乱码国产一区二区三区| 国产精品资源在线观看| 亚洲网址在线| 亚洲制服丝袜在线| 欧美日韩综合在线免费观看| 亚洲久色影视| 中文国产成人精品| 欧美视频一区二区三区| 99国产精品久久久久久久久久| 一本色道久久| 欧美日韩一区二区欧美激情| 日韩午夜在线播放| 亚洲在线一区二区| 国产精品美女一区二区| 亚洲欧美日韩精品综合在线观看| 亚洲欧美在线aaa| 国产精品专区h在线观看| 亚洲欧美日韩中文在线制服| 欧美专区日韩视频| 狠狠色综合网站久久久久久久| 久久久999成人| 麻豆九一精品爱看视频在线观看免费| 伊人成年综合电影网| 麻豆av福利av久久av| 亚洲激情av| 午夜国产不卡在线观看视频| 国产亚洲激情在线| 久久综合色天天久久综合图片| 亚洲国产综合在线看不卡| 亚洲看片一区| 国产伦精品一区二区| 久久婷婷综合激情| 亚洲精品婷婷| 久久精品30| 亚洲毛片av在线| 国产女精品视频网站免费| 久久一区二区三区四区| 99视频一区二区| 久久一区二区三区av| 一区二区三区欧美成人| 国产亚洲欧美一级| 欧美欧美天天天天操| 欧美一区二区视频在线观看2020 | 久久久777| 在线视频中文亚洲| 精品成人久久| 国产精品大片| 免费视频一区二区三区在线观看| 中文av字幕一区| 欧美国产一区二区在线观看 | 91久久线看在观草草青青| 国产精品久久久久久久久婷婷| 老司机一区二区| 香蕉久久一区二区不卡无毒影院 | 香蕉尹人综合在线观看| 亚洲高清av| 国产精品欧美日韩一区二区| 久久影视三级福利片| 亚洲欧美999| 日韩一本二本av| 亚洲高清av在线| 久久精品日韩一区二区三区| 在线亚洲欧美视频| 亚洲欧洲日本在线| 激情91久久| 国产综合亚洲精品一区二| 国产精品v欧美精品v日韩| 欧美大片第1页| 噜噜噜噜噜久久久久久91| 欧美主播一区二区三区| 亚洲午夜精品久久久久久浪潮| 亚洲人成在线影院| 欧美成人a视频| 麻豆久久精品| 老鸭窝亚洲一区二区三区| 欧美亚洲日本国产| 亚洲欧美日韩系列| 亚洲一区二区成人| 亚洲视频在线观看网站| 一本大道久久a久久精品综合| 亚洲精品免费在线播放| 亚洲欧洲一区| 亚洲日本理论电影| 亚洲区免费影片| 亚洲精品护士| 99这里有精品| 国产精品99久久久久久白浆小说| 99国产精品视频免费观看一公开 | 国产精品久久久久久久久动漫| 欧美日韩在线播| 国产精品久久久久久av下载红粉| 国产精品h在线观看| 国产精品网站在线| 国产日韩免费| 激情av一区| 亚洲精品久久嫩草网站秘色| 日韩亚洲欧美在线观看| 中文一区字幕| 欧美在线视频导航| 久久亚洲精品一区二区| 欧美成黄导航| 99视频在线观看一区三区| 亚洲一区在线播放| 欧美在线免费播放| 免费看亚洲片| 欧美特黄一级| 狠狠久久综合婷婷不卡| 亚洲精品激情| 亚洲欧美一区二区原创| 久热精品视频在线免费观看| 亚洲国产精品久久91精品| 一本久道久久综合婷婷鲸鱼| 亚洲女同同性videoxma| 久久亚洲精品一区| 欧美日韩a区| 国产亚洲成精品久久| 亚洲电影观看| 亚洲欧美成人精品| 欧美成人中文| 亚洲愉拍自拍另类高清精品| 久久精品国产99国产精品| 欧美激情在线有限公司| 国产精品香蕉在线观看| 亚洲激情综合| 欧美在线免费视屏| 亚洲激情国产| 欧美一区二区三区四区在线| 欧美激情性爽国产精品17p| 国产欧美三级| 夜夜嗨av一区二区三区网站四季av| 欧美在线视频网站| 亚洲品质自拍| 久热re这里精品视频在线6| 国产精品二区二区三区| 亚洲麻豆一区| 欧美成人有码| 久久精品国产一区二区三区| 国产精品入口夜色视频大尺度| 亚洲理伦在线|