Computer graphics lighting: Difference between revisions

Content deleted Content added
m per WP:HYPHEN, sub-subsection 3, points 4,5,6, replaced: fully- → fully, typo(s) fixed: ’s → 's (3)
m linking
Line 75:
 
=== Gouraud shading ===
[[Gouraud shading]] is a type of interpolated shading where the values inside of each polygon are a blend of its vertex values<ref name=":4" />. Each vertex is given its own normal consisting of the average of the surface normals of the surrounding polygons<ref name=":12" />. The lighting and shading at that vertex is then calculated using the average normal and the lighting model of choice<ref name=":12" />. This process is repeated for all the vertices in the 3D model<ref name=":7">{{Cite web|url=https://www.cs.uic.edu/~jbell/CourseNotes/ComputerGraphics/LightingAndShading.html|title=Intro to Computer Graphics: Lighting and Shading|website=www.cs.uic.edu|access-date=2019-11-05}}</ref>. Next, the shading of the edges between the vertices is calculated by [[Interpolation|interpolating]] between the vertex values<ref name=":7" />. Finally, the shading inside of the polygon is calculated as an interpolation of the surrounding edge values<ref name=":7" />. Gouraud shading generates a smooth lighting effect across the 3D model's surface<ref name=":7" />.
 
=== Phong shading ===
[[Phong shading]], similar to Gouraud shading, is another type of interpolative shading that blends between vertex values to shade polygons<ref name=":13">{{Cite web|url=http://www.hao-li.com/cs420-fs2018/slides/Lecture05.2.pdf|title=Shading in OpenGL|last=Li|first=Hao|date=2018|website=|url-status=live|archive-url=|archive-date=}}</ref>. The key difference between the two is that Phong shading interpolates the vertex normal values over the whole polygon before it calculates its shading<ref name=":12" />. This contrasts with Gouraud shading which interpolates the already shaded vertex values over the whole polygon<ref name=":13" />. Once Phong shading has calculated the normal of a fragment (pixel) inside the polygon, it can then apply a lighting model, shading that fragment<ref name=":12" />. This process is repeated until each polygon of the 3D model is shaded<ref name=":13" />.
 
== Lighting effects ==