greggman / hsva-unity

A Hue Saturation Value adjustment shader for Unity. Useful for making lots of character colors.
209 stars 32 forks source link

Can the hue value changed via script #1

Closed fugogugo closed 8 years ago

fugogugo commented 8 years ago

Hi , nice shader you have there!

I was just wondering if I can change the shader hue value on runtime to create dynamic color movements?

thank you

greggman commented 8 years ago

Yes of course. Something like this

    m_material = GetComponent<Renderer>().material;

    float hueAdjust = 0.5f;
    float satAdjust = 1.0f;
    float valueAdjust = 0.0f;
    m_material.SetVector("_HSVAAdjust", new Vector4(hueAdjust, satAdjust, valueAdjust, 0.0f));
fugogugo commented 8 years ago

Cool! thanks a lot this help me with my project!

anyway will this shader work well in mobile? I guess changing HSVA value is not a heavy performance if not abused right?

greggman commented 8 years ago

If you're trying to use it to draw your entire world it might be too slow. If you're just using it to draw a few characters I doubt it will be too slow