GAMES101 08 SHADING 2
08 Shading 着色
Blinn-Phong Reflection Model
- Specular highlights Term 高光
- Intensity depends on view direction
- Bright near mirror reflection direction
- V close to mirror direction <–> half vector near normal(h)
- Measure “near” by dot productof unit vectors
- Formula: $L_s = k_s(I/r^2)max(0,<n,h>)^p$
- What is the p in $max(0,<n,h>)^p$ for? Make it real:
- If $\alpha $ is too big, $<n,h>^p$ is small.
- What is the p in $max(0,<n,h>)^p$ for? Make it real:
- Intensity depends on view direction
- Ambient Term 环境光照
- Assumption: Shading that does not depend on anything
- Add constant color to account for disregarded
illumination and fill in black shadows - This is approximate / fake !
- Add constant color to account for disregarded
- Formula: $L_a=k_aI_a$
- Assumption: Shading that does not depend on anything
- Blinn-Phong Reflection Model:
- $L=L_a+L_d+L_s$
Shading Frequencies 着色频率
- Shade each triangle (flat shading)
- Flat shading
- Triangle face is flat — one normal vector
- Not good for smooth surfaces
- Flat shading
- Shade each vertex (Gouraud shading)
- Gouraud shading
- Interpolate colors from vertices across triangle
- Each vertex has a normal vector (how?)
- Gouraud shading
- Shade each pixel (Phong shading)
- Phong shading
- Interpolate normal vectors across each triangle
- Compute full shading model at each pixel
- Not the Blinn-Phong Reflectance Model
- Phong shading
- Defining Per-vertex Normal vectors 怎么定义逐顶点法线
- Simple scheme: average surrounding face normals
- Formula: 法向量加权平均 $ n_v=\frac{s_i\times \sum_iN_i}{||\sum_iN_i||}$
- Defining Per-Pixel Normal vectors 怎么定义逐像素法线
- Barycentric interpolation (introducing soon) of vertex normals
Graphics (Real-time Rendering) Pipeline 实时渲染管线
What is it?
graph LR |
Shader Programs, How it works for a pixel/fragment/vertex
Texture Mapping 纹理映射
- Surface are 2D, texture is a graph
- 每个模型上的点对应纹理上的坐标(u,v),一般都映射成0~1
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Chuan 川 Charles!
评论