This note writes about lighting in computer graphics.
Lighting Pipeline Models
There are several common lighting pipeline models that helps to process lighting in rendering. We list the most important ones. In these models, we assume we have m objects and n lights.
Iteratively going through every light, and compute its affect applied on the current pixel. The complexity is then O(mn), obviously.
Very expensive, but very simple to implement.
- Traverse all the objects first, document them in a data structure. (O(m))
- Traverse all the lights, compute the render effect only for those pixels that are in the lighting range of the light. (O(n)).
So in total O(m+n).
Less expensive but take more space because we need a data structure at the first step.
- Calculate for once about the lighting condition and store them as texture sprites.
- Apply these sprites to the models, pretending as there's light shedding on them.
Very accurate and does not require real-time computation. However, it is static.
- The fatal problem for light map: it is not able to process dynamic objects.
- We create cloud of points around the object, and sample these points.
- Calculate the light on the object by interpolating through the samples we get.
Imaged Based Rendering / Lighting (IBL, IBR)
- Pre-render a cube centered at the object as the information of environment lighting.
- When dynamic computation is necessary, we calculate the light with the cube along with the normal vector information.
Next Generation Rendering
There are some essential technologies that are developed recently.
Instead of adding vertices, we can use a normal map sprite to store the height information on the normal direction. This is much more efficient than adding bunches of vertices (usually hundreds of thousands, or even millions of vertices).
Physically Based Rendering (PBR)
PBR requires a rigorous physical and mathematical understanding, and we will expand later in other blogs. In this note we will only go over the three most important parameters of PBR.
Albedo/Diffuse color/Base color
Albedo refers to the base color of the object.
It is a native property of an object.
It should not contain any information about shadowing/a.o.
The surface details of an object.
Describes the concentration of highlights. (Lower roughness indicates a more concentrated highlight)
The reflectance of an object.