I am *Damix* and I welcome you to my website, *Tangent Space*! A blog about the theory and practice of computer graphics. I am a rendering engineer and I like to write programs that display pretty things: games, scientific visualizations, maps, and more. Few things are more exciting than coding a graphic rendering algorithm and then seeing it in action on screen. This is why I made a blog to share what I learn about this exciting area of software development. *– Damix*

# Recent Articles

# Writing Raw WebAssembly

WebAssembly is a binary instruction format for the web. It shipped in all major browsers and it is more than likely that it is going to be a game changer. High performance, CPU-bound apps such as games and digital content creation packages that would struggle to be performant in JavaScript have now a chance to be usable on the web.
WebAssembly is an intermediate instruction representation format, suitable to be a compile target for languages such as C, C++ and Rust.

read more
# The Angle Between Two Vectors

Let’s take two vectors \(\vec{a}\) and \(\vec{b}\) on the 2D plane and an orthonormal basis \((\vec{i}, \vec{j})\); we denote \(\mathcal{C}\) the application that maps a vertex to its coordinates. For some \(a, \alpha, b, \beta\) it must be true that:
$$ \mathcal{C}(\vec{a}) = [x_a, y_a] = [a~cos(\alpha), a~sin(\alpha)] \\
\mathcal{C}(\vec{b}) = [x_b, y_b] = [b~cos(\beta), b~sin(\beta)] $$
The sine of the oriented angle Now let us consider the oriented angle between \(\vec{a}\) and \(\vec{b}\); this is equal to \(\beta - \alpha\).

read more
# The TBN Matrix

Let \(p_1\), \(p_2\) and \(p_3\) be the vertices of a triangle in a 3D space \(S\), with texture coordinates \((u_1, v_1)\), \((u_2, v_2)\) and \((u_3, v_3)\) respectively. Vectors \(\vec{p_1 p_2}\) and \(\vec{p_1 p_3}\) lie in a plane \(P\). Let \((\vec{t}, \vec{b})\) be a base of \(P\). then, there must exist \(\alpha, \beta, \gamma, \delta\) such that:
$$ \vec{p_1 p_2} = \alpha \vec{t} + \beta \vec{b} $$
$$ \vec{p_1 p_3} = \gamma \vec{t} + \delta \vec{b} $$

read more