17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-31 05:20:52 +01:00

Add a white balance to the tonemapping

This commit is contained in:
2026-10-27 01:40:19 +01:00
parent 82d3842495
commit ac0b4e5f15
13 changed files with 122 additions and 6 deletions

View File

@@ -1875,6 +1875,9 @@ global_settings::ConfigParse_gfx_sky( cParser &Parser, std::string_view const To
else if( Token == "gfx.postfx.bloom" ) { readswitch( gfx_postfx_bloom ); }
else if( Token == "gfx.postfx.bloom.intensity" ) { readvalue( gfx_postfx_bloom_intensity, 0.f, 1.f ); }
else if( Token == "gfx.postfx.bloom.threshold" ) { readvalue( gfx_postfx_bloom_threshold, 0.f, 1000.f ); }
else if( Token == "gfx.postfx.whitebalance" ) { readswitch( gfx_postfx_whitebalance ); }
else if( Token == "gfx.postfx.whitebalance.temperature" ) { readvalue( gfx_postfx_whitebalance_temperature, 4000.f, 25000.f ); }
else if( Token == "gfx.postfx.whitebalance.tint" ) { readvalue( gfx_postfx_whitebalance_tint, -1.f, 1.f ); }
else if( Token == "gfx.postfx.ao" ) {
// yes/gtao: ground truth ambient occlusion, ssao: the older one, anything else: off
Parser.getTokens( 1 );
@@ -2353,6 +2356,9 @@ global_settings::export_as_text( std::ostream &Output ) const {
export_as_text( Output, "gfx.postfx.bloom", gfx_postfx_bloom );
export_as_text( Output, "gfx.postfx.bloom.intensity", gfx_postfx_bloom_intensity );
export_as_text( Output, "gfx.postfx.bloom.threshold", gfx_postfx_bloom_threshold );
export_as_text( Output, "gfx.postfx.whitebalance", gfx_postfx_whitebalance );
export_as_text( Output, "gfx.postfx.whitebalance.temperature", gfx_postfx_whitebalance_temperature );
export_as_text( Output, "gfx.postfx.whitebalance.tint", gfx_postfx_whitebalance_tint );
export_as_text( Output, "gfx.postfx.ao", std::string{ gfx_postfx_ao == 2 ? "gtao" : gfx_postfx_ao == 1 ? "ssao" : "no" } );
export_as_text( Output, "gfx.postfx.ao.radius", gfx_postfx_ao_radius );
export_as_text( Output, "gfx.postfx.ao.strength", gfx_postfx_ao_strength );

View File

@@ -461,6 +461,9 @@ struct global_settings {
bool gfx_postfx_bloom { true }; // glow around bright parts of the image
float gfx_postfx_bloom_intensity { 0.04f }; // share of the blurred image in the result
float gfx_postfx_bloom_threshold { 0.f }; // luminance below which nothing glows, 0 = everything contributes
bool gfx_postfx_whitebalance { true }; // white balance of the camera, applied to the image before the tonemapping
float gfx_postfx_whitebalance_temperature { 7500.f }; // colour temperature of the light taken as white, K; 6500 = none, more = warmer image
float gfx_postfx_whitebalance_tint { 0.f }; // -1..1, shift off the daylight locus: + magenta image, - green image
// screen space ambient occlusion of the opengl 4.6 renderer, applied to the image (debug window "Sky and exposure").
// 0 off, 1 the older ssao, 2 ground truth ambient occlusion; when 0 at the start the targets are not made at all
int gfx_postfx_ao { 2 };
@@ -617,7 +620,7 @@ struct global_settings {
bool ConfigParseHardware(cParser& Parser, const std::string& token);
bool ConfigParseDebug(cParser& Parser, const std::string& token);
bool ConfigParse_gfx( cParser &parser, std::string_view const Token );
// sky light and exposure switches of the opengl 4.6 renderer (gfx.ambient.*, gfx.envmap.ggx, gfx.atmosphere*, gfx.postfx.autoexposure*, gfx.postfx.bloom*, gfx.postfx.ao*)
// sky light and exposure switches of the opengl 4.6 renderer (gfx.ambient.*, gfx.envmap.ggx, gfx.atmosphere*, gfx.postfx.autoexposure*, gfx.postfx.bloom*, gfx.postfx.whitebalance*, gfx.postfx.ao*)
bool ConfigParse_gfx_sky( cParser &parser, std::string_view const Token );
// sends basic content of the class in legacy (text) format to provided stream
void