Hi, I just started to learn shader and what I would like to do is changing the HUE value of an image.
Does anyone know how to do it?
I did found some articles/tutorials talk about HUE but I don’t really understand it. I was looking for an easy way to change the HUE value.
But I found it very slow because first I need to convert my RGB to HUE then adjust the HUE and lastly convert it back to RGB.
I’ll be making it to run on mobile device so I was looking for better/faster methods.
Actually my scenario is like this:
I was trying to do an effect in games.
Because I wanted to have different colors for different characters, so I asked my artist to give me one default color then later on I can modify the HUE in codes to get different color without using different set of textures.
I’m not sure is there any other better way for me to achieve what I want.
That doesn’t answer the question. Why do you need color values to be represented using the HSV color space? Why don’t you have your artist specify the colors in RGB directly?
Do you specify the color programmatically or with pre-determined values, i.e. do you change the color based on some runtime calculation or do you know all the possible colors at compile time?
Yea, I will know all the possible colors at compile time because each characters will have their own color and it will be preset by us.
Just that I need to change the color during runtime because once the player selects different characters, I have to change the color of that texture as well.
Reason why I need to change the Hue value is because I need to maintain the glowing, gradient effects… that’s what my artist told me.
I did try to modify the RGB value end up it goes very weird, like something tinted on top of the color.
I did try with grayscale image first then only set the RGB value, the result doesn’t look as good as adjusting the Hue only.
basically if I put it in Photoshop, I just need to adjust the HUE value
I assume you are using a hue/saturation/lightness layers to do this. That is a different technique to just modifying a colour in a texture. Think about how you will modify the colour if you don’t use layers.
It is a bit more costly but you could do a hue layer type modify to the texutre, then render all the characters with this texture, modfiy the texture again and render the next set of characters.