# Compose ViewMatrix and ProjectionMatrix

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?

• Yes, that's what people do. Matrix multiplication is (theoretically) associative, so $((vA)B)C = v(ABC)$. – lightxbulb Jul 3 '20 at 15:22
• Thanks for the information – Nixcc Jul 3 '20 at 19:56
• But usually it is projectionmatrix * viewmatrix * positionvector – Thomas Jul 5 '20 at 18:44