Example #1
0
    Color[] NewSet()
    {
        float CenterColorH = Random.value * 360;
        float CenterColorS = 1 - (Mathf.Pow(Random.value, 2));
        float CenterColorV = 1 - (Mathf.Pow(Random.value, 2));


        float r = Random.Range(-1, 1) * 2 + 1;          // -1 or 1

        float MainColorH = CenterColorH + 180 + (r * initialHueAngle);
        float MainColorS = Mathf.Lerp(CenterColorS, Random.value, randomValueToSV);
        float MainColorV = Mathf.Lerp(CenterColorV, Random.value, randomValueToSV);

        float SkyColorH = CenterColorH + 180 + (r * initialHueAngle * -1);
        float SkyColorS = Mathf.Lerp(CenterColorS, Random.value, randomValueToSV);
        float SkyColorV = Mathf.Lerp(CenterColorV, Random.value, randomValueToSV);

        // picking gradients
        float CenterColor2H = Mathf.Lerp(CenterColorH, MainColorH, gradientReach * 1.5f);
        float CenterColor2S = Mathf.Lerp(CenterColorS, MainColorS, gradientReach * 1.5f);
        float CenterColor2V = Mathf.Lerp(CenterColorV, MainColorV, gradientReach * 1.5f);

        float MainColor2H = Mathf.Lerp(MainColorH, CenterColorH, gradientReach);
        float MainColor2S = Mathf.Lerp(MainColorS, CenterColorS, gradientReach);
        float MainColor2V = Mathf.Lerp(MainColorV, CenterColorV, gradientReach);

        float SkyColor2H = Mathf.Lerp(SkyColorH, CenterColorH, gradientReach);
        float SkyColor2S = Mathf.Lerp(SkyColorS, CenterColorS, gradientReach);
        float SkyColor2V = Mathf.Lerp(SkyColorV, CenterColorV, gradientReach);

        // creating colors
        Color CenterColor  = HSVConverter.Convert(CenterColorH, CenterColorS, CenterColorV);
        Color CenterColor1 = HSVConverter.Convert(mid(CenterColor2H, CenterColorH), mid(CenterColor2S, CenterColorS), mid(CenterColor2V, CenterColorV));
        Color CenterColor2 = HSVConverter.Convert(CenterColor2H, CenterColor2S, CenterColor2V);

        Color MainColor  = HSVConverter.Convert(MainColorH, MainColorS, MainColorV);
        Color MainColor1 = HSVConverter.Convert(mid(MainColor2H, MainColorH), mid(MainColor2S, MainColorS), mid(MainColor2V, MainColorV));
        Color MainColor2 = HSVConverter.Convert(MainColor2H, MainColor2S, MainColor2V);

        Color SkyColor  = HSVConverter.Convert(SkyColorH, SkyColorS, SkyColorV);
        Color SkyColor1 = HSVConverter.Convert(mid(SkyColor2H, SkyColorH), mid(SkyColor2S, SkyColorS), mid(SkyColor2V, SkyColorV));
        Color SkyColor2 = HSVConverter.Convert(SkyColor2H, SkyColor2S, SkyColor2V);

        // experiment with the order here ?
        Color[] cs = { CenterColor, CenterColor1, CenterColor2, MainColor, MainColor1, MainColor2, SkyColor, SkyColor1, SkyColor2 };

        // Randomising them a bit for imperfections
        for (int i = 0; i < 6; i++)
        {
            cs [i] = Randomise(cs [i], randomisationValue);
        }

        //DisplayPalette (cs);

        return(cs);
    }
Example #2
0
    void UpdateSky()
    {
        float r = sky.GetFloat("_Rotation");

        r += Time.deltaTime * 0.5f;
        sky.SetFloat("_Rotation", r);

        float s = Mathf.Sin(Time.realtimeSinceStartup * 0.05f) * 0.5f + 0.8f;

        sky.SetFloat("_Exposure", s);

        // also have sky change tint
        Color c = hsv.Convert(Time.realtimeSinceStartup * 0.6f, 1, 0.69f);

        sky.SetColor("_Tint", c);
    }
Example #3
0
    void Update()
    {
        transform.localPosition += Vector3.forward * Input.GetAxis("Horizontal") * 0.3f * Time.deltaTime;
        transform.localPosition += Vector3.up * Input.GetAxis("Vertical") * 0.3f * Time.deltaTime;
        rota.eulerAngles        += Vector3.right * Input.GetAxis("Page") * 5f * Time.deltaTime;

        float r = sky.GetFloat("_Rotation");

        r += Time.deltaTime * 0.5f;
        sky.SetFloat("_Rotation", r);

        float s = Mathf.Sin(Time.realtimeSinceStartup * 0.05f) * 0.5f + 0.8f;

        sky.SetFloat("_Exposure", s);

        // also have sky change tint
        Color c = hsv.Convert(Time.realtimeSinceStartup * 0.6f, 1, 0.69f);

        sky.SetColor("_Tint", c);
    }