Download

HSV to RGB and back again

https://docs.unrealengine.com/latest/INT/BlueprintAPI/Math/Color/HSVToRGB_Vector_/index.html

I’m guessing this particular blueprint is only available to blueprints that aren’t actual shader blueprints. Which seems a little odd.

Has anyone made a colourspace material function for UE4? I’ve spent most of tonight setting one up but debugging it is quite a task.

The main reason there is no default material function for this is probably that it is actually quite expensive to do in a shader. However, I agree that it can be useful in special cases. I have made both HSV to RGB and RGB to HSV material functions a while back. You’ll can find them here.

Note that they are completely undocumented and unoptimized. If you want to actually use them in a production environment I would recommend you start by reducing the amount of branching going on inside the functions.

Nice! I think we must have followed the same example, except yours works. :slight_smile: This is what I ended up with:

For RGB/HSV conversions in a shader you should scratch the if nodes and use an implementation that is more suited for GPUs.
This one worked well for me: http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl

I looked at one just like this but I couldn’t figure out what vec4(c.bg, K.wz) does. It’s been a long time since I did any HLSL, is it the same as vec4(c.b, c.g, K.w, K.z)?

any way to have a functioning link, please?

@Arnage
@antidamage

is there a functioning link for the RGB to HSV?

I’m fairly certain I left a material function for RGB -> HSV -> RGB in Advanced Cel Shader that’s part of the permanently-free collection on the marketplace.