Skip to content

Commit

Permalink
Allow shaders with disabled post processing pipeline (#14338)
Browse files Browse the repository at this point in the history
- Allow disabling of the post processing pipeline while leaving shaders enabled
- Also disable post processing on Android by default
  • Loading branch information
lhofhansl authored and grorp committed May 6, 2024
1 parent 35a83c3 commit ab2419d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
24 changes: 15 additions & 9 deletions builtin/settingtypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -557,63 +558,68 @@ 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
# When enabled, the post-processing engine will
# 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

[**Bloom]

# 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.
# In debug mode, the screen is split into 4 quadrants:
# 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


Expand Down
4 changes: 2 additions & 2 deletions src/client/render/plain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void UpscaleStep::run(PipelineContext &context)
std::unique_ptr<RenderStep> 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<RenderStep>(step)));

Expand All @@ -131,7 +131,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;


Expand Down
2 changes: 2 additions & 0 deletions src/defaultsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,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");
Expand Down Expand Up @@ -497,6 +498,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("curl_verify_cert", "false");

// Apply settings according to screen size
Expand Down

0 comments on commit ab2419d

Please sign in to comment.