How to make chroma and Luminance gradient for ue4 triangle?

There are enough tutorials on how to make a triangle in the ue4 material editor.
But nothing similar about how to paint over this triangle with a gradient similar to chroma-luminance!
At the same time having the ability to change the hue of chroma.
Any ideas how to achieve this?


if you just want to replicate this look, this is how I’d go about it:

if you want to have something that’d be precise, then you’d need to jump into color space math and it gets a bit more complicated…


Thanks for such a quick response!
My triangle is equilateral and is in the center!
Can I somehow reduce and shift the gradient?

I imagine you’re manipulating the UVs to generate the triangle? If so, you can just reuse the R component of it in the color lerp, though it’s hard to say without seeing the rest of the graph!

I changed the triangle to match it with the gradient, and since my triangle rotates around the hue ring, I had to change its translation, scale, and pivot point. But interacting with the ring and the triangle, I will change their size and I will have to take into account all of the above in order for the triangle to rotate correctly!
I found a formula that allows to change the scale, offset and rotation of texture coordinates but when I connect a pin to your logic I get an error that I’m trying to connect different floats!

I combined the transformation logic with yours and tried to transform the gradient to fit the triangle placed in the center, but the result is very inaccurate compared to the triangle at the origin!

In general, after a couple of hours I achieved an acceptable result. The error is from 5 to 10% in some areas from 1 to 2%.
I guess that if I spend more time, I will achieve a result of 2-3% in the entire triangle!

Tell me please if you understand the code where in this example written in C # is the part that fills the triangle with the gradient I need, and is it possible to convert this code for the material editor?