The first New Year 🧨

Today is the seventh day of the Chinese New Year, in shandong province, there is a custom of “sending vulcan”, the children of the family point torches to run away from home, until the torch goes out, and at the same time give tribute to the “Kitchen God” sesame sugar (this is my favorite snack).

Meaning to dispel the fire, safe and sound, to the kitchen God eat some good back to a few words bless in the New Year smoothly. Here I also wish you a prosperous New Year, family and friends in peace!

At the same time, the seventh day of the first lunar month is an important day – class! But I got to go to work on January 11 👀

Anyway, a long, long time ago (around the time pangu created the world 🌚), “🐦 wang” published WebGL Lighting, which introduced the basic concepts of parallel light/ambient light/point light/diffuse reflection/ambient reflection respectively, and set about implementing the above lighting and reflection examples using WebGL. This article introduces the fundamentals of optics from a different Angle and introduces some new concepts 🥸

Review old and learn new 😒

Illumination is an interdisciplinary subject of physics and mathematics, which contains complex knowledge of physics and mathematics. As the saying goes, “Time will explain everything, except math…” In order to avoid the reader master to turn over the previous article to consult the basic definition, the following will quickly again complex (gather) xi (point) a () time ()!

In graphics, reflected light is usually expressed as the sum of two components: one component is uniform and independent in direction, which is known as diffuse reflection; The other component is the direction-dependent component, the specular reflection. So the amount of reflected light reaching the camera is the sum of diffuse and specular light:


L r e f l e c t e d = L d i f f u s e + L s p e c u l a r (1) L_{reflected} = L_{diffuse} + L_{specular} \tag{1}

Diffuse reflection

Diffuse reflection is an “amorous” thing (as to whether reflection is a thing or not is another matter), which is embodied in “everyone wants, rain and dew”, that is, the diffuse surface brightness is the same from all directions. Purely diffuse materials are those that have the properties of Lambertian reflection; the amount of light reflected in this way depends only on the direction of incident light.

Lambert reflectance is the property that defines an ideal “matte” or diffuse surface. The apparent brightness of the Lambert surface to the observer is the same regardless of the observer’s point of view. Technically, the brightness of the surface is isotropic, and the intensity of the luminance conforms to Lambert’s law of cosines.

< Wikipedia – Lambertian Reflectance >

When the direction of incident light is perpendicular to the surface, the diffuse surface reflects the most light and decreases with the tilt of the normal vector of incident light to the surface. This change is modeled as the cosine of the Angle between the surface normal vector and the direction of incidence. So, the amount of light reflected on this surface LdiffuseL_{diffuse}Ldiffuse is determined by the following formula:


L d i f f u s e = L i n c i d e n t k d i f f u s e c o s Theta. (2) L_{diffuse} = L_{incident} k_{diffuse} cos\theta \tag{2}

LincidentL_{incident}Lincident is the amount of incident light, θ\thetaθ is the Angle of the incident light vector (i.e., the Angle between the normal vector NNN of the surface direction and LincidentL_{incident}Lincident); Kdiffusek_ {diffuse} Kdiffuse is a constant term indicating the surface diffuse reflectance. We learned in second grade that “the dot product of two unit vectors is the cosine between them,” so instead of cosθcos\thetacosθ :


c o s Theta. = N L i n c i d e n t (3) cos\theta = N \cdot L_{incident} \tag{3}

Then our formulas (2), (2) and (2) can be written as:


L d i f f u s e = L i n c i d e n t k d i f f u s e ( N L i n c i d e n t ) (4) L_{diffuse} = L_{incident} k_{diffuse} (N \cdot L_incident) \tag{4}

Specular reflection

The ideal mirror reflection is a “revenge will be avenged” thing, specific performance is “an eye for a tooth, an eye for an eye”, that is, the Angle of incidence and the Angle of reflection are the same. We use RRR to represent the reflection direction, so according to the geometry learned in the third grade of primary school, it can be concluded:


R = 2 N ( N L ) L R = 2N(N \cdot L) – L

A small experiment in physics class in junior high school can reflect the characteristics of mirror reflection: when a laser lamp is used to illuminate a smooth mirror, the Angle of reflection changes with the Angle of the laser lamp (that is, the incident Angle).

I remember clearly that this experiment was followed by another experiment: when a laser lamp was used to illuminate a cloudy liquid, the Angle of the light entering the liquid was found to be distorted at the surface of the liquid, a phenomenon we call refraction.

refraction

Reflect this thing, like Eason’s lyrics: “Transfer one person’s warmth to another’s chest.” The amount of refracted light depends entirely on the material properties of the surface it hits, and the direction of the light depends on the two materials (or media) in which the light travels and the material of the surface it hits. Snell’s law models this optical phenomenon and states:


eta 1 s i n Theta. 1 = eta 2 s i n Theta. 2 \eta_1 sin\theta_1 = \eta_2 sin\theta_2

η1\ eTA_1 η1 and η2\eta_2η2 are the refractive indices of material 111 and 222 respectively (the refractive index is a numerical characteristic of the speed at which light travels through the medium).

For more on Snell’s Law, see Wikipedia – Snell’s Law.

Seemingly profound, actually very simple 🤥

Having reviewed the basics, let’s take a look at three new friends, namely, irradiance, radiance and intensity. Before we meet our three new friends, we need to understand a little concept called radiation flux.

Radiation flux

The first thing to realize is that light is a flow of radiant energy, so the fundamental measurement of light is the radiant flux (usually represented as ϕ\phiϕ), which is the total amount of light that penetrates an area or volume. More radiation flux can be interpreted as more and brighter light.

If light flows evenly out of a surface, it means that all areas of the object appear to be equally bright. But for the most part, the flow of light isn’t uniform, meaning that for the most part, the brightness of different areas may look different. Not everything is rosy, maybe life is the same…

With uneven flow of light, we need to be more selective about the spatial and directional distribution of light. It is necessary to specify the exact region or direction, or preferably to define the density to specify the radiation flux per unit region (or direction). So we need the three new friends up there.

radiometric

To distinguish between light arriving at a surface and light leaving it, two different densities belonging to a given region are used: irradiance and EEE. Irradiance represents the amount of flux per unit area incident to a surface, and egress represents the flux leaving per unit area. They are represented as the ratio D ϕ/dAd\phi /dAd ϕ/dA. Thus, irradiance and emission are related to flux by the following equation:


d ϕ = E d A d\phi = E dA

D ϕd\phidϕ is the amount of flux reaching or leaving dAdAdA in a sufficiently small (differential) area. If the light is coming from a surface with nonuniform flux distribution, the light is represented primarily by the function E(x)E(x)E(x), where XXX represents points on the surface. For surfaces with uniform flux, irradiance is simply expressed as the ratio of total flux to surface area:


E = ϕ A E = \frac{\phi}{A}

12. The irradiance is in watts per square metre (W⋅m−2W \cdot m^{-2}W⋅m−2)

The intensity of

Intensity (III) is the directional density, which represents the flux per solid Angle emitted by a point around a direction. Solid Angle (ω\omegaω) indicates the conical direction from point XXX and the unit of solid Angle is sphericity (SrSrSr). If the area cut off by the cone on a sphere of radius RRR is R2r ^ 2R2, then the solid Angle measures 111 sphericity. The intensity related to flux is:


I = d ϕ d Omega. I = \frac{d\phi}{d\omega}

⋅Sr−1W \cdot Sr^{-1}W⋅Sr−1 According to the definition of sphericity, it can be said that a sphere oriented around a point corresponds to a solid Angle of 4π4 \pi4π sphericity. So the radiant flux emitted by a point light ϕ\phiϕ watts is distributed evenly around the point in all directions. The point light’s intensity ϕ/4πW⋅Sr−1\phi /4 \ PI W \cdot Sr^{-1}ϕ/4πW⋅Sr−1, This is because the surface area of a sphere of radius RRR is 4πr24 \ PI r^24πr2. The intensity of the light source may depend on the direction omega omega omega, in which case it will be expressed as the function I(omega)I(omega)I(ω).

Sphericity is defined in wikipedia – Sphericity

Radiation brightness

The flux leaving a surface can vary across the surface and along the direction. Hence the final introduction to luminance (LLL), which represents the surface from each unit projection area and the area to be projected along the direction of the radiation flow, so it is a dual density term, i.e. area density and direction density.

The projection region represents the region to be projected along the direction of the radiation flow. Depending on the orientation of the surface, the same projected area can refer to the actual surface area of different size regions. Thus, the flux of radiation leaving in one direction will vary depending on the direction of the flow, keeping the emittance the same. According to these relationships, it can be obtained:


L ( Omega. ) = d 2 ϕ d A an d Omega. = d 2 ϕ d A c o s Theta. d Omega. L(\omega) = \frac{d^2 \phi}{dA \bot d\omega} = \frac{d^2 \phi}{dA cos \theta d\omega}

⋅m−2⋅Sr−1W \cdot m^{-2} \cdot Sr^{-1}W⋅m−2⋅Sr−1 is the Angle between the surface normal vector and the light flow. The integral of the incident radiance of the hemisphere corresponding to irradiance should be:


E = Ω L ( Omega. ) c o s Theta. d Omega. E = \int_\Omega {L(\omega)} cos\theta {\rm d}\omega

Omega \Omega means hemisphere.

New Year’s weather 🌕

Driving back to Chengdu on the sixth day of the first lunar month, the road was really jammed! But the road is blocked, the heart is not blocked ~ go out early in the morning to find the sun is just emerging:

Qinchuan wang wang, sunrise is east peak. May you, like the rising sun, be thriving and full of vigor!

Welcome to pay attention to the public number: Refactor, reconstruction only to do a better yourself!