# 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)$. Jul 3, 2020 at 15:22
• Thanks for the information Jul 3, 2020 at 19:56
• But usually it is projectionmatrix * viewmatrix * positionvector Jul 5, 2020 at 18:44