diff options
author | Jeroen Bakker <jbakker> | 2019-10-16 16:30:57 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-10-16 16:40:25 +0300 |
commit | b0476f06312db95423e6b83a86d7675dbbc94431 (patch) | |
tree | e9a027f239b3bbab9d2f3153a8f7f1aedd81427f /source/blender/draw/engines/workbench/workbench_private.h | |
parent | 80f0bc99a9831709338fdb252546829afdf4912a (diff) |
Workbench: Background Dithering
Background dithering was introduced to solve banding issues on gradient backgrounds.
This patch will enable dithering based on the texture that is used for drawing.
Only when using a GPU_RGBA8 texture the dithering will be enabled.
This disables dithering for final rendering, vertex and texture paint modes.
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D6056
Diffstat (limited to 'source/blender/draw/engines/workbench/workbench_private.h')
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_private.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h index 252be3570d7..f28cf12405e 100644 --- a/source/blender/draw/engines/workbench/workbench_private.h +++ b/source/blender/draw/engines/workbench/workbench_private.h @@ -194,7 +194,8 @@ typedef struct WORKBENCH_UBO_World { float background_alpha; float curvature_ridge; float curvature_valley; - int pad[3]; + float background_dither_factor; + int pad[2]; } WORKBENCH_UBO_World; BLI_STATIC_ASSERT_ALIGN(WORKBENCH_UBO_World, 16) @@ -406,6 +407,12 @@ BLI_INLINE eGPUTextureFormat workbench_color_texture_format(const WORKBENCH_Priv return result; } +BLI_INLINE bool workbench_background_dither_factor(const WORKBENCH_PrivateData *wpd) { + /* Only apply dithering when rendering on a RGBA8 texture. + * The dithering will remove banding when using a gradient as background */ + return workbench_color_texture_format(wpd) == GPU_RGBA8; +} + /* workbench_deferred.c */ void workbench_deferred_engine_init(WORKBENCH_Data *vedata); void workbench_deferred_engine_free(void); |