Convert between color spaces

How to convert SceneTexture:Input from one color space to another with custom convert matrix?

I have several matrices for different color spaces, and they work fine in OpenCV. It looks like:

cv::transform(img_RGB, img_lms, RGB_to_LMS);

So I want to make same stuff but in UnrealEngine. I saw “Custom” node in material blueprint, but dunno what syntax it uses and what functions it has.

The custom node uses HLSL syntax. As for what functions you have access to (apart from the basic HLSL functions), that is a bit harder, as you would have to dig into the unreal shader code to see what functions they made there.