Let's take a look at classic 3D rendering techniques that have been around for ages. These are very simplified models so that they can be computed on less powerful computers compared to today's standards, but they are easy to learn for that very reason. And depending on what you want to make, the techniques on this page are still very useful.

昔から使われている古典的な3Dレンダリングの手法を見てみましょう。今から見れば性能が低いコンピュータでも計算できるようにかなり単純化されていますが、その分とりつき安いと思います。また作りたい物によってはこのページのテクニックも十分現役で役に立ちます。

Specular Reflection

スペキュラー(鏡面反射)

First, let’s look at the specular component. To simplify the discussion, we will use a point light source illuminating a plastic sphere.

まずはスペキュラー成分についてみてみましょう。話を単純にするために点光源でプラスチックの球体を照らす場合を考えます。

Light reflects so that the angle of incidence is the same as the angle of reflection. Since the surface of the plastic is not perfectly smooth and has fine bumps, the reflected light will actually be a little scattered.

光は入射角と反射角が同じになるように反射します。プラスチックの表面は完全に滑らかではなく細かな凸凹があるので、反射光は実際には少し散らばることになるでしょう。

https://codepen.io/kynd/pen/BaOOyBY

Consider a vector ($\vec{h}$) that lies halfway between the light source direction ($\vec{l}$) and the viewpoint direction ($\vec{v}$), as observed from a point on the object's surface. By examining its relationship with the normal vector ($\vec{n}$), which represents the surface orientation, we can determine whether the reflected light is directed towards the eye. (We could calculate the direction of the reflected light, but this makes it simpler).

物体の表面のある一点から見た光源の方向($\vec{l}$))と視点の方向($\vec{v}$)の中間に当たるベクトル($\vec{h}$)を考えて見ましょう。このベクトルと法線($\vec{n}$)、つまり表面の向きを表すベクトルとの関係を調べると、反射光が目の向きに進んでいるかを調べることができます(反射光の向きを計算しても良いのですがこの方が簡単です)。

$Specular = (\hat{h} \cdot \hat{n})^{s}$

Screenshot 2023-02-24 at 12.38.22 PM.png

The inner product of $\vec{h}$ and $\vec{n}$ represents how much they are aligned. $\vec{h}$ and $\vec{n}$ have to be normalized beforehand. The larger the exponent($s$), the smaller the highlight becomes. $s$ is often called smoothness or shininess, but it is rather a parameter for adjusting the appearance of the image rather than a physical quantity.

まず $\vec{h}$ と $\vec{n}$ の内積を取って向きがどれくらい揃っているかを調べます。$\vec{h}$ と $\vec{n}$ は計算の前に正規化します。冪乗の値 $s$ を変えるとハイライトの大きさが変化します。$s$ は滑らかさ(smoothness)や光沢(shininess)などと呼ばれますが、物理的な量というよりは見た目をそれっぽく調整するためのパラメータだと考えたほうが良いでしょう。