Nick Wiggill

07-08-2012, 06:54 AM

The standard way to calculate mvp matrix is:

P*V*M * v1 = v2

In rendering my entity list, I would like to do something like the following:

(for those not involved in games, an "entity" is a "unit" in the game world, such as an enemy or ally, the mapping typically being one entity to one (animated) mesh)

update()

create camera matrix

create view matrix as inverse of camera matrix

precalculate combined pv matrix

for each entity

m * pv //as opposed to m * p * v if no precalc of pv

make draw call

...Since this would result in one less matrix mul() per-entity, per-update -- leading to a fair saving when there are hundreds of entities active. Just not sure this is possible (mathematically) since then the matrix multiplication order p * v * m is duffed. Is there a way to do this, mathematically?

P*V*M * v1 = v2

In rendering my entity list, I would like to do something like the following:

(for those not involved in games, an "entity" is a "unit" in the game world, such as an enemy or ally, the mapping typically being one entity to one (animated) mesh)

update()

create camera matrix

create view matrix as inverse of camera matrix

precalculate combined pv matrix

for each entity

m * pv //as opposed to m * p * v if no precalc of pv

make draw call

...Since this would result in one less matrix mul() per-entity, per-update -- leading to a fair saving when there are hundreds of entities active. Just not sure this is possible (mathematically) since then the matrix multiplication order p * v * m is duffed. Is there a way to do this, mathematically?