Graphics Reference
In-Depth Information
3
V
Managing Transformations
in Hierarchy
Bartosz Chodorowski and Wojciech Sterna
3.1 Introduction
One of the most fundamental aspects of 3D engine design is management of
spatial relationship between objects. The most intuitive way of handling this
issue is to organize objects in a tree structure (hierarchy), where each node stores
its local transformation, relative to its parent.
The most common way to define the local transformation is to use a so-
called TRS system (present in most modeling packages or game engines like in
[Technologies 05]), where the transformation is composed of translation, rotation,
and scale. 1 This system is very easy to use for both programmers using the engine
as well as non-technical users like level designers. In this chapter we describe the
theory behind such a system.
To render an object described with TRS, we need to determine the final world
matrix to pass it to the render system. We thus merge translation, rotation, and
scale into one local transformation matrix and combine it with local transforma-
tions of the node's ancestors to obtain the node's final world matrix.
One problem with the system (and any other that merges rotation and scale
components into a single matrix) is decomposition of a matrix back to TRS. It
turns out that this problem is often ill-defined and no robust solution exists. We
present an approximate solution that works reasonably well in the majority of
cases.
Finally, tightly related to decomposition is switching a node's parent. Usually,
after that operation has been performed, we would most likely want to retain the
global transformation of the node. This problem can be alleviated using the
presented decomposition algorithm.
1 As you will see later in this chapter's formulas, the term SRT would be more appropri-
ate (because we are using row-major notation). However, we decided to stick to TRS to be
consistent with [Technologies 05].
 
 
Search WWH ::




Custom Search