This section covers lighting and basic coloring model, coloring frequency, graph pipeline, texture mapping, interpolation and advanced texture mapping

Brynvon reflection model

Local color

For a shading point, which is within a very small range, we can think of it as a plane.

And to do that, we need to define some vectors, and these are all unit vectors of length 1. Note that we only consider local shading and do not consider shadows.

  • The normal line of the plane NNN.
  • Observation direction from camera to shading point VVV;
  • Shading point to light source LLL;

Diffuse reflection

Diffuse reflection is when light is reflected evenly in all directions. The shading point should be exactly the same from any direction, that is, diffuse light is independent of the observation direction.

Consider: why does the same light shine at different angles and get different shades?

We can assume that light is discrete, and we can see that the Angle between the direction of the light source and the surface of the object determines the brightness and darkness, because the unit area of the surface of the object receives different energy because of the Angle.

Diffuse reflection formula

We agree that the light intensity is III at a unit distance of 111. So the light intensity when the distance is RRR is I/r2I/r^2I/ R2


L d = k d ( I / r 2 ) max ( 0 . n l ) L_{d}=k_{d}\left(I / r^{2}\right) \max (0, \mathbf{n} \cdot \mathbf{l})
  • The dot product of the unit vector is equal to the cosine of the Angle between the two vectors
  • ⋅ n ln·ln l instead of n (0,n l) Max (0,n· L) Max (0,n⋅l) is because the point product of two vectors is a negative number, i.e. light passing through the object from below, which has no physical significance for diffuse reflection.
  • The diffuse reflection coefficient kdK_dKD, if it is 111 it absorbs no light at all, and if it is 000 it absorbs all light.

Reflection: Why do shading points have color?

This is because the surface absorbs some of the color and reflects some of it. If different points have different absorption rates, different colors are naturally produced. If the diffuse coefficient is defined as a three-dimensional vector, the value of RGB three color channels can be calculated for the color of the point.

highlights

The characteristic of specular light is that the Angle between the specular reflection direction RRR and the normal direction NNN is the same as the Angle between the illumination direction LLL and the normal direction NNN. If the mirror is not so smooth, then the specular reflection will have a distribution along the specular reflection RRR. Highlights can only be seen when the observation direction VVV is close to the specular reflection direction RRR.

Specular formula

For the calculation of the intensity of the highlight, the Brinfen model does not directly calculate, but takes a trick. That is, the Angle bisector direction of incident direction LLL and observation direction VVV is calculated first.

According to the parallelogram rule, the vector obtained by L +vl+ Vl + V is the direction of Angle bisector, and after normalization, it is the half-way vector HHH.


h = bisector ( v . l ) = v + l v + l \begin{aligned} \mathbf{h} &=\operatorname{bisector}(\mathbf{v}, \mathbf{l}) \\ &=\frac{\mathbf{v}+\mathbf{l}}{\|\mathbf{v}+\mathbf{l}\|} \end{aligned}

The reason for not calculating highlights directly with reflection direction and observation direction is that the reflection direction is difficult to calculate and the half-way vector is too easy to calculate. Therefore, the high-light formula only needs to find the cosine of the Angle between the half vector and the normal line.


L s = k s ( I / r 2 ) max ( 0 . cos Alpha. ) p = k s ( I / r 2 ) max ( 0 . n h ) p \begin{aligned} L_{s} &=k_{s}\left(I / r^{2}\right) \max (0, \cos \alpha)^{p} \\ &=k_{s}\left(I / r^{2}\right) \max (0, \mathbf{n} \cdot \mathbf{h})^{p} \end{aligned}
  • To measure whether you can see highlights, you measure the distance between the observation direction and the mirror reflection direction, that is, the distance between the half vector and the normal line. As they get closer to each other, the dot product gets closer to 1 and closer to 0.
  • Specular reflection coefficient KSK_sKS is usually considered a white color.
  • The absorption rate also needs to be considered, but the Brynvon model is a simplified model and is ignored here.
  • The index PPP is the high light coefficient

Why do we need a high light coefficient PPP?

This is because the tolerance of coscoscos function is too large. If the specular light is calculated directly by Coscoscos function, the specular light is too large due to the large value. So we need to degrade the Coscoscos function exponentially.

Environmental light

Because the light in the environment is too complex, it is simplified in the Brynvon model.

In the Bringvon model, it is boldly assumed that any point receives the same light in the environment, with an intensity called IaI_aIa.


L a = k a I a L_{a}=k_{a} I_{a}
  • Ambient light doesn’t care where the light comes in, it doesn’t matter where the light is coming from.
  • Ambient light is the same no matter where you look at it, so it has nothing to do with the observation direction VVV.
  • The ambient light has nothing to do with the normal direction NNN.

To sum up, ambient light is actually a constant color value in the Brynvon model.