Heuristic42
Blog
Opengl
Meta
Rendering
0
comment
Feb 7 at 14:26
Matrices
[deleted]
–
anonymous
edited
Feb 2 at 15:54
Embedding GDB pretty printers, just like natvis
Pretty printers are awesome, but the setup can be a real pain. …
–
pknowles
created
Jan 31 at 20:27
Embedding GDB pretty printers, just like natvis
Pretty printers are awesome, but the setup can be a real pain. …
–
pknowles
comment
Jan 25 at 16:20
Matrices
[deleted]
–
anonymous
comment
Jan 14 at 15:46
Matrices
[deleted]
–
anonymous
comment
Jan 13 at 16:05
Making a real EMF Reader
All good/my bad. A half implemented feature that I really shoul…
–
pknowles
comment
Jan 13 at 16:03
Making a real EMF Reader
I don't have a circuit diagram sorry. The LEDs are all on separ…
–
pknowles
comment
Jan 9 at 8:07
Making a real EMF Reader
а есть подробные схемы что к чему подключать и куда припаивать…
–
anonymous
comment
Jan 5 at 2:00
Matrices
[deleted]
–
anonymous
comment
Dec 15 '24
Matrices
[deleted]
–
anonymous
comment
Nov 27 '24
DerBard: Custom Split Mechanical Keyboard Prototype
hello
–
anonymous
comment
Nov 19 '24
Matrices
[deleted]
–
anonymous
created
Oct 20 '24
Iterators: pointers vs cursors
You're already doing both of these by hand. This post emphaisze…
–
pknowles
comment
Oct 10 '24
Matrices
[deleted]
–
anonymous
comment
Oct 4 '24
Matrices
[deleted]
–
anonymous
comment
Sep 30 '24
Matrices
[deleted]
–
anonymous
comment
Sep 23 '24
Matrices
[deleted]
–
anonymous
comment
Sep 21 '24
Contributing
I kind of predicted what was bound to happen when my favourite …
–
anonymous
comment
Sep 7 '24
Route contention when running docker and a VPN
Thank you for this. Between this and the overwriting of iptabl…
–
anonymous
comment
Sep 6 '24
Making a real EMF Reader
Sorry for the random quoted text comments. I am one of those p…
–
anonymous
comment
Sep 6 '24
Making a real EMF Reader
[deleted]
–
anonymous
comment
Sep 6 '24
Making a real EMF Reader
[deleted]
–
anonymous
comment
Aug 20 '24
Matrices
[deleted]
–
anonymous
comment
Aug 11 '24
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