Improve SSAO performance and quality

This decreases the number of samples significantly, leading to a
notable performance increase with only a very slight loss in
visual quality.

This also tweaks the default SSAO settings to use 3×3 blurring,
which makes noise patterns much less visible.
This commit is contained in:
Hugo Locurcio 2019-05-26 11:50:25 +02:00
parent 0d8f1ba6a9
commit eb0cced3c0
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C
2 changed files with 6 additions and 6 deletions

View file

@ -16,15 +16,15 @@ void main() {
#define TWO_PI 6.283185307179586476925286766559 #define TWO_PI 6.283185307179586476925286766559
#ifdef SSAO_QUALITY_HIGH #ifdef SSAO_QUALITY_HIGH
#define NUM_SAMPLES (80) #define NUM_SAMPLES (16)
#endif #endif
#ifdef SSAO_QUALITY_LOW #ifdef SSAO_QUALITY_LOW
#define NUM_SAMPLES (15) #define NUM_SAMPLES (8)
#endif #endif
#if !defined(SSAO_QUALITY_LOW) && !defined(SSAO_QUALITY_HIGH) #if !defined(SSAO_QUALITY_LOW) && !defined(SSAO_QUALITY_HIGH)
#define NUM_SAMPLES (40) #define NUM_SAMPLES (12)
#endif #endif
// If using depth mip levels, the log of the maximum pixel offset before we need to switch to a lower // If using depth mip levels, the log of the maximum pixel offset before we need to switch to a lower

View file

@ -1294,8 +1294,8 @@ void Environment::_bind_methods() {
Environment::Environment() : Environment::Environment() :
bg_mode(BG_CLEAR_COLOR), bg_mode(BG_CLEAR_COLOR),
tone_mapper(TONE_MAPPER_LINEAR), tone_mapper(TONE_MAPPER_LINEAR),
ssao_blur(SSAO_BLUR_DISABLED), ssao_blur(SSAO_BLUR_3x3),
ssao_quality(SSAO_QUALITY_LOW), ssao_quality(SSAO_QUALITY_MEDIUM),
glow_blend_mode(GLOW_BLEND_MODE_ADDITIVE), glow_blend_mode(GLOW_BLEND_MODE_ADDITIVE),
dof_blur_far_quality(DOF_BLUR_QUALITY_LOW), dof_blur_far_quality(DOF_BLUR_QUALITY_LOW),
dof_blur_near_quality(DOF_BLUR_QUALITY_LOW) { dof_blur_near_quality(DOF_BLUR_QUALITY_LOW) {
@ -1346,7 +1346,7 @@ Environment::Environment() :
ssao_ao_channel_affect = 0.0; ssao_ao_channel_affect = 0.0;
ssao_blur = SSAO_BLUR_3x3; ssao_blur = SSAO_BLUR_3x3;
set_ssao_edge_sharpness(4); set_ssao_edge_sharpness(4);
set_ssao_quality(SSAO_QUALITY_LOW); set_ssao_quality(SSAO_QUALITY_MEDIUM);
glow_enabled = false; glow_enabled = false;
glow_levels = (1 << 2) | (1 << 4); glow_levels = (1 << 2) | (1 << 4);