#ifdef useHSVMapping
    // Official HSV to RGB conversion 
    vec3 hsv2rgb( in vec3 c )
    {
        vec3 rgb = clamp( abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0, 0.0, 1.0 );

        return c.z * mix( vec3(1.0), rgb, c.y);
    }

    // Smooth HSV to RGB conversion 
    vec3 hsv2rgb_smooth( in vec3 c )
    {
        vec3 rgb = clamp( abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0, 0.0, 1.0 );

        rgb = rgb*rgb*(3.0-2.0*rgb); // cubic smoothing	

        return c.z * mix( vec3(1.0), rgb, c.y);
    }

    vec3 rgb2hsv_2(vec3 c){
        vec4 K=vec4(0.,-1./3.,2./3.,-1.),
            p=mix(vec4(c.bg ,K.wz),vec4(c.gb,K.xy ),step(c.b,c.g)),
            q=mix(vec4(p.xyw,c.r ),vec4(c.r ,p.yzx),step(p.x,c.r));
        float d=q.x-min(q.w,q.y),
            e=1e-10;
        return vec3(abs(q.z+(q.w-q.y)/(6.*d+e)),d/(q.x+e),q.x);
    }
    
    uniform vec3 hsvValues;
#endif