Jump to content

User:Tristanelma/sandbox

From Wikipedia, the free encyclopedia

<TITLE>: Computer graphics lighting

Computer graphics lighting is the collection of techniques used to simulate light in computer graphics scenes. While lighting techniques offer flexibility in the level of detail and functionality available, they also operate at different levels of computational demand and complexity. Graphics artists can choose from a variety of light sources, models, shading techniques, and effects to suit the needs of each application.

Light sources

[edit]

Light sources allow for different ways to introduce light into scenes[1].

Point

[edit]

Point sources emit light from a single point in all directions, with the intensity of the light decreasing with distance[1]. An example of a point source is a standalone light bulb[2].

Directional

[edit]

A directional source (or distant source) uniformly lights a scene from one direction[2]. Unlike a point source, the intensity of light produced by a directional source does not change with distance, as the directional source is treated as though it is infinitely far away from the scene[2]. An example of a directional source is sunlight[3].

Spotlight

[edit]

A spotlight produces a directed cone of light[1]. The closer an object is to the spotlight source and to the center of the cone, the more intense the light[1]. An example of a spotlight is a flashlight[3].

Ambient

[edit]

Ambient light sources illuminate objects even when no other light source is present[1]. The intensity of ambient light is independent of direction, distance, and other objects, meaning the effect is completely uniform throughout the scene[1]. This source ensures that objects are visible even in complete darkness[3].

Lighting interactions

[edit]

Light sources emit light that consists of multiple components[2]. The overall effect of a light source on an object is determined by the combination of the object's interactions with these components[2]. The three primary lighting components (and subsequent interaction types) are diffuse, ambient, and specular[2].

Diffuse

[edit]

Diffuse lighting (or diffuse reflection) is the direct illumination of an object by an even amount of light interacting with a light-scattering surface[2][4]. 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[4]. This interaction is the primary contributor to the object’s brightness and forms the basis for its color[2].

Ambient

[edit]

As ambient light is directionless, it interacts uniformly across all surfaces, with its intensity determined by the strength of the ambient light sources and the properties of objects' surface materials, namely their ambient reflection coefficients[2][4].

Specular

[edit]

The specular lighting component gives objects shine and highlights[2]. This is distinct from mirror effects because other objects in the environment are not visible in these reflections[4]. Instead, specular lighting creates bright spots on objects based on the intensity of the specular lighting component and the specular reflection coefficient of the surface[4].

Lighting models

[edit]

Lighting models are used to replicate lighting effects in rendered environments where light is approximated based on the physics of light. Without lighting models, replicating lighting effects as they occur in the natural world would require more processing power than is practical for computer graphics[5]. 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[6]. There are two main illumination models, object oriented lighting and global illumination[7]. They differ when it comes to how objects are approached in a scene. Object oriented lighting considers each object individually compared to global illumination which maps how light interacts between objects[7]. Currently, global illumination still has research being done to more accurately replicate how light interacts with its environment[7].

Object oriented lighting

[edit]

Object oriented lighting, also known as local illumination, is defined by mapping a single light source to a single object[8]. This technique is fast to compute, but often is an incomplete approximation of how light would behave in the scene in reality[8]. It is often approximated by summing a combination of specular, diffuse, and ambient light of a specific object[5]. The two predominant local illumination models are the Phong and the Blinn-Phong illumination models[9]. Both of these models utilize specular light to create a more realistic looking lighting effect[9]

Phong illumination model

[edit]

Main article: Phong reflection model

One of the most common shading models is the Phong model[5]. The Phong model assumes that the intensity of each pixel is the sum of the intensity due to diffuse, specular, and ambient lighting[8]. This model takes into account the location of a viewer to determine specular light using the angle of light reflecting off an object[9]. The cosine of the angle is taken and raised to a power decided by the designer. By raising cosine to a power, the designer can decide how wide a highlight they want on an object; because of this, the power is called the shininess value[9][8]. The shininess value is determined by the roughness of the surface where a mirror would have a value of infinity and the roughest surface might have a value of 1[8]. This model creates a more realistic looking white highlight based on the perspective of the viewer.

Blinn-Phong illumination model

[edit]

Main article: Blinn–Phong reflection model

The Blinn-Phong illumination model is similar to the phong model as it uses specular light to create a highlight on an object based on its shininess[10]. The Blinn-Phong differs from the Phong illumination model, as the Blinn-Phong model uses the vector halfway between the light source and the viewer and is normal to the surface of the object[5]. This model is used in order to have an accurate specular lighting and reduce computation time. The process takes less time because finding the reflected light vector’s direction is a more involved computation than calculating the halfway normal vector[10]. While, this is similar to the phong model, the models do not always produce the same results and the specular reflection exponent or shininess might need modification in order to produce a similar specular reflection[11].

Global illumination

[edit]

Global illumination differs from local illumination because it calculates light as it would travel throughout the entire scene[7]. This lighting is based more heavily in physics and optics, with light rays scattering and reflecting as well as bouncing an infinite amount of times in the scene[12]. There is still active research being done on global illumination as it requires more computation power than local illumination[13].

Raytracing

[edit]

Main article: Ray tracing (graphics)

Light sources emit rays that interacting with various surfaces, either by being absorbed, reflected, or refracted. An observer in the scene would see the result of any light source that reaches its eye. Any ray that does not reach the observer goes unnoticed. It is possible to simulate this by having all of the light sources emit rays and then compute how of each of them interact with all of the objects in the scene. Anything that reaches the observer would then be rendered. However, this process is inefficient as most of the light rays would not reach the observer and would waste processing time. Ray tracing solves this problem by reversing the process: sending view rays from the observer and calculating how they interact until they reach a light source. Although this way is makes more effective use of processing time, ray tracing is still expensive to run, but the end result is a very realistic image[14].

Radiosity

[edit]

Main article: Radiosity (computer graphics)

Radiosity takes into account the energy given off by surrounding objects and the energy it has, in addition to the energy given off by the light source. Unlike ray tracing, which is dependent on the position and orientation of the observer, radiosity lighting is independent of view position. Radiosity requires even more computation power than ray tracing, but can be more useful for scenes with static lighting because it would only have to be computed once. The surfaces of a scene can be divided into a large amount of patches[14].  Because each patch radiates some light and affects the other patches, a large set of equations needs to be solved simultaneously in order to get the final radiosity of each patch.

Photon mapping

[edit]

Main article: Photon mapping

Photon mapping was created as a two pass global illumination algorithm to be more efficient than raytracing[15]. It is the basic principle of tracking photons released from a light source through a series of stages.[15] The first pass includes the photons being released from a light source and bouncing off their first object; this map of where are the photons are located is then recorded[13].  The photon map contains both the position and direction of each photon which either bounce or are absorbed[16]. The second pass happens with rendering where the reflected is calculated for different surfaces[17]. In this process, the photon map is decoupled from the geometry of the scene meaning rendering can be calculated separately[13]. It is a useful technique because it can simulate caustics and pre-processing steps do not need to be repeated if the view or objects change.

Polygonal shading

[edit]

Main article: Shading

Polygonal shading is part of the rasterization process where 3D models are drawn as 2D pixel images[9]. 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 (or pixel) of the resulting image[9]. The polygons of the 3D model store the geometric values needed for the shading process[18]. This information includes vertex positional values and surface normals, but can contain optional data, such as texture and bump maps[19].

An example of flat shading.
An example of Gouraud shading.
An example of Phong shading.

Flat shading

[edit]

Flat shading is a simple shading model with a uniform application of lighting and color per polygon[20]. The color and normal of one vertex is used to calculate the shading of the entire polygon[9]. Flat shading is inexpensive as lighting for each polygon only needs to be calculated once per render[20].

Gouraud shading

[edit]

Gouraud shading is a type of interpolated shading where the values inside of each polygon are a blend of its vertex values[9]. Each vertex is given its own normal comprised of the average surface normals of the surrounding polygons[20]. The lighting and shading at that vertex is then calculated using the average normal and the lighting model of choice[20]. This process if repeated for all the vertices in the 3D model[1]. Next, the shading of the edges between the vertices is calculated by interpolating between the vertex values[1]. Finally, the shading inside of the polygon is calculated as an interpolation of the surrounding edge values[1]. Gouraud shading generates a smooth lighting effect across the 3D models surface[1].

Phong shading

[edit]

Phong shading, similar to Gouraud shading, is another type of interpolative shading that blends between vertex values to shade polygons[12]. The key difference between the two is that Phong shading interpolates the vertex normal values over the whole polygon before it calculates its shading[20]. This contrasts with Gouraud shading which interpolates the already shaded vertex values over the whole polygon[12]. Once Phong shading has calculated the normal of a fragment (pixel) inside the polygon, it can then apply a lighting model, thus shading that point[20]. This process is repeated until each polygon of the 3D model is shaded[12].

Lighting effects

[edit]
A reflective material demonstrating caustics.

Caustics

[edit]

Main article: Caustics

Caustics are a lighting effect of reflected and refracted light moving through a medium[21]. They appear as ribbons of concentrated light and are often seen when looking at bodies of water or glass[22]. Caustics can be implemented in 3D graphics by blending a caustic texture map with the texture map of the affected objects[22]. The caustics texture can either be a static image that is animated to mimic the effects of caustics, or a Real-time calculation of caustics onto a blank image[22]. The latter is more complicated and requires backwards ray tracing to simulate photons moving through the environment of the 3D render[21]. In a photon mapping illumination model, Monte Carlo sampling is used in conjunction with the ray tracing to compute the intensity of light caused by the caustics[21].

Reflection mapping

[edit]

Main article: Reflection mapping

Reflection mapping (also known as environment mapping) is a technique which uses these two-dimensional environment maps to create the effect of reflectivity without using ray tracing[23]. The appearance of a reflective object depends on the relative positions of the viewer, the object, and the environment. With each of these elements, a graphics algorithm produces reflection vectors to determine how to color the object[24]. Using simple, two-dimensional representations of the environment (environment maps) rather than fully-rendered, three-dimensional objects, reflections on an object can be determined using simple, computationally inexpensive algorithms[23].

Particle systems

[edit]

Main article: Particle system

Particle systems use collections of small particles to model chaotic, high-complexity events, such as fire, moving liquids, explosions, and hair[25]. Particles are distributed by an emitter, which gives each particle its properties, such as speed, lifespan, and color[25]. Over time, these particles may move, change color, or vary other properties, depending on the effect[25]. Typically, the particle system incorporates randomness, such as in the initial properties the emitter gives each particle, to make the effect realistic and non-uniform[25][26].


Article sources:

  • Phong based lighting[5]
  • Modeling the Interaction of Light Between Diffuse Surfaces (This is now called Radiosity)[27]
  • Global Illumination using Photon Maps. (UCSD)[16]
  • Directional Reflectance and Emissivity of an Opaque Surface[28]
  • A Two-pass Solution to the Rendering Equation: A Synthesis of Ray Tracing and Radiosity Methods[29]
  • Lighting and Shading[6]
  • Photon Mapping[17]
  • Global Illumination[13]
  • Computability and Complexity of Ray Tracing[30]
  • What is Ray Tracing?[31]
  • Shading and Lighting[9]
  • The Story of Reflection Mapping[32]
  • Rendering Water Caustics[21]
  • Illumination Models and Shading[20]
  • Practical Particle Lighting[33]
  • Introduction to Lighting[18]
  • Global Illumination[7]
  • Local Illumination[8]
  1. ^ a b c d e f g h i j "Intro to Computer Graphics: Lighting and Shading". www.cs.uic.edu. Retrieved 2019-11-05.
  2. ^ a b c d e f g h i j "Lighting in 3D Graphics". www.bcchang.com. Retrieved 2019-11-05.
  3. ^ a b c "Understanding Different Light Types". www.pluralsight.com. Retrieved 2019-11-05.
  4. ^ a b c d e Pollard, Nancy (Spring 2004). "Lighting and Shading" (PDF).{{cite web}}: CS1 maint: url-status (link)
  5. ^ a b c d e "LearnOpenGL - Basic Lighting". learnopengl.com. Retrieved 2019-10-28.
  6. ^ a b "Intro to Computer Graphics: Lighting and Shading". www.cs.uic.edu. Retrieved 2019-10-30.
  7. ^ a b c d e "Global Illumination" (PDF).{{cite web}}: CS1 maint: url-status (link)
  8. ^ a b c d e f "CSC 418/2504: Local Illumination Models". www.cs.kent.edu. Retrieved 2019-11-01.
  9. ^ a b c d e f g h i "Computer Graphics: Shading and Lighting". cglearn.codelight.eu. Retrieved 2019-10-30.
  10. ^ a b Blinn, James (July 1977). "Models of Light Reflection for Computer Synthesized Pictures" (PDF). {{cite journal}}: Cite journal requires |journal= (help)
  11. ^ Jacob's University, "Blinn-Phong Reflection Model", 2010.
  12. ^ a b c d Li, Hao (2018). "Shading in OpenGL" (PDF).{{cite web}}: CS1 maint: url-status (link)
  13. ^ a b c d Li, Hao (Fall 2018). "Global Illumination" (PDF).{{cite web}}: CS1 maint: url-status (link)
  14. ^ a b Greenberg, Donald P. (1989-04-14). "Light Reflection Models for Computer Graphics". Science. 244 (4901): 166–173. doi:10.1126/science.244.4901.166. ISSN 0036-8075. PMID 17835348.
  15. ^ a b Wann Jensen, Henrik (1996). "Global Illumination using Photon Maps" (PDF). Rendering Techniques ’96: 21–30.
  16. ^ a b "Global Illumination Using Photon Maps" (PDF).{{cite web}}: CS1 maint: url-status (link)
  17. ^ a b "Photon Mapping - Zack Waters". web.cs.wpi.edu. Retrieved 2019-10-28.
  18. ^ a b "Introduction to Lighting".{{cite web}}: CS1 maint: url-status (link)
  19. ^ "Vertex Specification - OpenGL Wiki". www.khronos.org. Retrieved 2019-11-06.
  20. ^ a b c d e f g Foley. "Illumination Models and Shading" (PDF).{{cite web}}: CS1 maint: url-status (link)
  21. ^ a b c d "GPU Gems". NVIDIA Developer. Retrieved 2019-10-30.
  22. ^ a b c "Caustics water texturing using Unity 3D". www.dualheights.se. Retrieved 2019-11-06.
  23. ^ a b "Computer Graphics: Environment Mapping". cglearn.codelight.eu. Retrieved 2019-11-01.
  24. ^ Shen, Han-Wei. "Environment Mapping" (PDF).{{cite web}}: CS1 maint: url-status (link)
  25. ^ a b c d Bailey, Mike. "Particle Systems" (PDF).{{cite web}}: CS1 maint: url-status (link)
  26. ^ "Particle Systems". web.cs.wpi.edu. Retrieved 2019-11-01.
  27. ^ Goral, Cindy (July 1984). "Modeling the Interaction of Light Between Diffuse Surfaces" (PDF). Computer Graphics. 18.
  28. ^ Nicodemus, Fred (1965). "Directional Reflectance and Emissivity of an Opaque Surface". Applied Optics. 4 – via OSA Publishing.
  29. ^ Wallace, John R.; Cohen, Michael F.; Greenberg, Donald P. (1987). "A Two-pass Solution to the Rendering Equation: A Synthesis of Ray Tracing and Radiosity Methods". Proceedings of the 14th Annual Conference on Computer Graphics and Interactive Techniques. SIGGRAPH '87. New York, NY, USA: ACM: 311–320. doi:10.1145/37401.37438. ISBN 9780897912273.
  30. ^ Reif, J. H. (1994). "Computability and Complexity of Ray Tracing" (PDF). Discrete and Computational Geometry. 11.
  31. ^ "What is Ray Tracing?". Nvidia.com.{{cite web}}: CS1 maint: url-status (link)
  32. ^ "Reflection Mapping History". www.pauldebevec.com. Retrieved 2019-10-30.
  33. ^ "Practical Particle Lighting" (PDF).{{cite web}}: CS1 maint: url-status (link)

10/30/19 HC Comment: I had some questions and suggestions for revision for the lighting model text:

Lighting models are used to replicate lighting effects in [type/adjective] environments where light is approximated [wc] based on the physics of light. Without lighting models, replicating lighting effects as they occur in the natural world would require more processing power than is practical for computer graphics [1][I switched order of some content - does this still make sense]. [is there something missing here about color of pixels before next sentence?] In order to compute the color of a specific surface pixel, an illumination model must be used. There are two main lighting illumination models, object oriented lighting and global illumination [17]. [what is shading] One of the most common shading models is the Phong model. The Phong model assumes that the intensity of each pixel is the sum of the intensity due to diffuse, specular, and ambient lighting. [what is ambient light] Ambient light is the directionless light of a scene, diffuse light comes from a specific source in the scene and is reflected in all directions, specular light comes from a specific source and is sent in a specific direction.