# Matrix conversion using Blueprints

**URL:** <https://forums.unrealengine.com/t/matrix-conversion-using-blueprints/694382>\
**Category:** International\
**Tags:** unreal-engine, UE5-0, question\
**Created:** [November 19, 2022, 1:45pm UTC](https://forums.unrealengine.com/t/matrix-conversion-using-blueprints/694382 "2022-11-19T13:45:44Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ridderhaspels](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ridderhaspels](https://forums.unrealengine.com/u/Ridderhaspels)\
**Post date:** [November 19, 2022, 1:45pm UTC](https://forums.unrealengine.com/t/matrix-conversion-using-blueprints/694382/1 "2022-11-19T13:45:44Z")

</div>

Hi,

I was wondering if it’s possible to do a matrix conversion of an XYZ color value to an sRGB value? I can’t find any info to it in the documentation or online or don’t use the correct search terms 😉  
The matrix is the following:  
3.2404542 -1.5371385 -0.4985314  
-0.9692660 1.8760108 0.0415560  
0.0556434 -0.2040259 1.0572252

Thanks in advance

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [November 19, 2022, 1:51pm UTC](https://forums.unrealengine.com/t/matrix-conversion-using-blueprints/694382/2 "2022-11-19T13:51:04Z")

</div>

Where are you getting the XYZ from, is it a variable?

---

<div class="post-metadata">

**Author:** ![Ridderhaspels](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ridderhaspels](https://forums.unrealengine.com/u/Ridderhaspels)\
**Post date:** [November 19, 2022, 1:55pm UTC](https://forums.unrealengine.com/t/matrix-conversion-using-blueprints/694382/3 "2022-11-19T13:55:31Z")

</div>

Hi,

Yes a variable I look up from as CSV file.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [November 19, 2022, 2:01pm UTC](https://forums.unrealengine.com/t/matrix-conversion-using-blueprints/694382/4 "2022-11-19T14:01:19Z")

</div>

What variable type are you reading it into?

---

<div class="post-metadata">

**Author:** ![Ridderhaspels](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ridderhaspels](https://forums.unrealengine.com/u/Ridderhaspels)\
**Post date:** [November 19, 2022, 5:38pm UTC](https://forums.unrealengine.com/t/matrix-conversion-using-blueprints/694382/5 "2022-11-19T17:38:38Z")

</div>

The XYZ value is a vec3 and converts into a vec3 RGB by the matrix. Then use the RGB value to change a color of a light.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [November 19, 2022, 7:09pm UTC](https://forums.unrealengine.com/t/matrix-conversion-using-blueprints/694382/6 "2022-11-19T19:09:45Z")

</div>

Something like this?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/f/3/df31ab6d8571e505922b2918c2b9dfb10719e9e5.png)

---

<div class="post-metadata">

**Author:** ![Ridderhaspels](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ridderhaspels](https://forums.unrealengine.com/u/Ridderhaspels)\
**Post date:** [November 20, 2022, 12:01pm UTC](https://forums.unrealengine.com/t/matrix-conversion-using-blueprints/694382/7 "2022-11-20T12:01:04Z")

</div>

Hi,

Thanks so much for the setup. Apologies if I wasn’t clear, but I want to do the Matrix calculation in the Blueprint and I get the XYZ value from the CSV file. The proces is like described here: [0.31www.brucelindbloom.com/index.html?ColorCalculator.html](http://0.31www.brucelindbloom.com/index.html?ColorCalculator.html) Or here with the use of code: [sRGB↔XYZ conversion — mina86.com](https://mina86.com/2019/srgb-xyz-conversion/)  
The process would be:

1. Data lookup from CSV file for XYZ value
2. Do matrix conversion on the XYZ value to get the sRGB value.
3. Use the converted sRGB value to change the color of a light.

Hope this clarifies the question.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [November 20, 2022, 12:10pm UTC](https://forums.unrealengine.com/t/matrix-conversion-using-blueprints/694382/8 "2022-11-20T12:10:55Z")

</div>

Unless you’re using a plugin ( or C++ ), I think you need a data table to read CSV input.

Then you can do any computations you need, here

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/d/5/8d591eee2ceb7f2e14a167d81e4add1b273353a5.png)

Then, a light can be set with the linear color.

---

<div class="post-metadata">

**Author:** ![Ridderhaspels](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ridderhaspels](https://forums.unrealengine.com/u/Ridderhaspels)\
**Post date:** [November 20, 2022, 12:16pm UTC](https://forums.unrealengine.com/t/matrix-conversion-using-blueprints/694382/9 "2022-11-20T12:16:46Z")

</div>

But do you know of a way to the matrix computations in the blueprint without having to create a lot of multiply, add and minus nodes? A matrix conversion is something that happens a lot in Graphics and hoped there would be an easier way of doing the computation 🙂

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [November 20, 2022, 12:27pm UTC](https://forums.unrealengine.com/t/matrix-conversion-using-blueprints/694382/10 "2022-11-20T12:27:43Z")

</div>

I think you just need to write a function 🙂

---

<div class="post-metadata">

**Author:** ![Ridderhaspels](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ridderhaspels](https://forums.unrealengine.com/u/Ridderhaspels)\
**Post date:** [November 20, 2022, 2:48pm UTC](https://forums.unrealengine.com/t/matrix-conversion-using-blueprints/694382/11 "2022-11-20T14:48:48Z")

</div>

Haha, alright 🙂

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/4/9/c499760cad69810de056646b9a866ec3b5e47bc0.png)
