## Flow light effect

Today I found that the color dodge algorithm in Photoshop can be simplified: //let b = base color, c = mix color, then b + (b * c) / (1 - c) = b / (1 - c); This clearly tells us how the final color va …

## Line–plane intersection

Suppose we have a Line: P = P1 + tL and a plane: N • (P - P2) = 0 We can substitute P into the plane equation: N • (P1 + tL - P2) = 0 Solve for t: t = (N • (P2 - P1)) / (N • L) The point of intersection is: P = P1 + ((N • (P2 - …

## VXGI模拟1969年阿波罗11号登陆月球

Voxel Global Illumination 传统游戏中，所有间接光照（某一表面反射出来的光线）是预先计算的，存储于有光照贴图之称的纹理内。 光照贴图让游戏场景能够具备类似全局光照的效果，但是因为它们是预先计算的，所以只在静态物体上有效。 VXGI将一个 …

## D3DXQuaternionSlerp

D3DXQUATERNION * WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2, FLOAT t) { float s = 1.0f - t; float dot = D3DXQuaternionDot(pQ1, pQ2); if (dot < …

## Gram-Schmidt Orthonormalization

We can use it to find an orthonormal basis for Tangent, Bitangent and Normal: \begin{align} T &= T-\frac{(T \cdot N)N}{N \cdot N} \\ B &= B-\frac{(B \cdot N)N}{N \cdot N}-\frac{(B \cdot T)T}{T \cdot T} \end{align} If the …