Computer graphics lighting: Difference between revisions

Content deleted Content added
Ambient: Adding Lightwarp
Filled in 2 bare reference(s) with reFill 2
Line 4:
 
== Light sources ==
Light sources allow for different ways to introduce light into graphics scenes.<ref name=":727">{{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>
 
=== Point ===
Point sources emit light from a single point in all directions, with the intensity of the light decreasing with distance.<ref name=":737">{{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> An example of a point source is a standalone light bulb.<ref name=":8">{{Cite web|url=http://www.bcchang.com/immersive/ygbasics/lighting.html|title=Lighting in 3D Graphics|website=www.bcchang.com|access-date=2019-11-05}}</ref>
[[File:Real-time Raymarched Terrain.png|thumb|309x309px|A directional light source illuminating a terrain.]]
 
Line 20:
 
=== Lightwarp ===
A lightwarp is a technique of which an object in the geometrical world [[refracts]] light based off the [[direction]] and [[intensity]] of the light. The light is then [[warped]] using an ambient diffuse term with a range of the [[color spectrum]]. The light then may be [[reflectively]] scattered to produce a higher [[depth of field]], and [[refracted]]. The technique is used to produce a [[Style_(visual_arts)#Stylization|unique rendering style]] and can be used limit [[overexposure]] of objects. Games such as [[Team Fortress 2]] use the rendering technique to create a [[cartoon]] [[cel shaded]] stylized look.<ref>[{{Cite web|url=https://hal.inria.fr/inria-00449828|title=Radiance RomainScaling Vergne,for Versatile Surface Enhancement|first1=Romain |last1=Vergne|first2=Romain|last2=Pacanowski, |first3=Pascal |last3=Barla, |first4=Xavier |last4=Granier, |first5=Christophe |last5=Schlick.|date=February Radiance Scaling for Versatile Surface Enhancement. I3D ’10: Proc. symposium on Interactive 3D graphicsand games19, Feb 2010, Boston, United States|publisher=ACM|via=hal. inria.fr|doi=10.1145/1730804.1730827. inria-00449828]}}</ref>
 
== Lighting interactions ==
In computer graphics, light usually consists of multiple components.<ref name=":828">{{Cite web|url=http://www.bcchang.com/immersive/ygbasics/lighting.html|title=Lighting in 3D Graphics|website=www.bcchang.com|access-date=2019-11-05}}</ref> The overall effect of a light source on an object is determined by the combination of the object's interactions with these components.<ref name=":82" /> The three primary lighting components (and subsequent interaction types) are diffuse, ambient, and specular.<ref name=":82" />
[[File:Phong components revised.png|thumb|544x544px|Decomposition of lighting interactions.]]
 
=== Diffuse ===
Diffuse lighting (or [[diffuse reflection]]) is the direct illumination of an object by an even amount of light interacting with a [[Scattering|light-scattering]] surface.<ref name=":838">{{Cite web|url=http://www.bcchang.com/immersive/ygbasics/lighting.html|title=Lighting in 3D Graphics|website=www.bcchang.com|access-date=2019-11-05}}</ref><ref name=":10">{{Cite web|url=http://graphics.cs.cmu.edu/nsp/course/15-462/Spring04/slides/07-lighting.pdf|title=Lighting and Shading|last=Pollard|first=Nancy|date=Spring 2004}}</ref> After light strikes an object, it is reflected as a function of the surface properties of the object as well as the angle of incoming light.<ref name=":10" /> This interaction is the primary contributor to the object's brightness and forms the basis for its color.<ref name=":83" />
 
=== Ambient ===
Line 69:
{{Main|Shading}}
 
Polygonal [[shading]] is part of the [[Rasterisation|rasterization]] process where [[3D computer graphics|3D]] models are drawn as [[2D computer graphics|2D]] pixel images.<ref name=":4">{{Cite web|url=https://cglearn.codelight.eu/pub/computer-graphics/shading-and-lighting|title=Computer Graphics: Shading and Lighting|website=cglearn.codelight.eu|access-date=2019-10-30}}</ref> Shading applies a lighting model, in conjunction with the geometric attributes of the 3D model, to determine how lighting should be represented at each [[Fragment (computer graphics)|fragment]] (or pixel) of the resulting image.<ref name=":4" /> The [[Polygon mesh|polygons]] of the 3D model store the geometric values needed for the shading process.<ref name=":11">{{Cite web|url=http://math.hws.edu/graphicsbook/c4/s1.html|title=Introduction to Computer Graphics, Section 4.1 -- Introduction to Lighting|website=math.hws.edu}}</ref> This information includes [[Vertex (geometry)|vertex]] positional values and [[Normal (geometry)|surface normals]], but can contain optional data, such as [[Texture mapping|texture]] and [[Bump mapping|bump]] maps.<ref>{{Cite web|url=https://www.khronos.org/opengl/wiki/Vertex_Specification#Primitives|title=Vertex Specification - OpenGL Wiki|website=www.khronos.org|access-date=2019-11-06}}</ref>
[[File:Flatshading00.png|alt=|thumb|165x165px|An example of flat shading.]]
[[File:Gouraudshading01.png|alt=|thumb|165x165px|An example of Gouraud shading.]]
Line 78:
 
=== 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 ===