From c81e0b743341a18707c05ea73693dbb50414d4f5 Mon Sep 17 00:00:00 2001 From: lhofhansl Date: Thu, 15 Feb 2024 08:25:33 -0800 Subject: [PATCH] Allow shaders with disabled post processing pipeline (#14338) - Allow disabling of the post processing pipeline while leaving shaders enabled - Also disable post processing on Android by default --- builtin/settingtypes.txt | 28 +++++++++++++++++----------- src/client/render/plain.cpp | 4 ++-- src/defaultsettings.cpp | 2 ++ 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 42e19c385..9dfedbfe9 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -401,7 +401,8 @@ anisotropic_filter (Anisotropic filtering) bool false # # * None - No antialiasing (default) # -# * FSAA - Hardware-provided full-screen antialiasing (incompatible with shaders) +# * FSAA - Hardware-provided full-screen antialiasing +# (incompatible with Post Processing and Undersampling) # A.K.A multi-sample antialiasing (MSAA) # Smoothens out block edges but does not affect the insides of textures. # A restart is required to change this option. @@ -556,12 +557,17 @@ shadow_sky_body_orbit_tilt (Sky Body Orbit Tilt) float 0.0 -60.0 60.0 [**Post Processing] +# Enables the post processing pipeline. +# +# Requires: shaders +enable_post_processing (Enable Post Processing) bool true + # Enables Hable's 'Uncharted 2' filmic tone mapping. # Simulates the tone curve of photographic film and how this approximates the # appearance of high dynamic range images. Mid-range contrast is slightly # enhanced, highlights and shadows are gradually compressed. # -# Requires: shaders +# Requires: shaders, enable_post_processing tone_mapping (Filmic tone mapping) bool false # Enable automatic exposure correction @@ -569,14 +575,14 @@ tone_mapping (Filmic tone mapping) bool false # automatically adjust to the brightness of the scene, # simulating the behavior of human eye. # -# Requires: shaders +# Requires: shaders, enable_post_processing enable_auto_exposure (Enable Automatic Exposure) bool false # Set the exposure compensation in EV units. # Value of 0.0 (default) means no exposure compensation. # Range: from -1 to 1.0 # -# Requires: shaders, enable_auto_exposure +# Requires: shaders, enable_post_processing, enable_auto_exposure exposure_compensation (Exposure compensation) float 0.0 -1.0 1.0 # Apply dithering to reduce color banding artifacts. @@ -587,7 +593,7 @@ exposure_compensation (Exposure compensation) float 0.0 -1.0 1.0 # With OpenGL ES, dithering only works if the shader supports high # floating-point precision and it may have a higher performance impact. # -# Requires: shaders +# Requires: shaders, enable_post_processing debanding (Enable Debanding) bool true [**Bloom] @@ -595,7 +601,7 @@ debanding (Enable Debanding) bool true # Set to true to enable bloom effect. # Bright colors will bleed over the neighboring objects. # -# Requires: shaders +# Requires: shaders, enable_post_processing enable_bloom (Enable Bloom) bool false # Set to true to render debugging breakdown of the bloom effect. @@ -603,32 +609,32 @@ enable_bloom (Enable Bloom) bool false # top-left - processed base image, top-right - final image # bottom-left - raw base image, bottom-right - bloom texture. # -# Requires: shaders, enable_bloom +# Requires: shaders, enable_post_processing, enable_bloom enable_bloom_debug (Enable Bloom Debug) bool false # Defines how much bloom is applied to the rendered image # Smaller values make bloom more subtle # Range: from 0.01 to 1.0, default: 0.05 # -# Requires: shaders, enable_bloom +# Requires: shaders, enable_post_processing, enable_bloom bloom_intensity (Bloom Intensity) float 0.05 0.01 1.0 # Defines the magnitude of bloom overexposure. # Range: from 0.1 to 10.0, default: 1.0 # -# Requires: shaders, enable_bloom +# Requires: shaders, enable_post_processing, enable_bloom bloom_strength_factor (Bloom Strength Factor) float 1.0 0.1 10.0 # Logical value that controls how far the bloom effect spreads # from the bright objects. # Range: from 0.1 to 8, default: 1 # -# Requires: shaders, enable_bloom +# Requires: shaders, enable_post_processing, enable_bloom bloom_radius (Bloom Radius) float 1 0.1 8 # Set to true to enable volumetric lighting effect (a.k.a. "Godrays"). # -# Requires: shaders, enable_bloom +# Requires: shaders, enable_post_processing, enable_bloom enable_volumetric_lighting (Volumetric lighting) bool false [*Audio] diff --git a/src/client/render/plain.cpp b/src/client/render/plain.cpp index 3357d9d10..60a732415 100644 --- a/src/client/render/plain.cpp +++ b/src/client/render/plain.cpp @@ -103,7 +103,7 @@ void UpscaleStep::run(PipelineContext &context) std::unique_ptr create3DStage(Client *client, v2f scale) { RenderStep *step = new Draw3D(); - if (g_settings->getBool("enable_shaders")) { + if (g_settings->getBool("enable_shaders") && g_settings->getBool("enable_post_processing")) { RenderPipeline *pipeline = new RenderPipeline(); pipeline->addStep(pipeline->own(std::unique_ptr(step))); @@ -128,7 +128,7 @@ RenderStep* addUpscaling(RenderPipeline *pipeline, RenderStep *previousStep, v2f return previousStep; // When shaders are enabled, post-processing pipeline takes care of rescaling - if (g_settings->getBool("enable_shaders")) + if (g_settings->getBool("enable_shaders") && g_settings->getBool("enable_post_processing")) return previousStep; diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index bb1d8c78c..d7eee5c39 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -249,6 +249,7 @@ void set_default_settings() settings->setDefault("minimap_double_scan_height", "true"); // Effects + settings->setDefault("enable_post_processing", "true"); settings->setDefault("directional_colored_fog", "true"); settings->setDefault("inventory_items_animations", "false"); settings->setDefault("mip_map", "false"); @@ -502,6 +503,7 @@ void set_default_settings() settings->setDefault("active_block_range", "2"); settings->setDefault("viewing_range", "50"); settings->setDefault("leaves_style", "simple"); + settings->setDefault("enable_post_processing", "false"); settings->setDefault("debanding", "false"); settings->setDefault("curl_verify_cert", "false");