What is DOT3 lighting?

The answer to my question suggests that DOT3 lighting can help with OpenGL ES rendering, but it's hard for me to find a decent definition of what DOT3 lighting is.

Change 1

IPhone related information is greatly appreciated.

+2
source share
2 answers

DOT3 lighting is often referred to as pixel lighting. In vertex lighting, the lighting is calculated at each vertex, and the resulting lighting is interpolated by a triangle. In pixel lighting, as the name implies, an object must calculate the lighting at each pixel.

How this is done on hardware with fixed functionality, as the iPhone with the so-called register adders. The name DOT3 comes from this rendering state:

glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_DOT3_RGB); 

Check out this Wolfgang Engels blog post for more details on how to set it up.

When using pixel lighting, it is also popular to use the so-called normal map . This means that the normal of each point of the object is stored in a special texture map, a normal map. This was popularized in the DOOM 3 game by ID, which used rather low-poly models, where they were used, but with normal high-resolution cards. The reason for using this method is that the eye is more sensitive to a change in lighting than a change in shape.

In your other question, I saw that the reason for this is because you wanted to reduce the memory size of these vertices. This is true, instead of storing three components for the normal at each vertex, you only need to save two components for the texture coordinates on a normal map. Turning on the backlight per pixel will cost performance, so I'm not sure if this will be a clear victory, as you are usually advised to try and see.

Finally, the intensity of the scattered light at a point is proportional to the cosine of the angle between the normality of the surface and the direction of the light. For two vectors, dot product is defined as:

 a dot b = |a||b| cos(theta) 

where |a| and |b| is the length of the vectors a and b respectively, and theta is the angle between them. If the length is one, |a| and |b| are called unit vectors, and the formula simplifies to:

 a dot b = cos(theta) 

this means that the intensity of the scattered illumination is determined by the point product between the normality of the surface and the direction of light. This means that all diffuse lighting is a form of DOT3 lighting, even if the name refers to the pixel view.

+8
source

From here :

Bumpmapping places a texture in a model where each texel brightness determines the height of that texel.

The height of each texel is then used to disturb surface illumination.

A normal display places a texture in a model, where each texel color represents three values ​​that determine the direction in which surface points are located.

For example, the color (255, 0, 0) may mean that the surface at this point indicates the positive X axis.

In other words, each texel is normal.

The name Dot3 comes from what you actually do with these normals.

Say you have a vector that indicates the direction of your light source. And let’s say that you have a vector that is normal in a particular texel on your model that tells you which direction the texel is pointing in.

If you are performing a simple mathematical equation called the "point product" on these two normal vectors, for example:

Dot = N1xN2x + N1yN2y + N1z * N2z

Then the resulting value is a number that tells you how many of these two vectors point in the same direction.

If the value is -1, they indicate in opposite directions, which actually means that the texel indicates a light source and the light source indicates a texel, so the texel should be illuminated.

If the value is 1, they point in the same direction, which means that the texel is pointing from a light source.

And if the value is 0, then one of the vectors indicates 90 degrees relative to the other. That is: If you are standing on the earth with impatience, then your gaze vector is 90 degrees relative to the normal to the earth, which points up.

+1
source

Source: https://habr.com/ru/post/1315253/


All Articles