The type of light we are discussing here has the same point, that is, we are considering a point on the light source, the effect on the surface of the object, that is to say, the three-dimensional angle is approaching zero.
Here the light source is divided into two categories, one is directional light, assuming the light source in an infinite distance. The other is the point light source, assuming that the light source size relative to the light source and the object surface distance can be ignored.
The directional light is described earlier, and its irradiance to the object is constant. Now let's subdivide the light source.
The first point of light is called Omni Light, the floodlight body. It is characterized by the radiation intensity of the light source to all directions or the intensity of light is the same. The following equation is used when calculating the effect on the surface irradiance of an object:
Where PL is the position of the light source, PS is the position of the surface of the object. It can be seen that irradiance decreases as the square of the object's surface and the distance of the light source increases. The third equation is the calculation of radiation intensity and irradiance in physics, where the irradiance is the irradiance of the surface perpendicular to the light, and this is why the inverse of the distance squared in many light calculations. The actual calculation usually only calculates a system. This is called the decay equation (falloff function) instead of the denominator in the above formula, as follows:
The use of an equation rather than the square of R is used to better control the effect of rendering. At the same time, it can handle extreme situations, for example, if the object is very close to the light source and very far away. The three equations are the actual form of the attenuation equation.
The first equation is the one implemented by OpenGL and DX fixed pipelining. The second is the widely used equation in real-time rendering, where the RS and re are set by themselves for easy control of the effect. The third equation is the one used by Pixar in movie rendering. For the third equation, RC is a constant, used to describe the constants associated with the distance of the light source, the closer to the light source, the more the whole equation is close to Fmax, and when the light source is farther away, a better control of the result of the equation is achieved by SE, the other two constants K0=ln (Fc/fmax), K1 = Se/k0, the equation comes from a 1997-year paper by Barzel. This is where the omni-directional light is introduced.
The second midpoint is called spot light, Spotlight. It is a light that changes the intensity of light as it changes direction. One form of change is based on the direction of the light source and the direction of light (light source position to the object surface of the vector, this in the previous introduction, in order to more quickly in the light equation to calculate the angle of light and normal, so the direction has always been from the object surface to the position of the light source unit vector, here, We want to reverse) the angle to attenuate the light intensity, such as the equation, which is also used in OpenGL fixed pipeline,
After the light intensity is calculated by the above equation, the irradiance is calculated using the equation 7.12 or the attenuation equation above. But in the DX fixed pipeline is provided the following equation, the characteristic of this equation is able to simulate the umbra (Umbra) and Penumbra (Penumbar), where the meaning of the parameters, a look will know, there is not much to say,
Here is a third point light source, textured light, texture mapping source. If you know the shadow map principle, then this light source is very good immediately, if you do not know, please refer to this blog related articles. As a result, the effect of textured map is as follows:
is to replace the depth texture of the shadow map with a two-dimensional texture, so that when the pixel is calculated, the direct blending of the texture and the pixel already has the color.
Advance type of shading--light source