人机接口与图形学(双语)08-Shading

上传人:lizhe****0001 文档编号:57916440 上传时间:2018-10-25 格式:PPT 页数:30 大小:837KB
返回 下载 相关 举报
人机接口与图形学(双语)08-Shading_第1页
第1页 / 共30页
人机接口与图形学(双语)08-Shading_第2页
第2页 / 共30页
人机接口与图形学(双语)08-Shading_第3页
第3页 / 共30页
人机接口与图形学(双语)08-Shading_第4页
第4页 / 共30页
人机接口与图形学(双语)08-Shading_第5页
第5页 / 共30页
点击查看更多>>
资源描述

《人机接口与图形学(双语)08-Shading》由会员分享,可在线阅读,更多相关《人机接口与图形学(双语)08-Shading(30页珍藏版)》请在金锄头文库上搜索。

1、Shading,Department of CS & E, East China University of Science & Technology,Lighting Review,Lighting Models Ambient Normals dont matter Lambert/Diffuse Angle between surface normal and light Phong/Specular Surface normal, light, and viewpoint,Applying Illumination,We now have an illumination model f

2、or a point on a surface Assuming that our surface is defined as a mesh of polygonal facets, which points should we use? Keep in mind: Its a fairly expensive calculation Several possible answers, each with different implications for the visual quality of the result,Applying Illumination,With polygona

3、l/triangular models: Each facet has a constant surface normal If the light is directional, the diffuse reflectance is constant across the facet. Why?,Flat Shading,The simplest approach, flat shading, calculates illumination at a single point for each polygon:If an object really is faceted, is this a

4、ccurate?,Is flat shading realistic for faceted object?,No: For point sources, the direction to light varies across the facet,Flat Shading,We can refine it a bit by evaluating the Phong lighting model at each pixel of each polygon, but the result is still clearly faceted: To get smoother-looking surf

5、aces we introduce vertex normals at each vertex Usually different from facet normal Used only for shading Think of as a better approximation of the real surface that the polygons approximate,Vertex Normals,Vertex normals may be Provided with the model Computed from first principles Approximated by a

6、veraging the normals of the facets that share the vertex,Gouraud Shading,This is the most common approach Perform Phong lighting at the vertices Linearly interpolate the resulting colors over faces Along edges Along scanlines,C1,C2,C3,c1 + t1(c2-c1),c1 + t2(c3-c1),c1 + t1(c2-c1) + t3(c1 + t2(c3-c1)-

7、 c1 - t1(c2-c1),This is what OpenGL does Does this eliminate the facets?,Gouraud Shading,Artifacts Often appears dull, chalky Lacks accurate specular component If included, will be averaged over entire polygon,Gouraud Shading,C1,C2,C3,Artifacts Mach Banding Artifact at discontinuities in intensity o

8、r intensity slope,C4,Discontinuity in rate of color change occurs here,Phong Shading,Phong shading is not the same as Phong lighting, though they are sometimes mixed up Phong lighting: the empirical model weve been discussing to calculate illumination at a point on a surface Phong shading: linearly

9、interpolating the surface normal across the facet, applying the Phong lighting model at every pixel Same input as Gouraud shading Usually very smooth-looking results: But, considerably more expensive,Phong Shading,Linearly interpolate the vertex normals Compute lighting equations at each pixel Can u

10、se specular component,N1,N2,N3,N4,Remember: Normals used in diffuse and specular termsDiscontinuity in normals rate of change is harder to detect,Shortcomings of Shading,Polygonal silhouettes remain,Gouraud Phong,Perspective Distortion,i,u,u,u,u,u,u,i,i,i,i,i,Z into the scene,Image plane,Notice that

11、 linear interpolation in screen space does not align with linear interpolation in world space,Break up large polygons with many smaller ones,Perspective Distortion,Notice that linear interpolation in screen space does not align with linear interpolation in world space,Z into the scene,Image plane,Br

12、eak up large polygons with many smaller ones,Interpolation dependent on polygon orientation,Rotate -90o and color same point,Problems at Shared Vertices,B,A,C,Vertex B is shared by the two rectangles on the right, but not by the one on the left,E,D,F,H,G,The first portion of the scanline is interpol

13、ated between DE and AC The second portion of the scanline is interpolated between BC and GH A large discontinuity could arise,Bad Vertex Averaging,Shading Models (Direct lighting),Flat Shading Compute Phong lighting once for entire polygon Gouraud Shading Compute Phong lighting at the vertices and i

14、nterpolate lighting values across polygon Phong Shading Compute averaged vertex normals Interpolate normals across polygon and perform Phong lighting across polygon,Global Illumination,Weve glossed over how light really works And we will continue to do so One step betterGlobal Illumination The notio

15、n that a point is illuminated by more than light from local lights; it is illuminated by all the emitters and reflectors in the global scene,The Rendering Equation,Jim Kajiya (Current head of Microsoft Research) developed this in 1986I(x, x) is the total intensity from point x to x g(x, x) = 0 when

16、x/x are occluded and 1/d2 otherwise (d = distance between x and x) e(x, x) is the intensity emitted by x to x r(x, x,x) is the intensity of light reflected from x to x through x S is all points on all surfaces,The Rendering Equation,The light that hits x from x is the direct illumination from x and all the light reflected by x from all x To implement: Must handle recursion effectively Must support diffuse and specular light Must model object shadowing,

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 高等教育 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号