UNITY_MATRIX_T_MV Does not scale correctly

For example. Create 2 planes, scale all set to 1. With one of them , use a shader that does
vertex = mul(UNITY_MATRIX_T_MV, vertex).

And now scale both to 10 or something. Notice how they are completely different sizes?

What’s up with that. Any ideas on how to correct this

What are you using UNITY_MATRIX_T_MV for? That particular matrix has a rather limited use case, almost exclusively used calculating object space light directions with vertex lighting. If it’s being used for calculating the position of the vertices to render on screen then you’re probably using the wrong matrix.

Yeh, I am using it to create a billboard. And it makes the job super easy, but doesn’t scale correctly. I had problems using the other matrix options they would not billboard the correct directions and whatnot

It doesn’t scale correctly because it’s the wrong matrix to use. The “T” part means “transposed”, which is another word for reordered. It’s useful for some things, and as you noticed will billboard an unscaled quad, but it’ll completely break down will scaling as you’ve seen as it is not actually the matrix you want, just close enough.

I don’t believe any of the matrices Unity provides will do what you want, which is why every billboard shader out there constructs a new matrix in the shader from the UNITY_MATRIX_MV matrix.

It could also be done by applying the scale and position separately by extracting then from the MV matrix, and that can be fairly cheap if you can make sure you never rotate the quads’ game objects from 0,0,0.

Dang it. Thanks for the info.