mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-03 13:10:23 +01:00
Fix the screen space ambient occlusion and add ground truth ambient occlusion to the GL 4.6 renderer
This commit is contained in:
@@ -1578,6 +1578,21 @@ 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.ao" ) {
|
||||
// yes/gtao: ground truth ambient occlusion, ssao: the older one, anything else: off
|
||||
Parser.getTokens( 1 );
|
||||
std::string mode;
|
||||
Parser >> mode;
|
||||
gfx_postfx_ao = ( mode == "yes" || mode == "true" || mode == "1" || mode == "gtao" ) ? 2 : ( mode == "ssao" ) ? 1 : 0; }
|
||||
else if( Token == "gfx.postfx.ao.radius" ) { readvalue( gfx_postfx_ao_radius, 0.1f, 10.f ); }
|
||||
else if( Token == "gfx.postfx.ao.strength" ) { readvalue( gfx_postfx_ao_strength, 0.f, 4.f ); }
|
||||
else if( Token == "gfx.postfx.ao.bounce" ) { readvalue( gfx_postfx_ao_bounce, 0.f, 1.f ); }
|
||||
else if( Token == "gfx.postfx.ao.quality" ) {
|
||||
// slices and steps per side
|
||||
Parser.getTokens( 2, false );
|
||||
Parser >> gfx_postfx_ao_slices >> gfx_postfx_ao_steps;
|
||||
gfx_postfx_ao_slices = std::clamp( gfx_postfx_ao_slices, 1, 8 );
|
||||
gfx_postfx_ao_steps = std::clamp( gfx_postfx_ao_steps, 1, 16 ); }
|
||||
else { return false; }
|
||||
|
||||
return true;
|
||||
@@ -1839,6 +1854,11 @@ 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.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 );
|
||||
export_as_text( Output, "gfx.postfx.ao.bounce", gfx_postfx_ao_bounce );
|
||||
Output << "gfx.postfx.ao.quality " << gfx_postfx_ao_slices << " " << gfx_postfx_ao_steps << "\n";
|
||||
export_as_text( Output, "python.enabled", python_enabled );
|
||||
export_as_text( Output, "python.threadedupload", python_threadedupload );
|
||||
export_as_text( Output, "python.uploadmain", python_uploadmain );
|
||||
|
||||
@@ -324,6 +324,14 @@ 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
|
||||
// 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 };
|
||||
float gfx_postfx_ao_radius { 1.5f }; // reach of the occluders, metres
|
||||
float gfx_postfx_ao_strength { 1.f }; // power the occlusion is raised to, 1 = as computed, 0 = none
|
||||
float gfx_postfx_ao_bounce { 0.3f }; // albedo of the surfaces assumed for the light coming back after more bounces
|
||||
int gfx_postfx_ao_slices { 3 }; // directions searched around each pixel
|
||||
int gfx_postfx_ao_steps { 4 }; // samples on each side of a direction
|
||||
|
||||
float ui_fontsize = 13.0f;
|
||||
float ui_scale = 1.0f;
|
||||
@@ -333,7 +341,6 @@ struct global_settings {
|
||||
|
||||
std::string exec_on_exit;
|
||||
std::string prepend_scn;
|
||||
bool gfx_postfx_ssao_enabled {false};
|
||||
|
||||
struct extraviewport_config {
|
||||
std::string monitor;
|
||||
@@ -398,7 +405,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*)
|
||||
// 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*)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user