@[TOC](07Shading 1 (illumination,Shading and Graphics Pipeline))
一、Shading 1 (illumination,Shading and Graphics Pipeline)
Painter’s Algorithm 画家算法
研究着色的堆叠顺序,从最远的面开始画,深度比较难计算
Z-Buffer
This is the algorithm that eventually won
Idea:
Store current min.z-value for each sample (pixel)
Needs an additional buffer for depth values
- frame buffer stores color values
- depth buffer (z-buffer) stores depth
IMPORTANT: For simplicity we suppose z is always positive(z表示深度)
(smaller z -> closer, larger z -> further)
Complexity
.O(n) for n triangles (assuming constant coverage)
深度缓存和顺序没有关系。两个浮点型极难相同,默认深度不会相同。
Shading着色
对不同材质物体应用不同颜色
A Simple Shading Model(Blinn-Phong Reflectance Model)
高光,漫反射,间接光照
Compute light reflected toward camera at a specific shading point
lnputs:
- Viewer direction, v
- Surface normal, n
- Light direction,l(for each of many lights)
- Surface parameters(color, shininess,…)
No shadows will be generated! (shading = shadow)
Diffuse Reflection 漫反射
接触面积不同,吸收能量不同,亮度不同。
Light Failoff
经验模型,不是完全物理真实的。