top of page
Lighting Models are methods/algorithms used to determine the light at the surface of a model. There are many varying methods of computing lighting with shaders. Artists and programmers choose them depending on the level of realism/stylization/performance implications of the model. Below we will cover a range of lighting and shading models.
Lambertian Reflectance, or Diffuse Light, is one of the most common, if not the most common, lighting models used.
This lighting model is view independent, meaning the surface's apparent brightness should not change based on viewpoint. It is a very simple model and can be constucted in pseudocode as follows:
Half-Lambert (Diffuse Wrap)
Half-Lambert (Diffuse Wrap)
The Half-Lambert lighting model is a technique first developed in the original Half-Life by Valve. It was developed to prevent the rear of an object losing it's shape and thereby looking flat. This is an extremely forgiving lighting model, and as such is completely non-physical.
The key to the Half-Lambert lighting model is that the Lambert diffuse is halved, then half is added, then it is squared. A common implementation, called diffuse wrap, operates on the idea that instead of using halves, you can use any value between a half and a whole. ie. Instead of:
pow(NdotL * 0.5 + 0.5,2)
One could use:
pow(NdotL * wrapValue + (1-wrapValue),2)
Where wrap value is anything between 0.5 and 1.
Below is an implementation of the Half-Lambert lighting Model:
The Phong Shading Model is commonly used to create specular effects. It is based on the assumption that the way a surface reflects light is a combination of the diffuse reflection of rough surfaces with the specular reflection of shiny surfaces.
Below is a common implementation of the Phong Model:
The Blinn-Phong shading model (also called the modified Phong) is a modification to the Phong reflection model, and was developed by Jim Blinn.
The Blinn-Phong model is an optimization to the Phong model, which requires one to calculate the light reflection vector every frame. Instead, Blinn calculates what is referred to as the "Half Direction" which is simply the halfway angle between the light direction and the view direction. The benefit to this is a much smoother specular reflectance shading model.
Below is a common implementation of the Blinn-Phong Lighting Model:
This is less of a lighting model, and more of a lighting tweak to show what you can do with simple mathematical operations on standard lighting models. This method works by breaking the lighting direction up into bands. This method can then be passed into any standard lighting model by replacing NdotL with the banded NdotL as shown below:
The Minnaert Lighting Model was originally designed to replicate the shading of the moon, so it's often called the moon shader. Minnaert's good for simulating porous or fibrous surfaces, such as the moon or velvet. These surfaces can cause a lot of light to back-scatter. This is especially apparent where the fibers tend to be mainly perpendicular to the surface like velvet, velour, or even carpets.
This simulation provides results that are pretty close to Oren-Nayar, which is also frequently called a velvet or moon shader.
Below is an example approximation of Minnaert Lighting:
The Oren–Nayar reflectance model is a reflectivity model for diffuse reflection on rough surfaces. This model is a simple way to approximate the effect of light on a rough, yet still lambertian, surface.
Below is a simple implementation of Oren-Nayer:
bottom of page