17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-02 02:19:13 +01:00

Take the ambient occlusion into the lighting and add a probe of the cab

This commit is contained in:
2026-10-27 13:23:52 +01:00
parent ac0b4e5f15
commit 9dde5b0e5e
43 changed files with 2402 additions and 45 deletions

View File

@@ -1893,6 +1893,7 @@ global_settings::ConfigParse_gfx_sky( cParser &Parser, std::string_view const To
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 if( Token == "gfx.postfx.ao.lighting" ) { readswitch( gfx_postfx_ao_lighting ); }
else if( Token == "gfx.lights.scenery" ) { readswitch( gfx_lights_scenery ); }
else if( Token == "gfx.lights.vehicles" ) { readswitch( gfx_lights_vehicles ); }
else if( Token == "gfx.lights.headlights" ) { readswitch( gfx_lights_headlights ); }
@@ -1901,6 +1902,22 @@ global_settings::ConfigParse_gfx_sky( cParser &Parser, std::string_view const To
else if( Token == "gfx.lights.compartment.intensity" ) { readvalue( gfx_lights_compartment_intensity, 0.f, 100.f ); }
else if( Token == "gfx.lights.cab.intensity" ) { readvalue( gfx_lights_cab_intensity, 0.f, 100.f ); }
else if( Token == "gfx.lights.cab.bounce" ) { readvalue( gfx_lights_cab_bounce, 0.f, 1.f ); }
else if( Token == "gfx.cabprobe" ) {
// no/low/medium/high, or the number of the level
Parser.getTokens( 1 );
std::string level;
Parser >> level;
gfx_cabprobe =
( level == "low" || level == "1" ) ? 1 :
( level == "medium" || level == "yes" || level == "true" || level == "2" ) ? 2 :
( level == "high" || level == "3" ) ? 3 :
0; }
else if( Token == "gfx.cabprobe.interval" ) {
Parser.getTokens( 1 );
Parser >> gfx_cabprobe_interval;
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.lights.range" ) { readvalue( gfx_lights_range, 0.f, 2000.f ); }
else if( Token == "gfx.lights.shadows" ) {
// no/low/medium/high, or the number of the level
@@ -2364,6 +2381,7 @@ global_settings::export_as_text( std::ostream &Output ) const {
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, "gfx.postfx.ao.lighting", gfx_postfx_ao_lighting );
export_as_text( Output, "gfx.lights.scenery", gfx_lights_scenery );
export_as_text( Output, "gfx.lights.vehicles", gfx_lights_vehicles );
export_as_text( Output, "gfx.lights.headlights", gfx_lights_headlights );
@@ -2372,6 +2390,10 @@ global_settings::export_as_text( std::ostream &Output ) const {
export_as_text( Output, "gfx.lights.compartment.intensity", gfx_lights_compartment_intensity );
export_as_text( Output, "gfx.lights.cab.intensity", gfx_lights_cab_intensity );
export_as_text( Output, "gfx.lights.cab.bounce", gfx_lights_cab_bounce );
export_as_text( Output, "gfx.cabprobe", std::string{ gfx_cabprobe == 3 ? "high" : gfx_cabprobe == 2 ? "medium" : gfx_cabprobe == 1 ? "low" : "no" } );
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.lights.range", gfx_lights_range );
export_as_text( Output, "gfx.lights.shadows", std::string{ gfx_lights_shadows == 3 ? "high" : gfx_lights_shadows == 2 ? "medium" : gfx_lights_shadows == 1 ? "low" : "no" } );
export_as_text( Output, "gfx.lights.shadows.lamps", gfx_lights_shadows_lamps );

View File

@@ -472,6 +472,10 @@ 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
// 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
bool gfx_postfx_ao_lighting { true };
// local lights of the opengl 4.6 renderer, besides the sun and the vehicle headlights (debug window "Light clusters").
// they go through the light clusters, so they need gfx_lights_clustered
bool gfx_lights_scenery { true }; // light points (freespot lights) of scenery models light their surroundings
@@ -484,6 +488,15 @@ struct global_settings {
float gfx_lights_compartment_intensity { 1.f }; // brightness of the light of a lit vehicle compartment
float gfx_lights_cab_intensity { 1.5f }; // brightness of the cab lamp
float gfx_lights_cab_bounce { 0.3f }; // share of the former ambient light of the cab lamp kept, for the light which bounces around the cab
// the probe of the occupied cab (opengl 4.6 and vulkan, gfx::cab_probe): cube maps of the cab lit by its lamp (and what glows in
// it) and of its albedo, drawn every few frames: the light of the lamp bounces around the cab from it (in place of
// gfx_lights_cab_bounce) and the cab reflects itself in its glasses and glossy parts. 0 off, 1 low, 2 medium, 3 high (faces of
// 64, 128, 256 pixels); the frames between its updates, the share of the reflected light which lights the cab again, and
// whether the cab reflects itself (where the screen space reflections don't find it) instead of the sky
int gfx_cabprobe { 2 };
int gfx_cabprobe_interval { 4 };
float gfx_cabprobe_bounce { 1.f };
bool gfx_cabprobe_reflections { true };
float gfx_lights_range { 300.f }; // distance from the camera the lights of models and vehicles are taken from, metres
// shadows of the lamps (cube shadow maps), 0 none, 1 low, 2 medium, 3 high; see opengl46_local_shadows. for now the lamp of the
// occupied cab, its shadows cast by the cab