Multiplication for MVP matrices: Any benefits to doing so within the vertex shader?

Posted by Nick Wiggill on Game Development See other posts from Game Development or by Nick Wiggill
Published on 2012-07-06T20:08:36Z Indexed on 2012/07/06 21:25 UTC
Read the original article Hit count: 197

Filed under:
|
|
|

I'd like to understand under what circumstances (if any) it is worth doing MVP matrix multiplication inside a vertex shader.

The vertex shader is run once per vertex, and a single mesh typically contains many vertices. All MVP inputs remain the same for each vertex in the vertex batch relating to a given draw call (model). Surely then, you're always better off keeping the multiplications in the client code, such that you pass in the whole MVP precalculated as a uniform? (avoiding redundant ops between individual vertices)

© Game Development or respective owner

Related posts about opengl

Related posts about shaders