Vivamus interdum turpis tellus

regaegw efawefa efawfaw ewaf wae we faw fa. awe awe fwa fewfwaoiejf awoif jew fawjeo ;fjewf oiwejf ;owaf awe fawfa w? eaweo ijfawe fwef wa.f

1 Like

Lerp and Time##

Well, from the looks of the video… he is just changing the color value of the “fog” for his shader along with the lighting values.

for the transitions you could probably just set some palletted colors(blue, red, dark blue) and lerp between them for smoothness.

So it would involve:
float gameTime;
Color[] someColors;
float[] someTimingValuesCoordinatedWithTheColors;
Color returnColorThatIsActuallyWhatYouWant;

  1. normalize the gameTime to a [0.0f…1.0f] situation between two of the colors… (think 0% to 100% of your transition from first to second)

  2. javax.vecmath.Color3f might be the class to play with:

     Color3f color1 = new Color3f(new Color("#990000"));
     Color3f color2 = new Color3f(new Color("#55AAFF"));
     Color3f colorIWant;
     colorIWant.interpolate(color1, color2, normalizedTransitionValue);
    

So then, just convert it to whatever format you need to supply for your shader… or you can even write your own shader so that you can just send the appropriate values and let it handle the transitions. You will need to be proficient in OpenGL, though.

Hope this helps,
Charles

3 Likes

Haha, the “like” suffices.

and you can just alter the title of your first posting title “Sky color changing formula” to something like “Sky color changing formula (solved)” .

1 Like

http://javadoc.jmonkeyengine.org/com/jme3/math/ColorRGBA.html#interpolate(com.jme3.math.ColorRGBA,%20com.jme3.math.ColorRGBA,%20float)

1 Like