# Is FMatrix 4x3? Where's the 4x4 matrix?

**URL:** <https://forums.unrealengine.com/t/is-fmatrix-4x3-wheres-the-4x4-matrix/376131>\
**Category:** C++\
**Tags:** matrix, unreal-engine, question, CPP\
**Created:** [November 12, 2016, 6:51pm UTC](https://forums.unrealengine.com/t/is-fmatrix-4x3-wheres-the-4x4-matrix/376131 "2016-11-12T18:51:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_c8cdff6f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c8cdff6f](https://forums.unrealengine.com/u/anonymous_user_c8cdff6f)\
**Post date:** [November 12, 2016, 6:51pm UTC](https://forums.unrealengine.com/t/is-fmatrix-4x3-wheres-the-4x4-matrix/376131/1 "2016-11-12T18:51:41Z")

</div>

So I was trying to do some matrix math today in Unreal and noticed that [in the docs](https://docs.unrealengine.com/latest/INT/API/Runtime/Core/Math/FMatrix/) it states that `FMatrix` is 4x4, but the constructor overloads only work with `FVector` (and not `FVector4`)?! So what kind of matrix type has **four** rows of **vector3** ’s?! Seriously I want to know what the use of it is.

What’s the UE4 way of making a 4x4 matrix? Should I just say screw it and use my own float[4][4]?

PS: I want a UE struct for a float4x4 that I can send to a shader via `DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER`

---

<div class="post-metadata">

**Author:** ![Gildor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gildor](https://forums.unrealengine.com/u/Gildor)\
**Post date:** [November 13, 2016, 12:48pm UTC](https://forums.unrealengine.com/t/is-fmatrix-4x3-wheres-the-4x4-matrix/376131/2 "2016-11-13T12:48:14Z")

</div>

There’s a constructor  
FMatrix::FMatrix(const FPlane& InX,const FPlane& InY,const FPlane& InZ,const FPlane& InW)  
FPlane is nearly the same as FVector4, and there’s a constructor which builds FPlane from FVector4 etc.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c8cdff6f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c8cdff6f](https://forums.unrealengine.com/u/anonymous_user_c8cdff6f)\
**Post date:** [November 13, 2016, 4:40pm UTC](https://forums.unrealengine.com/t/is-fmatrix-4x3-wheres-the-4x4-matrix/376131/3 "2016-11-13T16:40:48Z")

</div>

Thanks! I can confirm that FMatrix set this way to 4x4, works when sent to a hlsl shader via `DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER()`.  
Really strange that the same matrix data struct has weirdly specific different sizes. And this whole FMatrix and FPlane vs FVector4 is just bad programming UX. 😛

---

<div class="post-metadata">

**Author:** ![Kalevi\_Toivanen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kalevi\_Toivanen](https://forums.unrealengine.com/u/Kalevi_Toivanen)\
**Post date:** [August 7, 2024, 6:17pm UTC](https://forums.unrealengine.com/t/is-fmatrix-4x3-wheres-the-4x4-matrix/376131/4 "2024-08-07T18:17:44Z")

</div>

I think the reason FMatrix wants four FVector3’s is because you use them to build a matrix transform. IE: first column is vector i of the transform, second column j, third k, and then the fourth column would be the translation. Since FVector3’s got fed into the columns, the 4x4 matrice’s last row will be blank, because it’s not needed for representing a transformation.

Take that with a grain of salt though. Haven’t tested it yet myself.
