From 000b8656cc7bcf9371bfb114d656f21db738f3f1 Mon Sep 17 00:00:00 2001 From: maj00r Date: Wed, 14 Oct 2026 16:55:43 +0200 Subject: [PATCH] fix(render): dark parts of a cab and of the running gear are no longer crushed to black, as the AgX look raises its contrast power from 1.0 in the shadows up to 1.6 only from the middle tones on, which keeps the bright tones, the outside view and the night as they were but leaves black knobs, levers and lettering visible on a black desk; the light of a cab can be scaled with gfx.cab.ambient, 1.0 by default --- rendering/opengl33renderer.cpp | 2 ++ shaders/tonemapping.glsl | 2 +- utilities/Globals.cpp | 6 ++++++ utilities/Globals.h | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/rendering/opengl33renderer.cpp b/rendering/opengl33renderer.cpp index d20454c3..9eaf615e 100644 --- a/rendering/opengl33renderer.cpp +++ b/rendering/opengl33renderer.cpp @@ -3939,6 +3939,8 @@ bool opengl33_renderer::Render_cab(TDynamicObject const *Dynamic, float const Li } auto const old_ambient { light_ubs.ambient }; + light_ubs.ambient *= Global.gfx_cab_ambient; + light_ubo->update( light_ubs ); auto const luminance { Global.fLuminance * ( Dynamic->fShade > 0.0f ? Dynamic->fShade : 1.0f ) }; if( Lightlevel > 0.f ) { // crude way to light the cabin, until we have something more complete in place diff --git a/shaders/tonemapping.glsl b/shaders/tonemapping.glsl index 863fe0fe..13798b42 100644 --- a/shaders/tonemapping.glsl +++ b/shaders/tonemapping.glsl @@ -109,7 +109,7 @@ vec3 AgxLook(vec3 val) vec3 offset = vec3(0.0); vec3 slope = vec3(1.0); - vec3 power = vec3(1.6); + vec3 power = mix(vec3(1.0), vec3(1.6), smoothstep(0.0, 0.4, luma)); float sat = 0.9; #if AGX_LOOK == 1 diff --git a/utilities/Globals.cpp b/utilities/Globals.cpp index b4f2e14b..a18234af 100644 --- a/utilities/Globals.cpp +++ b/utilities/Globals.cpp @@ -1335,6 +1335,11 @@ global_settings::ConfigParse_gfx( cParser &Parser, std::string_view const Token Parser.getTokens(); Parser >> RenderCabShadowsRange; } + else if (Token == "gfx.cab.ambient") + { + Parser.getTokens(); + Parser >> gfx_cab_ambient; + } else if (Token == "gfx.smoke") { // smoke visualization toggle @@ -1600,6 +1605,7 @@ global_settings::export_as_text( std::ostream &Output ) const { << shadowtune.range << " " << 0 << "\n"; export_as_text( Output, "gfx.shadows.cab.range", RenderCabShadowsRange ); + export_as_text( Output, "gfx.cab.ambient", gfx_cab_ambient ); export_as_text( Output, "gfx.smoke", Smoke ); export_as_text( Output, "gfx.smoke.fidelity", SmokeFidelity ); export_as_text( Output, "smoothtraction", bSmoothTraction ); diff --git a/utilities/Globals.h b/utilities/Globals.h index ad216cd9..caf8af21 100644 --- a/utilities/Globals.h +++ b/utilities/Globals.h @@ -159,6 +159,7 @@ struct global_settings { bool RenderShadows{ true }; bool applicationQuitOrder{false}; int RenderCabShadowsRange{ 0 }; + float gfx_cab_ambient{ 1.0f }; struct shadowtune_t { unsigned int map_size{ 2048 }; float range{ 250.f };