autoortho
autoortho copied to clipboard
Add support for desaturation as poor man's season support
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.
@hotbso can we make it read insim season an automatically adjust color? I am going to pull yours in my Mac fork
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.
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;
}
wasn't the flight tracking via UDP?
Getting lat/lon of present position is not a problem.