Computer graphics lighting: Difference between revisions

Content deleted Content added
References follow punctuation. Please see MOS.
Monkbot (talk | contribs)
m Task 18 (cosmetic): eval 26 templates: del empty params (38×); del |url-status= (8×);
Line 24:
 
=== 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=":83">{{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|website=|url-status=live|archive-url=|archive-date=|access-date=}}</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 33:
 
== Illumination models ==
Lighting models are used to replicate lighting effects in [[Rendering (computer graphics)|rendered]] environments where light is approximated based on the physics of light.<ref name=":1">{{Cite web|url=https://learnopengl.com/Lighting/Basic-Lighting|title=LearnOpenGL - Basic Lighting|website=learnopengl.com|access-date=2019-11-08}}</ref> Without lighting models, replicating lighting effects as they occur in the natural world would require more processing power than is practical for computer graphics.<ref name=":1" /> This lighting, or illumination model's purpose is to compute the color of every pixel or the amount of light reflected for different surfaces in the scene.<ref>{{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-08}}</ref> There are two main illumination models, object oriented lighting and global illumination.<ref name=":2">{{Cite web|url=https://www.cc.gatech.edu/classes/AY2003/cs4451a_fall/global-illumination.pdf|title=Global Illumination|last=|first=|date=2002|website=Georgia Tech Classes|url-status=live|archive-url=|archive-date=|access-date=}}</ref> They differ in that object oriented lighting considers each object individually, whereas global illumination maps how light interacts between objects.<ref name=":2" /> Currently, researchers are developing global illumination techniques to more accurately replicate how light interacts with its environment.<ref name=":2" />
 
=== Object oriented lighting ===
Object oriented lighting, also known as local illumination, is defined by mapping a single light source to a single object.<ref name=":3">{{Cite web|url=http://www.cs.kent.edu/~farrell/cg01/lectures/color/illum_local.html|title=Local Illumination|last=Farrell|date=|website=Kent University|url-status=live|archive-url=|archive-date=|access-date=}}</ref> This technique is fast to compute, but often is an incomplete approximation of how light would behave in the scene in reality.<ref name=":3" /> It is often approximated by summing a combination of specular, diffuse, and ambient light of a specific object.<ref name=":1" /> The two predominant local illumination models are the Phong and the Blinn-Phong illumination models.<ref name=":4" />
 
==== Phong illumination model ====
Line 66:
{{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 Lighting|last=|first=|date=|website=|url-status=live|archive-url=|archive-date=|access-date=}}</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 72:
 
=== Flat shading ===
Flat shading is a simple shading model with a uniform application of lighting and color per polygon.<ref name=":12">{{Cite web|url=https://www.cs.brandeis.edu/~cs155/Lecture_16.pdf|title=Illumination Models and Shading|last=Foley|date=|website=|url-status=live|archive-url=|archive-date=|access-date=}}</ref> The color and normal of one vertex is used to calculate the shading of the entire polygon.<ref name=":4" /> Flat shading is inexpensive, as lighting for each polygon only needs to be calculated once per render.<ref name=":12" />
 
=== Gouraud shading ===
Line 78:
 
=== 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 ==
Line 89:
=== Reflection mapping ===
{{Main articles|Reflection mapping}}
Reflection mapping (also known as environment mapping) is a technique which uses 2D environment maps to create the effect of [[Reflectance|reflectivity]] without using ray tracing.<ref name=":5">{{Cite web|url=https://cglearn.codelight.eu/pub/computer-graphics/environment-mapping|title=Computer Graphics: Environment Mapping|website=cglearn.codelight.eu|access-date=2019-11-01}}</ref> Since the appearances of reflective objects depend on the relative positions of the viewers, the objects, and the surrounding environments, graphics algorithms produce reflection vectors to determine how to color the objects based on these elements.<ref>{{Cite web|url=http://web.cse.ohio-state.edu/~wang.3602/courses/cse5542-2013-spring/17-env.pdf|title=Environment Mapping|last=Shen|first=Han-Wei|date=|website=|url-status=live|archive-url=|archive-date=|access-date=}}</ref> Using 2D environment maps rather than fully rendered, 3D objects to represent surroundings, reflections on objects can be determined using simple, computationally inexpensive algorithms.<ref name=":5" />
 
=== Particle systems ===
{{Main articles|Particle system}}
Particle systems use collections of small [[Particle|particles]] to model chaotic, high-complexity events, such as fire, moving liquids, explosions, and moving hair.<ref name=":6">{{Cite web|url=http://web.engr.oregonstate.edu/~mjb/cs491/Handouts/particlesystems.2pp.pdf|title=Particle Systems|last=Bailey|first=Mike|date=|website=|url-status=live|archive-url=|archive-date=|access-date=}}</ref> Particles which make up the complex animation are distributed by an emitter, which gives each particle its properties, such as speed, lifespan, and color.<ref name=":6" /> Over time, these particles may move, change color, or vary other properties, depending on the effect.<ref name=":6" /> Typically, particle systems incorporate [[randomness]], such as in the initial properties the emitter gives each particle, to make the effect realistic and non-uniform.<ref name=":6" /><ref>{{Cite web|url=https://web.cs.wpi.edu/~matt/courses/cs563/talks/psys.html|title=Particle Systems|website=web.cs.wpi.edu|access-date=2019-11-01}}</ref>
 
== See also ==