<p>As the title says, you are able to compose the ViewMatrix and the ProjectionMatrix into one instead of multiplying a vector by the individual matrices.</p>
<p>Instead of doing this at run time for each item:
Vector * ViewMatrix -&gt; Vector ProjectionMatrix</p>
<p>Do this at the start:
ViewMatrix * ProjectionMatrix -&gt; ComposedMatrix</p>
<p>Then when drawing vectors:
Vector * ComposedMatrix</p>
<p>This would minimize the number of necessary matrix multiplications. Is there any reason not to do this?</p>

CC BY-SA 4.0
2020-07-03T15:22:43.687Z
Yes, that's what people do. Matrix multiplication is (theoretically) associative, so $((vA)B)C = v(ABC)$.
lightxbulb
CC BY-SA 4.0
2020-07-05T18:44:52.050Z
But usually it is projectionmatrix * viewmatrix * positionvector
Thomas
<matrix>
Compose ViewMatrix and ProjectionMatrix
Nixcc
# Compose ViewMatrix and ProjectionMatrix

(Asked by: username_0 on 2020-07-03)

As the title says, you are able to compose the ViewMatrix and the ProjectionMatrix into one instead of multiplying a vector by the individual matrices.

Instead of doing this at run time for each item:
Vector \* ViewMatrix -> Vector ProjectionMatrix

Do this at the start:
ViewMatrix \* ProjectionMatrix -> ComposedMatrix

Then when drawing vectors:
Vector \* ComposedMatrix

This would minimize the number of necessary matrix multiplications. Is there any reason not to do this?

**Tags:** matrix

> **Comments:**
> **username_1**: Yes, that's what people do. Matrix multiplication is (theoretically) associative, so $((vA)B)C = v(ABC)$.  
> **username_2**: But usually it is projectionmatrix * viewmatrix * positionvector  

---

## 0 answers

