3D relative to absolute transformations

I am trying to create a scene graph for my 3D game in which all object transformations refer to its parent. Each node of the graphic has a rotation, scaling and translation vector.

What is the correct way to combine relative transformation matrices to obtain an absolute transform of an object? I would be happy if you could also explain your decision.


Here is an example to do it WRONG:
It actually turned out to be a solution:

Matrix GetAbsoluteTransformation()
{
    if (!this.IsRoot())
    {
        return this.Transformation * this.Parent.GetAbsoluteTransformation();
    }
    else
    {
        return this.Transformation;
    }
}

In this case, when the parent node rotates, scales, or moves, the child is converted to the same amount, which is the correct behavior! But the child will rotate only by its origin and does not move by parental origin.


Application:

. . , . , . , - .

. , , .

+5
3

", ", , . , . .

: , . , - . , " ", , , . , ?

. , y z. , " ", - . . , , , ( , ), .

. ! , , . , ( google ) . , , , !:-D

+3

, .

, - , . , .

, , , .

: ?

+1

, OpenGL Direct3D. OpenGL , Direct3D . , , -.

OpenGL, . , , , , , . , .

: , . ( Direct3D). , , , , .

+1

All Articles