顏色模型、圖像基本知識、Phong光照模型
1.顏色模型
1.1 RGB Color Space
The reason why we pick red, green, and blue?
- essentially because of the structure of our visual system
- Our visual system is sensitive to those three colors
缺陷
Unfortunately ,Some colors cannot be written as combinations of RGB triples, because some parts of the red curve is negative
1.2 CMY
Cyan(青), magenta(品紅) , and yellow
It’s called subtractive primaries(減色系統)
1.3 HSV Color space
RGB 不是很直觀,HSV比較易於理解
- Hue (色調) means the base color, which is a main factor indicates difference between colors.
- Saturation(飽和度) is for purity of color (decrease = adding white)
- Value of brightness(亮度) Luminance of lights,(decrease = adding black)
2.圖像基本知識
2.1 Image & Pixel
- Image could be treated as a 2-dimensional
discrete function f(x,y) - each discrete grid is called pixel
2.2 Triangle Mesh
Contains a list of faces F, and a list of vertices V
- A list of faces F = (f1,f2,…,fn), Each face is a triangle
- A list of vertices V = (v1,v2,…,vn), Each face in F is a list of indices in V
e.g.
f1–(v1,v2,v3 ), f2 --(v4,v5,v6 ),
f3–(v7,v8,v9 ), …
2.3 Normal
2.3.1 Face Normal
Each face has a normal direction to define the orientation
2.3.2 Vertex Normal
Each vertex is shared by m faces
計算方法
- 直接平均:Compute normal by Interpolation Nv= (Nf1+Nf2 … + Nfm)/m
- 面積加權平均:or by area based Interpolation Nv= (|F1|*Nf1+|F2|*Nf2 … + |Fm|*Nfm)/(|F1|+|F2|+…|Fm|)
- 角度加權平均:or by angle based Interpolation Nv= (|A1|*Nf1+|A2|*Nf2 … + |Am|*Nfm)/(|A1|+|A2|+…|Am|)
3.光照模型
Local Lighting
- Concerned with how objects are directly illuminated by light sources
Global Lighting
- Includes shadow effects
- Includes lighting effects from locations other than light sources, such as reflections, refractions
3.1 History of Lighting
- In 1967, Wylie: first added lighting effects into rendering
- Intensity is inverse of the distance to the light
- In 1970, Bouknight: introduced the first lighting
model:- Lambert diffuse reflection(漫發射) + ambient (No specular lighting)(環境光)
- In 1971, Gourand: gourand shading
- Lambert diffuse + Bicentric interpolation
- In 1975, Phong: proposed extended the model by further considering specular:
- Diffuse(漫發射) + ambient(環境光,模擬全局光照效果) + specular(高光)
- The most influenced lighting model
3.2折射向量的計算
-
: 入射角(單位向量)
-
= Vector(0, 0, 1) //法向量
-
: 介質密度比(空氣/水)
3.3 Measure of light
- Solid Angle(立體角) :
- How big an object appears to an observer at point P
- Max Vaule: 4π
- Irradiance (輝度) E
- E defined as: light energy per unit time arrived at per unit area (ds)
- Radiance (發光強度) I
- I defined as: irradiance per unit solid angle
3.4 Phong Lighting Model
3.4.1 Diffuse reflection
- 漫反射光的傳播是各向同性的(isotropic)
- The intensity of diffuse reflection is defined as:
- is the diffuse reflection constant
- implies the base color of the model
3.4.2 Specular reflection
- The intensity of specular reflection is defined as:
- is the specular reflection constant ;
- and n is the shininess constant, which decides how shiny the surface is. n越大,高光越集中
3.4.3 Ambient reflection
- To approximate global illuminations (including indirect lighting, indirect reflection…)
- The intensity of ambient reflection is defined as:
- is the ambient reflection constant
3.4.4 最終結果
The reflection intensity is the sum of diffuse reflection, specular reflection and ambient reflection:
3.5 Blinn-Phong Lighting Model