17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-07 00:22:56 +01:00

Replace cubemap scenery reflections with SSR, add Vulkan ray traced reflections

This commit is contained in:
2026-10-25 13:54:49 +01:00
parent 89f11895fc
commit f20b1a3071
45 changed files with 2725 additions and 174 deletions

View File

@@ -1888,6 +1888,20 @@ global_settings::ConfigParse_gfx_sky( cParser &Parser, std::string_view const To
0; }
else if( Token == "gfx.contactshadows.length" ) { readvalue( gfx_contactshadows_length, 0.05f, 5.f ); }
else if( Token == "gfx.contactshadows.range" ) { readvalue( gfx_contactshadows_range, 1.f, 1000.f ); }
else if( Token == "gfx.ssr" ) {
// no/low/medium/high, or the number of the level
Parser.getTokens( 1 );
std::string level;
Parser >> level;
gfx_ssr =
( level == "low" || level == "1" ) ? 1 :
( level == "medium" || level == "yes" || level == "true" || level == "2" ) ? 2 :
( level == "high" || level == "3" ) ? 3 :
0; }
else if( Token == "gfx.ssr.range" ) { readvalue( gfx_ssr_range, 10.f, 2000.f ); }
else if( Token == "gfx.ssr.roughness" ) { readvalue( gfx_ssr_roughness, 0.f, 1.f ); }
else if( Token == "gfx.raytracing" ) { readswitch( gfx_raytracing ); }
else if( Token == "gfx.raytracing.range" ) { readvalue( gfx_raytracing_range, 10.f, 5000.f ); }
else if( Token == "gfx.fog" ) {
// volumetric (yes) or analytic (no, old): the same weather either way
Parser.getTokens( 1 );
@@ -2272,6 +2286,11 @@ global_settings::export_as_text( std::ostream &Output ) const {
export_as_text( Output, "gfx.contactshadows", std::string{ gfx_contactshadows == 3 ? "high" : gfx_contactshadows == 2 ? "medium" : gfx_contactshadows == 1 ? "low" : "no" } );
export_as_text( Output, "gfx.contactshadows.length", gfx_contactshadows_length );
export_as_text( Output, "gfx.contactshadows.range", gfx_contactshadows_range );
export_as_text( Output, "gfx.ssr", std::string{ gfx_ssr == 3 ? "high" : gfx_ssr == 2 ? "medium" : gfx_ssr == 1 ? "low" : "no" } );
export_as_text( Output, "gfx.ssr.range", gfx_ssr_range );
export_as_text( Output, "gfx.ssr.roughness", gfx_ssr_roughness );
export_as_text( Output, "gfx.raytracing", gfx_raytracing );
export_as_text( Output, "gfx.raytracing.range", gfx_raytracing_range );
export_as_text( Output, "gfx.fog", std::string{ gfx_fog == 1 ? "volumetric" : "analytic" } );
export_as_text( Output, "gfx.fog.quality", std::string{ gfx_fog_quality == 1 ? "low" : gfx_fog_quality == 3 ? "high" : gfx_fog_quality == 4 ? "ultra" : "medium" } );
export_as_text( Output, "gfx.fog.range", gfx_fog_range );

View File

@@ -166,8 +166,11 @@ struct global_settings {
float range{ 250.f };
} shadowtune;
struct reflectiontune_t {
// how often the environment map (the sky and the clouds around the camera, the reflection of what the screen space
// reflections and the ray tracing don't find) is drawn anew
double update_interval{ 300.0 };
int fidelity{ 0 }; // 0: sections, 1: +static models, 2: +vehicles
// what the ray traced reflections of the vulkan renderer hold (gfx.raytracing): 0: sections, 1: +static models, 2: +vehicles
int fidelity{ 2 };
float range_instances{ 750.f };
float range_vehicles{ 250.f };
} reflectiontune;
@@ -466,6 +469,18 @@ struct global_settings {
int gfx_contactshadows { 0 };
float gfx_contactshadows_length { 0.5f };
float gfx_contactshadows_range { 50.f };
// screen space reflections of the opengl 4.6 and vulkan renderers, in place of the scenery in the environment map: the
// reflection of a surface traced through the depth of the scene drawn before its colour (which they turn on, see
// gfx_depthprepass_scene) and taken from the image of the last frame; where the screen doesn't hold it, the environment map
// (the sky) or the ray tracing. 0 none, 1 low, 2 medium, 3 high (steps of the rays); the longest ray, metres, and the
// roughest surface they're traced for (perceptual roughness, rougher ones reflect the environment map)
int gfx_ssr { 2 };
float gfx_ssr_range { 250.f };
float gfx_ssr_roughness { 0.6f };
// (vulkan) ray traced reflections where the screen space ones find nothing, on a gpu with ray queries: the scenery within
// the range, metres, as gfx.reflections.fidelity says. taken at the start
bool gfx_raytracing { false };
float gfx_raytracing_range { 500.f };
// weather of the opengl 4.6 renderer (debug window "Weather"); the weather itself comes from the scenery, see
// environment/weather.h. fog: 1 volumetric (a volume over the view with the shafts of the sun, the shadows of the clouds and
// the light of lamps and headlights, worked out along the ray past it), 0 analytic (the same fog along the ray only, the way