码迷,mamicode.com
首页 > 其他好文 > 详细

Phong Shading

时间:2014-08-03 12:43:25      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:style   http   color   os   strong   io   问题   cti   

Phong Shading

  The most serious problem with Gouraud shading occurs when specular highlights are found in the middle of a large polygon. Since these specular highlights are absent from the polygon‘s vertices and Gouraud shading interpolates based on the vertex colors, the specular highlight will be missing from the polygon‘s interior. This problem is fixed by Phong shading.

  相比Gouraud,Phong Shading能更好地解决镜面照问题。

  Unlike Gouraud shading, which interpolates colors across polygons, in Phong shading a normal vector is linearly interpolated across the surface of the polygon from the polygon‘s vertex normals. The surface normal is interpolated and normalized at each pixel and then used in a reflection model, e.g. the Phong reflection model, to obtain the final pixel color. Phong shading is more computationally expensive than Gouraud shading since the reflection model must be computed at each pixel instead of at each vertex.

  顶点色=GlobalAmbient*kAmbientColor + LiVec*Normal*kDiffuseColor + RefVec*ViewVec*kSpecularColor

Blinn-Phong

  相比于Phong,镜面光照公式改为下面这个:

  MidVec*Normal*kSpecularColor。

  MidVec指LiVec和ViewVec的中间向量。Blinn-Phong比Phong略快。

参考:

1、http://en.wikipedia.org/wiki/Phong_shading

2、http://en.wikipedia.org/wiki/Phong_reflection_model

3、http://en.wikipedia.org/wiki/Blinn%E2%80%93Phong_shading_model

Phong Shading,布布扣,bubuko.com

Phong Shading

标签:style   http   color   os   strong   io   问题   cti   

原文地址:http://www.cnblogs.com/tekkaman/p/3888188.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!