17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-31 11:09:06 +01:00

Light the cab with the sun coming in through its windows

This commit is contained in:
2026-10-28 12:19:43 +01:00
parent 1447dcf075
commit e8a90507f0
28 changed files with 342 additions and 29 deletions

View File

@@ -1907,6 +1907,7 @@ global_settings::ConfigParse_gfx_sky( cParser &Parser, std::string_view const To
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.cab" ) { readvalue( gfx_postfx_ao_cab, 0.f, 1.f ); }
else if( Token == "gfx.postfx.ao.quality" ) {
// slices and steps per side
Parser.getTokens( 2, false );
@@ -1938,6 +1939,8 @@ global_settings::ConfigParse_gfx_sky( cParser &Parser, std::string_view const To
gfx_cabprobe_interval = std::clamp( gfx_cabprobe_interval, 1, 120 ); }
else if( Token == "gfx.cabprobe.bounce" ) { readvalue( gfx_cabprobe_bounce, 0.f, 4.f ); }
else if( Token == "gfx.cabprobe.reflections" ) { readswitch( gfx_cabprobe_reflections ); }
else if( Token == "gfx.cabprobe.sun" ) { readvalue( gfx_cabprobe_sun, 0.f, 4.f ); }
else if( Token == "gfx.interior.bounce" ) { readvalue( gfx_interior_bounce, 0.f, 1.f ); }
else if( Token == "gfx.skyvisibility" ) {
// no/low/medium/high, or the number of the level
Parser.getTokens( 1 );
@@ -2417,6 +2420,7 @@ global_settings::export_as_text( std::ostream &Output ) const {
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 );
export_as_text( Output, "gfx.postfx.ao.cab", gfx_postfx_ao_cab );
Output << "gfx.postfx.ao.quality " << gfx_postfx_ao_slices << " " << gfx_postfx_ao_steps << "\n";
export_as_text( Output, "gfx.postfx.ao.lighting", gfx_postfx_ao_lighting );
export_as_text( Output, "gfx.lights.scenery", gfx_lights_scenery );
@@ -2431,6 +2435,8 @@ global_settings::export_as_text( std::ostream &Output ) const {
export_as_text( Output, "gfx.cabprobe.interval", gfx_cabprobe_interval );
export_as_text( Output, "gfx.cabprobe.bounce", gfx_cabprobe_bounce );
export_as_text( Output, "gfx.cabprobe.reflections", gfx_cabprobe_reflections );
export_as_text( Output, "gfx.cabprobe.sun", gfx_cabprobe_sun );
export_as_text( Output, "gfx.interior.bounce", gfx_interior_bounce );
export_as_text( Output, "gfx.skyvisibility", std::string{ gfx_skyvisibility == 3 ? "high" : gfx_skyvisibility == 2 ? "medium" : gfx_skyvisibility == 1 ? "low" : "no" } );
export_as_text( Output, "gfx.skyvisibility.sun", gfx_skyvisibility_sun );
export_as_text( Output, "gfx.skyvisibility.fog", gfx_skyvisibility_fog );

View File

@@ -483,6 +483,7 @@ struct global_settings {
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 gfx_postfx_ao_cab { 0.5f }; // share of the occlusion the cab and the low poly interiors take, 1 = all of it
// with gfx_postfx_ao 2 (opengl 4.6 and vulkan): the occlusion is worked out from the depth of the scene drawn before its colour
// (which it turns on, see gfx_depthprepass_scene) and darkens the ambient light and the reflection of the surroundings in the
// shading, not the light of the sun and the lamps. false: it darkens the finished image, as before
@@ -508,6 +509,12 @@ struct global_settings {
int gfx_cabprobe_interval { 4 };
float gfx_cabprobe_bounce { 1.f };
bool gfx_cabprobe_reflections { true };
// the probe of the cab is lit by the sun (the moon) coming in through the windows too, so the light which bounces around the cab
// is the light of the sun where it falls in it; the scale of that light, 0 for none
float gfx_cabprobe_sun { 1.f };
// the light of the sun coming in through the windows of the low poly interiors of the vehicles and of the cab without its probe,
// bounced around them, as a share of the light of the sun on a surface facing it; 0 for none
float gfx_interior_bounce { 0.1f };
// the occlusion of the sky and of the sun by the scenery around the camera (opengl 4.6 and vulkan, gfx::sky_occlusion, the track T):
// tunnels, the ground under bridges and roofs, cuttings and the foot of slopes are dark by their geometry, worked out in the
// background from the scenery seen from above. 0 off (nothing is occluded), 1 low (256 m around the camera, texels of 1 m),