Some shading models in realtime Rendering

Source: Internet
Author: User

Some time ago there was here (http://www.fseraph.com /? P = 661) I saw a summary of some common rendering models in real-time rendering. Recently, I also found some materials to learn about. Here is a brief summary.

1. Some Basic Concepts

  • Photon (photon): a particle with a wavelength and energy
  • Radiant Energy (radiant energy): the energy of a subset of light. Unit: (Jiao ER)
  • Radiant flux, radiant power:, radiation energy per unit of time (or the energy of the photon emitted by the light source per unit of time ), unit: (Watt, lugs/second)
  • Flux density (flux density), irradiance (radiant illumination): the radiant flux per unit area, that is, the flux of the flat surface passing through (entering or leaving; irradiance is the radiation flux that is used to describe the unit of surface that enters the surface in its normal hemisphere space. Unit:
  • Radiant Intensity (radiation intensity): the radiant flux per Entity angle, that is, the radiant flux at a certain point through (entering, transmitting, or traversing) in a certain direction;Solid
    Angle)
    : Two-Dimensional Angle in three-dimensional space; measured in the sphere degree;: in the radius of the Space ball, the spherical surface area of the area corresponding to the object angle is; Unit:
  • Radiance) radiation flux (the angle between the direction and the surface direction); for example, the same radiation brightness in each direction corresponds to a proportional radiation intensity; the radiation brightness at a certain point is independent of the distance. Unit:
2. Bidirectional Reflectance Distribution Function

BRDF (bidirectional reflection distribution function) is used to describe the relationship between the surface incident of an object and the reflected light. Its mathematical form indicates the point on the object surface, the ratio between the difference in the radiation brightness reflected in the outbound direction and the difference in the radiation illuminance that enters the incident direction. Therefore, BRDF is a Trielement function, and the quantization formula is:

After the above variant, the reflection equation at the point can be obtained:

The integral formula calculates the radiant brightness of the object surface in a specific direction under certain light source conditions, and thus determines the image it obtains when it is perceived by the human eye. The core is the part involved in BRDF, which is also the key to the changes corresponding to the special rendering model.

Some attributes of BRDF. The first is some basic public attributes:

  • Wavelength dependency, wavelength correlation: Different wavelengths of light have different reflection results on the surface, so it is related to the wavelength.
  • Reciprocity, mutual Inversion: Changing the direction of the incoming and outgoing light does not affect the BRDF value. The mathematical description is as follows :. This attribute is very important in some physical-based rendering, such as bidirectional.
    Path tracing and so on (but it may be ignored in the real-time rendering model ).
  • Energy conservation, conservation of energy: BRDF needs to meet the Conservation Law of energy, that is, the total energy reflected from the surface point is not greater than the total energy directed into the point. After quantification of a surface point, the following operations are performed :. Most BRDF can satisfy this attribute to a certain extent, which makes rendering results look more natural. However, it is not easy to strictly satisfy this constraint, it requires that the energy cannot be lost or reduced from the ground (these may be important in physical rendering ).
  • Anisotropy & isotropy, &: If BRDF is about a surface normal vector that is rotated symmetric, its result only depends on and the difference between the corresponding azimuth values, then BRDF is of the same type; otherwise, it is the opposite sex. BRDF of most metallic materials has different attributes.

In addition, some attributes should be satisfied as much as possible from the perspective of real-time rendering Engineering:

  • Intuitive and simple parameterization: BRDF requires several key parameters for modulation. intuitive and easy-to-use parameters allow the artist to easily set various attributes of the material, greatly reducing the difficulty of use and Improving the efficiency.
  • Higher computing efficiency: Efficiency is the most important factor in real-time rendering. This is one of the most popular efficient Phong models. Other highly expressive models are not widely used. The computing efficiency of BRDF includes two aspects: Time and space. In the current GPU architecture, the corresponding BRDF computing is generally required for each pixel, therefore, the efficiency of these two aspects is equally important.
3. Fresnel reflectance practical BRDF needs to be used to present as many material types as possible, including common metals, crystals, or liquids. In physical reality, when light is transmitted on the surface of such a smooth substance, another reflection and refraction occurs: freell. In the freell phenomenon, light passing through different media passes through the object through reflection or refraction at a certain rate and angle related to refractive index and reflectivity. This reflection phenomenon can be described by the freell equation. It is mainly used to describe the relationship between reflection and refraction when light is transmitted between different media. The freell equation mainly includes two components: reflection coefficient, transmission coefficient (or refraction), and the relationship between the two is satisfied:
Of course, in BRDF, only two-way light is taken into account. ReflectionDistribution, so you can only take the part of it; in other such as btdf or bsdf (bidirectional
Transmission/Scattering Distribution Function) also needs to consider the part of the function (for example, it needs to be used in some effects such as surface scattering ). In reality, it is not easy to calculate an approximation of physical reality, because of the following two reasons:
  • The reduction of high approximation requires a large amount of computing;
  • Almost real physical attribute parameters are unknown;

In real-time rendering, in most cases, the approximate method is used to calculate seemingly credible results at the lowest possible cost. Currently, schlick proposes many approaches to approximation, as shown below:
The refractive index of the medium is the half angle between the incident light and the reflected light (the half angle between the light and the light when used in BRDF ). With the above Fresnel
After the term, it can be embedded into some BRDF in a timely manner to restore the freell phenomenon to a certain extent and enrich the performance of BRDF for this type of material (for example, in the following cook-Torrance and other models) ). 4. Some common rendering models

Direct Calculation of the original integral formula of the reflection equation is obviously not feasible, and it needs to be simplified by discretization. Here we usually combine the modeling method of the Dirac Pulse Function of the light source (see here ); after simplification, you can:

In this way, the final rendering result can be obtained by adding a light source in a limited direction. In the analysis process, only the light effects in one direction need to be considered, that is:


Transform to another form of abstract expression to facilitate subsequent analysis of various rendering models (note:INot the preceding radiation intensity ):


In the above formula, it is the normal vector of the object surface, which is the vector of light to the surface point, and V is the vector of the viewpoint to the surface point. The vertices represent the point multiplication between two unit vectors, this parameter is used to replace components. The original three parameters can be directly and indirectly converted and replaced (as shown in ):


Generally, BRDF is a linear combination of reflection results of Multiple Surface attributes (in real-time rendering, only diffuse and specular are considered). It can be quantified as follows:


The two reflection results represent their corresponding weights, so that BRDF with different rendering performances can be obtained through the four parameters in the modulation combination. Next, let's take a look at some common models:

Lambert

The Lambert model is the simplest form. It is mainly used to restore the completely diffuse reflection effect (the incident light is calledLambert), Instead of specular reflection. Its BRDF statement is as follows:


In real-time rendering, the above formula is usually directly replaced with the diffuse color value, so the final BRDF Modulation factor is:


The simple lanbert model is rarely used. It is usually reasonably integrated into other more complex models.

Phong

Phong should be said to be the most used rendering model currently. It basically adds glossy specular reflection to diffuse reflection, the calculation of this part uses the direction (OR) from which the light emits from the surface and the total reflection direction of the light at this point.The BRDF formula is as follows:


In the above formula, it is glossy.
Specular reflection component: the corresponding specular
Color (similar to); some can be used to approximate the external Geometric Factors in the non-reflection equation; the adjustment can control the scope of the highlight area: a large area corresponds to a small area of the highlight area, the opposite is relative. The calculation is :.

The BRDF Modulation factor of the basic phong model is:


In general, but it can also make its value smaller than 1, as long as it is not greater than 1, it meets
Consveration constraints.

  • BlinN-Phong

BlinN-Phong is used to modify the computing details based on the original Phong.Halfway Vector: To calculate the value of the specular reflection component:


It is still different from the original Phong in terms of computing efficiency: When it remains unchanged in some cases, it can be estimated that it will be used in a unified manner, because it does not depend on the surface method vector (dependencies require computing at each pixel), computing R is more cost-effective (at least the Open-side operation can be saved) in other cases ). The modulation parameter of the B-P is (the rest are not changed ):

  • Modified-Phong

Division operations are in both P and B-P models so that the light is almost perpendicular to the normal) and the mutual inversion (reciprocity) of BRDF is not satisfied. This operation is directly removed from modified-Phong to avoid this problem. Its BRDF is as follows:


Therefore, this modification is also called reciprocal (BlinN-) Phong. Although this simple modification can avoid division by zero, it also makes the rendering effect in the surrounding area not natural. The BRDF here includes:


  • Max-Phong

Another variant of the basic Phong is Max-Phong, which can better simulate a smooth metal surface than the first one, the modified-Phong method is also used to maintain the mutual inversion of BRDF. Its BRDF is as follows:

At this time:

The preceding Phong models are the most commonly used Reflection models in real-time rendering. Their common feature is that parameters are easy to adjust and computing efficiency is high, which is also the main reason for their popularity; the main difference between them is that they use different computing methods for some of them, but in general, Phong Model is insufficient for some of them, this is also one of the focuses of improving other more complex rendering models.

Oren-Nayar

The Lambert method is a basic diffuse model. It assumes that the light emits evenly on the surface of an object in all directions, which is obviously not in line with the physical fact, the Oren-Nayar model is another diffuse model based on certain physical facts. It can better reflect the diffuse phenomenon of the surface of such materials. The analysis of this model is based on the micro-surface method. This method is mainly based on the following assumptions (as shown below ):

  • The surface of an object is composed of tiny and symmetrical V-shaped structures. The microsurfaces are reflected by each other.
  • The width of each V surface is much smaller than its length.
  • The area of each microsurface is much larger than the wavelength of light (this is easy to meet)
  • Each pixel must be able to cover enough microsurfaces.
  • Each micro-surface has a Lambert diffuse attribute

The theoretical analysis of the Oren-Nayar model is also complex. I will not describe it here. For details, refer to the following:Generalization of Lambert's Reflectance Model. Here, let's take a look at its final quantified BRDF equation:


The angle between the two vectors on the cut plane at the point:


The above formula indicates the roughness of the material surface. The valid value range is. The larger the value, the more uneven the diffuse direction is. When the value is 0, the corresponding diffuse direction is evenly distributed, this degrades to the lambert model. After the BRDF of the model is expressed in another form:


The Unit projection vector corresponding to the point on the cut plane, so that the BRDF modulation parameters can be obtained:


Oren-Nayar is more expressive for diffuse reflection than Lambert, but it costs a lot of computing, which mainly involves:

  • For

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.