Matrix conversion using Blueprints

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 :wink:
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

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

Hi,

Yes a variable I look up from as CSV file.

What variable type are you reading it into?

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.

Something like this?

1 Like

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 Or here with the use of code: sRGB↔XYZ conversion — mina86.com
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.

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

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

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 :slight_smile:

I think you just need to write a function :slight_smile:

Haha, alright :slight_smile:

1 Like