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

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

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:
為地形使用面法線最大的問題就是它看起來一塊一塊的, 因為每個面的亮度都是恒定的,并且每個方向的面上的亮度都有明顯的區別。為了看起來更加的光滑,我們必須為每個頂點計算法線,而不是每個面計算法線。當計算頂點法線的時候,我們有必要考慮到此頂點共享的所有面,所以我們用方形舉例,每個頂點(排除掉角落和邊緣的頂點)被四個多邊形共享。這個頂點的法線就應該是所有共享面法線的和在歸一化的結果??纯聪旅娴膱D:



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 閱讀(2664) 評論(0)  編輯 收藏 引用 所屬分類: 3D渲染技術

<2008年9月>
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>
            激情偷拍久久| 亚洲欧美日韩网| 欧美国产在线视频| 欧美 日韩 国产 一区| 亚洲电影视频在线| 亚洲国产精品热久久| 欧美成人精品在线观看| 91久久精品国产91性色| 亚洲日产国产精品| 国产精品成人在线| 久久精品国产2020观看福利| 久久av二区| 亚洲人成在线观看一区二区| 99re成人精品视频| 国内精品久久久久久久97牛牛| 久久久久久久激情视频| 玖玖国产精品视频| 亚洲午夜在线视频| 久久久青草青青国产亚洲免观| 亚洲片区在线| 亚洲欧美成aⅴ人在线观看| 韩国成人福利片在线播放| 亚洲丶国产丶欧美一区二区三区| 欧美精品在线播放| 久久久久网站| 欧美三级午夜理伦三级中文幕 | 欧美性猛交xxxx免费看久久久| 香蕉成人啪国产精品视频综合网| 久久精品首页| 亚洲欧美999| 免费在线国产精品| 欧美伊久线香蕉线新在线| 欧美91大片| 久久久久久久网| 国产精品igao视频网网址不卡日韩| 久久久久久久波多野高潮日日| 欧美区高清在线| 久久视频在线看| 国产精品久久婷婷六月丁香| 亚洲国产高清在线观看视频| 国产亚洲精品久久久久婷婷瑜伽| 亚洲精品乱码久久久久久日本蜜臀 | 久久久福利视频| 亚洲一区精品在线| 欧美高清视频一区二区三区在线观看| 欧美一区二区女人| 欧美日韩精品免费看| 欧美国产先锋| 狠狠色伊人亚洲综合网站色| 日韩视频在线观看免费| 91久久久久久| 久久综合伊人77777蜜臀| 欧美在线亚洲综合一区| 国产精品每日更新在线播放网址| 亚洲大片免费看| 在线精品一区| 久久久久久久久久久久久女国产乱 | 国产精品久久久久永久免费观看| 亚洲国产色一区| 亚洲黄色毛片| 欧美成人一区二区三区在线观看 | 噜噜爱69成人精品| 国产日韩亚洲欧美综合| 亚洲一区二区三区在线播放| 亚洲夜晚福利在线观看| 国产精品v欧美精品∨日韩| 亚洲人成人77777线观看| 最近中文字幕日韩精品 | 亚洲精品影视| 日韩亚洲国产精品| 欧美理论电影在线播放| 亚洲精品国精品久久99热| 99精品国产在热久久下载| 欧美精品麻豆| 在线视频精品一| 欧美在线三区| 一区二区在线视频| 男女激情久久| 亚洲乱码精品一二三四区日韩在线| 亚洲伦理在线观看| 欧美视频手机在线| 亚洲一区二区三区高清| 久久久久国产精品麻豆ai换脸| 狠狠爱成人网| 欧美 日韩 国产在线| 亚洲人人精品| 久久成人羞羞网站| 在线免费观看日韩欧美| 欧美不卡视频| 亚洲欧美高清| 欧美顶级大胆免费视频| 亚洲视频综合在线| 国产欧美日韩综合| 免费在线一区二区| 亚洲午夜精品久久久久久app| 欧美一区二区三区在线观看视频| 精品91免费| 欧美性一区二区| 久久久久久电影| 99re6热只有精品免费观看 | 亚洲六月丁香色婷婷综合久久| 欧美日一区二区三区在线观看国产免| 亚洲综合精品自拍| 欧美成人免费小视频| 亚洲一区激情| 亚洲电影在线观看| 国产精品都在这里| 女生裸体视频一区二区三区| 在线视频你懂得一区二区三区| 麻豆av一区二区三区| 99re热精品| 亚洲国产成人91精品| 国产精品私房写真福利视频| 久热精品视频| 欧美亚洲网站| 一区二区久久久久| 欧美国产精品| 久久久亚洲精品一区二区三区 | 久久在线视频在线| 亚洲欧美制服另类日韩| 亚洲欧洲一区二区在线播放| 国产欧美一区二区三区沐欲 | 亚洲欧美日韩在线播放| 亚洲精品国产精品国产自| 麻豆精品精华液| 久久精品国产一区二区三| 亚洲一区二区精品在线观看| 亚洲激情视频在线| 狠狠综合久久av一区二区小说| 国产精品高潮呻吟久久av无限| 欧美二区不卡| 葵司免费一区二区三区四区五区| 午夜久久一区| 午夜精品一区二区三区在线 | 久久亚洲视频| 久久久久久久久久久一区| 亚洲欧美成人网| 亚洲女同同性videoxma| 亚洲午夜激情网站| 亚洲桃花岛网站| 一区二区三区久久久| 日韩亚洲精品在线| 一区二区三区高清不卡| 亚洲美女中文字幕| 99视频精品在线| 一本色道久久88精品综合| 亚洲人午夜精品免费| 91久久精品www人人做人人爽 | 国产精品毛片va一区二区三区| 欧美日一区二区在线观看 | 欧美一区二区三区久久精品茉莉花| 99riav国产精品| 亚洲视频在线观看| 亚洲伊人伊色伊影伊综合网| 亚洲在线免费视频| 欧美专区福利在线| 裸体歌舞表演一区二区| 欧美顶级大胆免费视频| 欧美日韩亚洲系列| 国产欧美一区二区三区视频| 国内欧美视频一区二区| 伊人久久大香线| 亚洲国产欧美日韩精品| 亚洲欧洲精品一区二区三区波多野1战4 | 欧美欧美天天天天操| 欧美午夜免费影院| 国产欧美日韩在线观看| 禁断一区二区三区在线| 亚洲精品社区| 欧美一区二区三区免费看| 奶水喷射视频一区| 日韩视频在线免费观看| 亚洲一区二区视频在线观看| 久久久国产午夜精品| 欧美理论电影在线播放| 国产麻豆日韩| 亚洲精品国产品国语在线app| 亚洲欧美制服中文字幕| 免费一级欧美在线大片| 一区二区欧美精品| 久久亚洲免费| 国产精品久久毛片a| 亚洲国产精品一区二区第一页| 中文国产一区| 欧美 日韩 国产一区二区在线视频| 亚洲精品久久久久久久久久久久| 亚洲女优在线| 欧美激情一区二区三区不卡| 国产美女一区| 一区二区三区久久| 久久综合久久美利坚合众国| 亚洲精品人人| 久久综合福利| 国产视频在线观看一区二区三区 | 国产精品青草久久久久福利99| 永久久久久久| 欧美在线中文字幕| 99国产一区| 欧美韩日高清| 在线日韩欧美视频|