Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for desaturation as poor man's season support #502

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hotbso
Copy link
Contributor

@hotbso hotbso commented Mar 20, 2024

Orthophotos are mostly created at summer time and that looks very strange in other seasons, e.g. a winter sky and bare trees on top of summer orthos. Looking what others tried to achieve (e.g. "season" products for MSFS with grey or brown filters on top of the scenery, "X-Plane Map Enhancement" ) I came to the conclusion that just desaturation of orthos adds greatly to the immersion.

E.g. in Germany mid of March vegetation is still very dormant and a desaturation to 55% makes everything look very natural.

I added desaturation to the core and a slider in the GUI to select saturation in %.
Note that contrary to "X-Plane Map Enhancement" desaturation is done just before delivering data to X-Plane so cached data is not affected.

@zodiac1214
Copy link

@hotbso can we make it read insim season an automatically adjust color? I am going to pull yours in my Mac fork

@hotbso
Copy link
Contributor Author

hotbso commented Mar 31, 2024

I'm afraid reading insim season is not possible as this is coded in the .dsf files. There is no way of retrieving this at runtime.

@zodiac1214
Copy link

I'm afraid reading insim season is not possible as this is coded in the .dsf files. There is no way of retrieving this at runtime.

wasn't the flight tracking via UDP? we can maybe get the sim time somehow and dynamically calc your luma params? and pass those luma param to aoimage_desaturate?

so something like this:

AOIAPI int32_t aoimage_desaturate(aoimage_t *img, float luma_parm1, float luma_parm2, float luma_parm3) {
    assert(img->channels == 4);

    int len = img->width * img->height * 4;
    for (uint8_t *ptr = img->ptr; ptr < img->ptr + len; ptr += 4) {
        float luma = luma_param1 * ptr[0] + luma_param2 * ptr[1] + luma_param3 * ptr[2];
        float x = (1.0f - saturation) * luma;
        ptr[0] = (uint8_t)(saturation * ptr[0] + x);
        ptr[1] = (uint8_t)(saturation * ptr[1] + x);
        ptr[2] = (uint8_t)(saturation * ptr[2] + x);
    }

    return TRUE;
}

@zodiac1214
Copy link

image oh boy, with desaturate set to 10, this looks so real. depression winter in Canada lol

@hotbso
Copy link
Contributor Author

hotbso commented Apr 1, 2024

wasn't the flight tracking via UDP?

Getting lat/lon of present position is not a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants