Order of Matrix multipliation and its effect on transformations

One thing that I stuggle regularily with, is the order in which matrices should be multiplied to achieve a specific result. So I decided to get this clear for myself for good and all.

As you know, matrices (at least in our context of 3D graphics) represent transformations. Multiple transformation matrices can be combined using marix multiplication. But since this operation is not commutative, the order of the multiplication is important.

Since matrices represent transformations, they build new coordinate systems, too: These new systems are defined by axis vectors that have been transformed using the matrix. An example will clarify this fact:

In the examples used in this post, I will use a rotation matrix around 30 degrees, because \sin(30^\circ) = \frac{1}{2} and \cos(30^\circ) = \sqrt{\frac{3}{4}}, which is easy to write down and we still stay exact when calculating with it.

Part 1: A single transformation matrix

Given the origin system with the axis vectors \left(\begin{array}{c}1 \\ 0 \\ 0 \end{array}\right) and \left(\begin{array}{c}0 \\ 1 \\ 0 \end{array}\right), when we rotate these vectors around 30 degrees, we get the vectors \left(\begin{array}{c}\sqrt{\frac{3}{4}} \\ \frac{1}{2} \\ 0 \end{array}\right) and \left(\begin{array}{c}-\frac{1}{2} \\ \sqrt{\frac{3}{4}} \\ 0 \end{array}\right)
Continue reading

Game-Tutorial 2 – Eingabeverarbeitung

Screenshot des Beispielprogramms

Screenshot des Beispielprogramms

Dieses Tutorial behandelt die folgenden Themen:

  • Das Abfragen von Tastatur- und der Maus-Events
  • Spielgerechtes Analysieren und verwenden der Eingabe-Events
  • Eine in Ego-Shootern typische Steuerung wird erläutert und implementiert

Das Ziel des Tutorials ist zu zeigen wie Tastatur und Maus abgefragt werden können und wie mit diesen Ereignissen eine in Ego-Shootern typische Steuerung implementiert werden kann.

Continue reading

Game-Tutorial 1 – Die Game Loop

Dieses Tutorial behandelt die folgenden Themen:

  • Die Initialisierung der Grafik und des Fensters
  • Die Hauptschleife (Game Loop) des Spiels
  • Das Timing und die Messung der FPS (Frames-per-Second)

Dieses Tutorials wird zeigen wie die grundlegende Struktur eines Spiels aussieht. Es wird erläutert warum Spiele so aufgebaut werden, welche Vor- und Nachteile dies hat und auch welche Konsequenzen sich für die Entwicklung des Spiels hierdurch ergeben.

Continue reading

Installation von Eclipse mit JOGL-Unterstützung

Damit ihr die in den Kursen enthaltenen Beispiele direkt selbst ausprobieren könnt, benötigt ihr eine Eclipse-Installation mit einem Projekt in dem JOGL eingebunden ist.

Das Zielverzeichnis

Überlegt euch einen Ordner in dem ihr alles speichern möchtet das zu den Programmierkursen gehört – ich empfehle einen Ordner im Heimatverzeichnis. Für Windows XP zum Beispiel C:/Dokumente und Einstellungen/BENUTZERNAME/Eigene Dateien/kurse_3dcoding. Oder für Vista C:/Benutzer/BENUTZERNAME/kurse_3dcoding.

Continue reading

Skinning Part 1

Skinning is a technique to animate 3D models. The principle is related to reality where bones are moved by muscles and therefore moving the skin covering the body. In 3D graphics, we don’t need the muscles – we just animate the bones and since the mesh, which is the skin in this case, is attached to the bones, it moves and acts as the bones move:

The principle of skinning

The principle of skinning

Continue reading