Heuristic42
Blog
Opengl
Meta
Rendering
0
created
Oct 20 at 20:30
Iterators: pointers vs cursors
You're already doing both of these by hand. This post emphaisze…
–
pknowles
comment
Oct 10 at 10:27
Matrices
[deleted]
–
anonymous
comment
Oct 4 at 19:12
Matrices
[deleted]
–
anonymous
comment
Sep 30 at 18:51
Matrices
[deleted]
–
anonymous
comment
Sep 23 at 16:15
Matrices
[deleted]
–
anonymous
comment
Sep 21 at 6:52
Contributing
I kind of predicted what was bound to happen when my favourite …
–
anonymous
comment
Sep 7 at 1:21
Route contention when running docker and a VPN
Thank you for this. Between this and the overwriting of iptabl…
–
anonymous
comment
Sep 6 at 17:57
Making a real EMF Reader
Sorry for the random quoted text comments. I am one of those p…
–
anonymous
comment
Sep 6 at 17:48
Making a real EMF Reader
["ove! Play a tone with a buzzer and has 5 LEDs to show the “EM…
–
anonymous
comment
Sep 6 at 17:47
Making a real EMF Reader
["easure direction Measure the magnetic fie"](#q107-644-685)
–
anonymous
comment
Aug 20 at 17:01
Matrices
[deleted]
–
anonymous
comment
Aug 11 at 22:32
Matrices
[deleted]
–
anonymous
edited
Jun 8 at 22:29
Rethinking writing files with memory mapping and C++
This post introduces the motivation behind the [decodless C++ o…
–
admin
created
Jun 8 at 22:16
Rethinking writing files with memory mapping and C++
This post introduces the motivation behind the [decodless C++ o…
–
pknowles
comment
Jun 5 at 13:36
Contributing
[deleted]
–
anonymous
comment
Apr 19 at 11:24
Matrices
[deleted]
–
anonymous
comment
Apr 13 at 0:25
Matrices
[deleted]
–
anonymous
comment
Apr 5 at 9:43
Matrices
[deleted]
–
anonymous
comment
Mar 27 at 17:19
Matrices
[deleted]
–
anonymous
comment
Mar 25 at 4:59
Matrices
[deleted]
–
anonymous
comment
Mar 5 at 15:39
Matrices
[deleted]
–
anonymous
comment
Feb 7 at 5:45
Microsoft Natural Ergonomic 4000 Replacement
Thank you so much for sharing your thoughts here, it tells me e…
–
anonymous
comment
Jan 28 at 23:31
Microsoft Natural Ergonomic 4000 Replacement
Oh man, I feel this post. Not sure if you've seen the "new" new…
–
anonymous
comment
Jan 25 at 12:06
Matrices
[deleted]
–
anonymous
…
View All
Log in
Lights
leave this field blank to prove your humanity
Slug
*
A URL path component
Parent page
<root>
rendering/:Article2:3D Rendering (Computer Graphics)
--- rendering/cameras/:Article11:Cameras
--- rendering/matrices/:Article12:Matrices
------ rendering/matrices/projection/:Article14:Projection Matrix
--- rendering/vectors/:Article13:Vectors
--- rendering/geometry/:Article62:3D Geometry
------ rendering/geometry/triangle_meshes/:None
--- rendering/shading/:Article64:Shading
------ rendering/shading/transparency/:Article70:Transparency and Alpha Blending
--- rendering/lights/:Article65:Lights
--- rendering/rasterization/:None
------ rendering/rasterization/deepimage/:Article72:Deep Image
--- rendering/shadows/:Article67:Shadows
--- rendering/spaces/:Article68:Vector Spaces
------ rendering/spaces/tangent_space/:Article69:Tangent Space
------ rendering/spaces/clip_space/:Article89:Clip Space
--- rendering/rotations/:None
--- rendering/images/:Article74:<unset>:Images
------ rendering/images/mipmapping/:Article75:<unset>:Mipmapping
--- rendering/materials/:None
opengl/:Article3:OpenGL Tutorials
--- opengl/oit/:Article7:Order Independent Transparency (OIT)
--- opengl/framebuffer/:Article71:The Framebuffer
meta/:Article4:Pages About This Site
--- meta/contribute/:Article5:Contributing
--- meta/bugs/:Article9:Bugs
--- meta/about/:Article10:Why does this website exist?
The parent page this belongs to.
Article title
*
Article revisions must have a non-empty title
Article body
*
A light in computer graphics is a light source, and a fundamental component of rendering. It's light bounces around a scene of objects and ultimately enters the camera to form a 2D image. Lights have colour and brightness and are often categorized by their geometry into directional, point, spot, area and volume lights. In these cases lights are quite separate to geometry, affecting geometry without being visible itself. Alternatively a material (e.g. for surface or volume geometry) with an emissive property can also be a light source. Having geometry with emissive properties in the scene matches reality better as light is emitted from matter, however supporting such generalized light sources can be expensive especially for rasterizers and especially when supporting [shadows](/17/rendering/shadows/). ## Directional Lights Directional lights are lights with infinitely far position and no attenuation, or reduction of intensity, over distance. For example, the sun is so far away that relative changes in position are insignificant. Because of this approximation, a globally constant light direction vector can be used in the lighting calculations. In the first real-time graphics applications, small optimizations such as this was important, particularly for Blinn-Phong specular highlights where both an infinite viewer and infinite light allow a constant half-vector. ## Point Lights Point lights have a world space position and a light direction vector is calculated at every shaded point. An attenuation is often applied to point lights, not because of any for or absorption effects, but because the light is "spread thin" as it moves outwards from a point. Think of a sphere growing in size, being the wavefront of traveling light. As it grows, the same amount of light on its surface must cover a greater area. This area increases with the square of the distance, $d^2$. Likewise the intensity is scaled down by $\frac{1}{d^2}$. ## Spot Lights A spot light is really just a point light with a cover so that light only goes in one direction, which although more expensive could be modeled with geometry and shadows. A direction vector and angle for the width of the beam are its attributes. Rather than a sharp cutoff for points outside the angle, a ramp is often used to simulate soft shadows at the spotlight edges. ##Area Lights Area lights are an extension of point lights, forming a flat surface. They are much more expensive and produce soft shadows. A common area light is a disc to model the silhouette of a sphere such as the sun or light bulb. Rather than a single point, the light from them is the integral over the lights area. They could be approximated as a collection of point lights distributed over the area. A raytracer essentially does this, numerically integrating the light by tracing rays to many points over the area. An emissive material applied to a triangle mesh of a light bulb could be considered many area lights, one for each triangle. A volume light is the same thing, but with light coming from everywhere within a volume. An example may be the flame of a candle, where the gas is so hot it emits light. To support arbitrary materials emitting light, a raytracer can employ multiple importance sampling, where rays are generated at higher density in the direction of known emissive surfaces, avoiding samples which do not affect the result. # Rendering Multiple lights can be added to the scene by simply adding the colour/intensity from each one. I.e. sum the result of all lighting equations. Lighting can be quite expensive with many lights. An easily solution was to turn on only the most significant lights for a given view. Computing the affect of a light on geometry can happen during [shading](https://www.heuristic42.com/14/rendering/shading/) while rendering, known as *forward rendering*. Alternatively, materials and other information can be saved to compute lighting effects in a subsequent stage, called *deferred shading*. A direct approach to lighting was to simply apply a lighting equation for every light during forward rendering. Of course not all lights significantly affect all surfaces. Additionally not all surfaces are visible. Deferred shading typically stores only visible surface information. This avoids some unnecessary lighting computation. However, small lights may only affect a little part of the image. Rather than check all lights per geometry sample, deferred shading allows computation for each light. I.e. for each light, work out and apply lighting to only those pixels it affects. These pixels, and even depth ranges, can be found by rendering simple bounding geometry for each light. A spatial data structure can be used during forward rendering to provide similar improvements to the above, where a search finds a list of lights affecting each geometry sample. The basic idea is don't do unnecessary work. Even checking to see if more work should be done is work itself. This becomes very important with lots of lights.
Toggle Preview
Edit message
*
A description of the changes made
Discard Draft
Save Draft
leave this field blank to prove your humanity
Flag
the thing you clicked
for moderator attention.
Reason choice:
Spam, promoting, advertising without disclosure
Rude, inappropriate, generally offensive
Too arrogant or demeaning to others
Other
Reason:
The reason for raising the flag
Error