I'd like to write a pixel shader that takes an input image, and converts all of the colors of one Hue range (i.e. HSV) into another Hue Range.
My motivation is simple: I want to color a bunch of different textures differently, but i don't want to color the entire texture, just the portion with a hue in a specific range. That way, I can draw one image of a racing car, and then change the color of just the stripes and the logo on the car with a pixel shader.
I looked at the HLSL documentation online and couldn't find anything to deal with hues. Is there a library of HLSL code available online?
Here's some pseudocode for what i'm trying to accomplish:
external float SrcMinHue,SrcMaxHue,TargetMin
void changeHues(image source)
{
foreach x,y in image:
{
float sourceHue = getHue(source,x,y)
if (SrcMinHue < sourceHue < SrcNaxHue):
setHue(source,x,y,(TargetMin + (sourceHue - MinHue))
}
}
I'm working with XNA Game Studio, if that information matters to anyone.