Archive | graphics RSS feed for this section

Optimization tip: faster 2D transforms

18 May

Drop the last column

A 2D transform is typically shown as a 3×3 augmented matrix. However the last column (or row depending which order you use) of an augmented matrix is always 0 0 1, so we don’t need to store it. We only store a 2×3 matrix.

\begin{bmatrix} a & b \\ c & d \\ e & f \end{bmatrix}

The 2 upper rows will contain the rotation, scale and shear factors, while the lower row contains the translation.
Continue reading

Advertisements

Shadow mapping for isometric games

14 Dec

General shadow mapping

Shadow mapping is one of the possible methods for rendering the shadows in a 3D scene when using a rasterizer. It uses one extra pass (in the simplest case of one light) to render a shadow map which is used in the color pass to test whether a point falls inside or outside the shadow. The shadow map is basically a depth buffer rendered from the standpoint of the light. This means that it tells us how far the light can reach. If the light can’t see a point because it is obscured (the point’s depth is further than the depth in the map) it lies in the shadow. Continue reading