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 - …
2017-02-13 Comments
One dimension: \[ G(x) = \frac{1}{\sqrt{2\pi \sigma^2}} e^{-\frac{x^2}{2\sigma^2}} \] Two dimensions: \[ G(x, y) = \frac{1}{2\pi \sigma^2} e^{-\frac{x^2 + y^2}{2\sigma^2}} \] This is because: \[ I(t)  = \int_{-t}^{t} e^{-x^2}dx …
2016-10-10 Comments
In Clifford algebra all units forms a group, so we can construct a unit dual-quaternion from two quaternions q and t where q is a unit rotation quaternion and t is a pure quaternion representing the translation: \[ d = (1 + \fra …
2016-07-09 3 comments
We can compute a rotation matrix \( R \in SO(3) \) from an angle \(\theta\) and axis \(l\) (unit vector) \[ R = I + \sin(\theta)C + (1-\cos \theta)C^2 \] where \(C\) is the antisymmetric matrix: \[ C = \begin{bmatrix} 0 & -l …
2016-07-08 Comments
A Cardinal spline( sometimes called Canonical spline )consists of a sequence of curves. Consider a single Cardinal segment: \[ F(u) = C_0 + uC_1 + u^2C_2 + u^3C_3 \] Suppose it starts at \(F(0) = P_i\) and ends at \(F(1)=P_{i+1} …
2016-06-22 Comments
Sometimes we need only a subset of the vertices in a mesh to be animated without a full skeleton, such as a set of mouth shapes or face vertices for facial animation. A easy way to do this is using Morph Target Animation. In thi …
Compared with the Sobel Operator which use 8 points, the Roberts Operator use only 4 points to compute the gradient magnitude.  The first order derivative represents the directional derivative: \[ G_x = \begin{bmatrix} -1 & …
2016-03-09 Comments
This is an improved Sobel operator mainly used in edge detection. It uses 3x3 convolution matrix to compute the gradient in the x-direction (\(G_x\)) and y-direction (\(G_y\)): \[ G_x = \begin{bmatrix} -1 & 0 & 1\\ -\sqr …
2016-02-19 Comments
Voxel Global Illumination 传统游戏中,所有间接光照(某一表面反射出来的光线)是预先计算的,存储于有光照贴图之称的纹理内。光照贴图让游戏场景能够具备类似全局光照的效果,但是因为它们是预先计算的,所以只在静态物体上有效。VXGI将一个场 …
2015-04-14 Comments
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 < …
We can use it to find an orthonormal basis for Tangent, Bitangent and Normal ( Vector3 ): \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{a …
☆.  Rotation about the x, y, z axis \begin{align} R_x(\theta) &= \begin{bmatrix} 1 & 0 & 0\\ 0 & \cos\theta & -\sin\theta\\ 0 & \sin\theta & \cos\theta \end{bmatrix} = exp \left (\theta \begin{bmatrix …
2010-07-15 Comments
一: 数学中的n维欧氏空间的切空间定义为:如果k维曲面S在点x0∈S的邻域内能用k个独立参数t1,t2, ... , tk给出的光滑映射t→x即(t1,t2,...,tk)→(x1,x2,...,xn)给出,x0=x(0)且矩阵x'(0)的秩为k,那么称在n维欧 氏空间中用矩阵形式的参数方 …