HSV to RGB

For some reason, UE4 ships with a RGBtoHSV node, but not an HSVtoRGB node.

I have no idea why – it’s not exactly complex to do, and they provide a HueShift, a Desaturation node and brightness is a simple multiplier (what’s worse is that they have a node to do this in Blueprint, but not in Material Graph).

Like myself, you may want a node that does this if you want to do HSV adjustments outside of HueShift and Desaturation logic.

It looks as though someone attempted a go. I mean… there’s some logic in the RGBtoHSV node… but yeah, it doesn’t work:

What even is this?

Thing is, this sort of colour space conversion is really well documented and explained the world-over. But not always in a manner accessible to non-shadery types.

Here is a prime example:
http://www.chilliant.com/rgb2hsv.html

Fantastic resource (and what I used), but how does someone unfamiliar with HLSL actually make use of this? Answer: they don’t, not without a little bit of help – and so here is some help 🙂

I hope that’s easier to understand!

That’s a material function that takes in a Vector3 representing HSV values, and outputs a new Vector3 representing RGB values.

So now, you can use the existing RGBtoHSV node, make your HSV adjustments and feed them back into the function above and get RGB values back.

Have fun!

Leave a Reply

Your email address will not be published. Required fields are marked *