Jump to content
Sign in to follow this  
logix1390

Changing Color components

Recommended Posts

I have a bit of an interesting problem which I thought was going to be easy

I have one of Houdini's pictures loaded in : Mandril.pic

I want to change only the red areas to whatever color I want. 

I know there is the hue shift and color correct nodes... but that will hue shift all the colors at the same time.

How do I only Hue shift the red channel to change it to whatever color i want???

vector to float >float to vector doesn't seem to work for this situation ...probably because Cd.x is not a vector...

This is driving me a little crazy... I will attach my scene file with my attempted methods.

Thank you

change_color_component.hipnc

Share this post


Link to post
Share on other sites
Posted (edited)

In a point wrangle create an amount parameter (line 1) and convert the color values to HSV (line 2). Choose a range within the hue spectrum that is supposed to change (line 3). Multiply it by the amount and add the result to the hue component of the HSV color (line 4). Convert the color vector back to RGB (line 5).

float amount = chf('hue_shift');
vector col_hsv = rgbtohsv(v@Cd);
float range = chramp('mask_by_hue', col_hsv.x);
col_hsv.x += amount * range;
v@Cd = hsvtorgb(col_hsv);

change_color_component2.hipnc

Edited by konstantin magnus

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×