SharpGL learning notes (9) OpenGL lighting model, terminology, sharpgl learning notes

Source: Internet
Author: User

SharpGL learning notes (9) OpenGL lighting model, terminology, sharpgl learning notes

In 3D scenarios, the colors displayed by each pixel are calculated in large quantities, some calculations depend on the illumination in the scenario and the reflection and absorption of the light by the objects in the scenario.

For example, for a red object, it is red when the white light (the white light is red, the green light and the blue light are the same amount of light, in the light of green light, it will be black.

 

OpenGL Illumination Model


OpenGL light can be divided into three components: Red, green, and blue. For a light source, the light source is described by the amount of red, green, and blue light it emits.
You can use the ratio of red, green, and blue in each direction to describe the surface material of an object.

The OpenGL illumination model divides illumination into four independent parts:
Ambient light)
Diffuse light)
Specular light)
Emitted light)
The four light types are calculated separately and then superimposed.

 

Ambient light)

Environment light is the basic light source in a scenario. If you enter a dark room, the ambient light is usually zero, but when you go outside, there is always light for you to see. Ambient Light has no direction (so it is also called the "Global Illumination Model ").

In the room, the environment is usually the light that cannot be determined by the Environment scattering, just like the light from all directions.

 

Diffuse light)
Actually, when we look at the desktops, walls, and the sun shining above, we can see the light. In most cases, most of the light sources we see are diffuse light that spreads to our eyes.

Like this:

The desktop or walls we usually see are smooth. That is to say, the n normal is supposed to be vertical up. That is to say, the reflection of light may not be transmitted into our eyes? Why do we see that the desktop has the same diffuse light from different perspectives?

The key to solving this problem is that the surface is rough under microscopic conditions.

If we use a microscope to observe a very smooth desktop, we will also find it uneven. To what extent? We can see from all different directions and angles that the roughness is the same. After thinking about this, you can figure out that the micro-normal is not vertical but different angles.

 

Specular light)

It is the shining point that we usually see in a smooth sphere. For example:

Metal surface, plastic, glass, bottle, etc. It is easy to see this mirror reflected light.

Notes on reflected light:

1. The spherical surface is easy to see the reflected light. It is because the normal area of the spherical surface spreads outward, so that the area with high light is larger, so it is easier to see the reflected light.

2. The mirror surface is smooth, so the reflected light is very concentrated. Although the area is small, but the intensity of the highlighted light is very large, you can see the reflected light clearly.

3 In fact, the reflected light can occur on any object and any surface.

4. the roughness of the surface reflected light is very weak or does not even see the mirror reflected light.

 

Emitted light)

This light is a kind of light emitted by a material. It is used to simulate the light emitted by an object. In 3dsmax, it is called a self-emitting material.

For example, if there is an incandescent bulb in a scenario, this bulb can be assigned a "self-emitting material"

 

It is the effect of 3dsmax light rendering. According to the above theory, it should be superimposed by the above four types of light source.

I will separate the light source types for you to see what the actual effect is.

First, ambient light does not exist in this scenario.

Then, emitted light does not exist in the following scenarios.

We will only study the diffuse light and specular light in the lower-plane scenes.

 

Below is the diffuse light)

 

 

The following figure shows the reflected light)

 

Related Article

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.