# where does UE pass the main camera's view matrix to shaders

**URL:** <https://forums.unrealengine.com/t/where-does-ue-pass-the-main-cameras-view-matrix-to-shaders/1430107>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [November 28, 2023, 11:47pm UTC](https://forums.unrealengine.com/t/where-does-ue-pass-the-main-cameras-view-matrix-to-shaders/1430107 "2023-11-28T23:47:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anning5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anning5](https://forums.unrealengine.com/u/Anning5)\
**Post date:** [November 28, 2023, 11:47pm UTC](https://forums.unrealengine.com/t/where-does-ue-pass-the-main-cameras-view-matrix-to-shaders/1430107/1 "2023-11-28T23:47:46Z")

</div>

Hi guys, could you let me know in the c++ end where UE passes the main camera’s view matrix to shaders please? much appreciated!

---

<div class="post-metadata">

**Author:** ![NoirMiller](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NoirMiller](https://forums.unrealengine.com/u/NoirMiller)\
**Post date:** [November 29, 2023, 12:05am UTC](https://forums.unrealengine.com/t/where-does-ue-pass-the-main-cameras-view-matrix-to-shaders/1430107/2 "2023-11-29T00:05:13Z")

</div>

Hi! I am not a pro in this theme, but when I wanted to do something with my camera view in shader, I passed the matrix from the blueprint (GetViewProjectionMatrix) to the shader like 4 vector4 parameters and did stuff with it

Good luck!

---

<div class="post-metadata">

**Author:** ![Anning5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anning5](https://forums.unrealengine.com/u/Anning5)\
**Post date:** [November 29, 2023, 12:29am UTC](https://forums.unrealengine.com/t/where-does-ue-pass-the-main-cameras-view-matrix-to-shaders/1430107/3 "2023-11-29T00:29:33Z")

</div>

Thanks @NoirMiller, I need to modify the main camera’s view matrix on the c++ end instead of in the shader for a specific VR feature. Changing the view matrix in the shader is too expensive as it will mean changing every shader

---

<div class="post-metadata">

**Author:** ![NoirMiller](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NoirMiller](https://forums.unrealengine.com/u/NoirMiller)\
**Post date:** [November 29, 2023, 12:33am UTC](https://forums.unrealengine.com/t/where-does-ue-pass-the-main-cameras-view-matrix-to-shaders/1430107/4 "2023-11-29T00:33:09Z")

</div>

Maybe you should try to look up to CameraManager.h and you could also try this one: [Howto modify the projection matrix - #5 by hurricane86](https://forums.unrealengine.com/t/howto-modify-the-projection-matrix/287457/5)

---

<div class="post-metadata">

**Author:** ![NoirMiller](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NoirMiller](https://forums.unrealengine.com/u/NoirMiller)\
**Post date:** [November 29, 2023, 12:34am UTC](https://forums.unrealengine.com/t/where-does-ue-pass-the-main-cameras-view-matrix-to-shaders/1430107/5 "2023-11-29T00:34:33Z")

</div>

What about this? [https://youtu.be/JjrtV8s3hT4](https://youtu.be/JjrtV8s3hT4)
