Dont like blue sky!

Hi, I’m using SkyControl for my game. How can I change the color of the sky? I’ve tried all kinds of things and just can’t find a method for it. When I asked Chatgpt, he started to invent some methods for me that don’t even exist. That’s why I’m asking in a forum. a nostalgic moment!

1 Like

In SkyControl, the color of unclouded daytime sky defaults to (0.4, 0.6, 1). You can override this default by altering the colorDay field of the control. There’s no public accessor (sorry about that!) so use reflection.

For instance, to set colorDay field to (0.4, 1, 0.6), you might do:

        Field colorDayField;
        try {
            colorDayField = SkyControl.class.getDeclaredField("colorDay");
        } catch (NoSuchFieldException exception) {
            throw new RuntimeException(exception);
        }
        colorDayField.setAccessible(true);

        ColorRGBA colorDay;
        try {
            colorDay = (ColorRGBA) colorDayField.get(skyControl);
        } catch (IllegalAccessException exception) {
            throw new RuntimeException(exception);
        }
        colorDay.set(0.4f, 1f, 0.6f, 1f);

An alternative approach would be to use SkyMaterial directly, instead of managing the material via SkyControl. But then you’d have to configure all the material parameters yourself…

Or you could fork the SkyControl repo and modify the source code as desired…

2 Likes

I’ll add an accessor to the next release of SkyControl.

4 Likes

SkyControl v1.1.0 was released today:

repositories {
    mavenCentral()
}
dependencies {
    implementation("com.github.stephengold:SkyControl:1.1.0")
}
12 Likes