OpenGL system design-illumination and material (1)

Source: Internet
Author: User

 

Illumination and material

 

Light is an important part of computer graphics. without light, any object looks like plastic, but still lacks the sense of realism.

In nature, light is also one of the most important elements. Only by Yu Guang can we know the world. An object that can produce light is called a light source. For humans, the sun is the largest and most important light source. Others, such as burning candles, light emitting diodes are also the light source. If there is light, there is a shadow. If there is no light, a shadow is formed.

When light is shining on an object, no matter what the object is, it will reflect light, but the strength of the reflected light is related to the attributes of the object. A transparent object also transmits a part of the light. Because light is essentially energy, both transmission and reflection are energy, and any object will absorb light.

 

(Modification) reflected light can be divided into three parts: Environmental reflection, diffuse reflection, and mirror reflection. Environmental reflected light: it is assumed that the incident light is uniformly incident from the surrounding environment to the surface of the scene and is reflected in all directions in the same way, normally, the surface of an object is subject to reflected light from the surrounding environment (such as from the ground, sky, walls, etc.). These lights are usually collectively referred to as ambient light ); the diffuse reflection component indicates the light that is uniformly reflected to all directions of the space in the reflection light of a specific light source on the surface of the scene. These light are often referred to as diffuse light ); the reflected light is a reflection in a certain direction. When a point light source is shining on a metal ball, a particularly bright area is formed on the spherical surface, showing the so-called "highlight )", it is the specular light produced by the light source on the metal sphere ). For a smooth object, the highlighted area of the reflected light is small and bright; on the contrary, the reflected light of the rough surface is divergent, And the highlighted area is large but not bright.

 

The light application in OpenGL consists of three parts: Light Source attributes, material attributes, and global light attributes.

Illumination also has two modes: rgba and color index table. Compared with the color index table mode, the rgba mode is more flexible and less restrictive. Therefore, the rgba mode is widely used in OpenGL.

 

OpenGL illumination is based on the phone illumination model. In each vertex of A ry, the color value is determined by the material attribute of the ry and the light source attribute. The final value of vertex color is to overlay four components, which are the four light types of OpenGL: ambient light and diffuse light), specular light, and emission light ).

A radiation light is the simplest light that emits light directly from an object and is not affected by any light source. Environment light is determined by all the light in the scenario that cannot be determined.

The diffuse light comes from one direction. When it is exposed to an object, it spreads out evenly in each direction. Therefore, the position of the viewpoint does not affect the brightness of the diffuse light. Diffuse Light is the most basic part of the current light. Basically, all the light has diffuse components. The smaller the diffuse components of the light with the stronger the focus capability, such as the laser speed and the weaker the focus capability, the larger the diffuse components, such as the light from a flashlight.

The mirror light comes from a fixed direction and is reflected out of the other direction. A parallel laser beam generates a 100% mirror reflection on a high-quality mirror. Bright metals and plastics have very high non-reflective components, and almost no reflection components like chalk and carpets. Therefore, in a sense, the reflection of an object is equivalent to the light intensity (or brightness) on it ).

 

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.