# Inconsistent built-in matrices

**URL:** https://discussions.unity.com/t/inconsistent-built-in-matrices/422409
**Category:** Shaders & Materials
**Tags:** Shaders
**Created:** [September 6, 2010, 7:18pm UTC](https://discussions.unity.com/t/inconsistent-built-in-matrices/422409 "2010-09-06T19:18:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![multivac](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@multivac](https://discussions.unity.com/u/multivac)
#### Post date: [September 6, 2010, 7:18pm UTC](https://discussions.unity.com/t/inconsistent-built-in-matrices/422409/1 "2010-09-06T19:18:17Z")

</div>

Could someone who is more familiar with Unity explain how the MVP shader is constructed in the shader?  
Not only are the matrices constructed in script unusable in the shader,even built-in values in shaders don’t work. :?

I tried to construct the MVP matrix from the builtin glstate values like this,just to test it,but even this doesn’t work,the object just disappears ☹

```auto
float4x4 mvp =mul(glstate.matrix.modelview[0],glstate.matrix.projection);

```

shouldn’t it be identical to the glstate.matrix.mvp?  
I’d really appreciate it if Unity could provide some more documentation about values passed to the shader,possibly even allowing us to add more variables.

---

<div class="post-metadata">

### Author: ![Daniel-Brauer](https://avatars.discourse-cdn.com/v4/letter/d/f475e1/32.png) [@Daniel-Brauer](https://discussions.unity.com/u/Daniel-Brauer)
#### Post date: [September 6, 2010, 8:34pm UTC](https://discussions.unity.com/t/inconsistent-built-in-matrices/422409/2 "2010-09-06T20:34:08Z")

</div>

Matrices are left-multiplied onto vectors, so in your case the multiplication order should be:

```auto
MVP = P*MV

```

---

<div class="post-metadata">

### Author: ![multivac](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@multivac](https://discussions.unity.com/u/multivac)
#### Post date: [September 6, 2010, 9:55pm UTC](https://discussions.unity.com/t/inconsistent-built-in-matrices/422409/3 "2010-09-06T21:55:19Z")

</div>

Yeah,thats actually how it was originally,thought for a moment it might be other way around in the Cg,it still doesn’t work.
