Skip to content

Commit 31ee691

Browse files
committed
Implemented a very simple SSAO in GLES3.
1 parent ab6c6ee commit 31ee691

File tree

9 files changed

+271
-7
lines changed

9 files changed

+271
-7
lines changed

drivers/gles3/effects/post_effects.cpp

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ void PostEffects::_draw_screen_triangle() {
8787
glBindVertexArray(0);
8888
}
8989

90-
void PostEffects::post_copy(GLuint p_dest_framebuffer, Size2i p_dest_size, GLuint p_source_color, Size2i p_source_size, float p_luminance_multiplier, const Glow::GLOWLEVEL *p_glow_buffers, float p_glow_intensity, float p_srgb_white, uint32_t p_view, bool p_use_multiview, uint64_t p_spec_constants) {
90+
void PostEffects::post_copy(
91+
GLuint p_dest_framebuffer, Size2i p_dest_size, GLuint p_source_color,
92+
GLuint p_source_depth, bool p_ssao_enabled, int p_ssao_quality_level, float p_ssao_strength, float p_ssao_radius,
93+
Size2i p_source_size, float p_luminance_multiplier, const Glow::GLOWLEVEL *p_glow_buffers, float p_glow_intensity,
94+
float p_srgb_white, uint32_t p_view, bool p_use_multiview, uint64_t p_spec_constants) {
9195
glDisable(GL_DEPTH_TEST);
9296
glDepthMask(GL_FALSE);
9397
glDisable(GL_BLEND);
@@ -103,6 +107,19 @@ void PostEffects::post_copy(GLuint p_dest_framebuffer, Size2i p_dest_size, GLuin
103107
if (p_glow_buffers != nullptr) {
104108
flags |= PostShaderGLES3::USE_GLOW;
105109
}
110+
if (p_ssao_enabled) {
111+
if (p_ssao_quality_level == RS::ENV_SSAO_QUALITY_VERY_LOW) {
112+
flags |= PostShaderGLES3::USE_SSAO_ABYSS;
113+
} else if (p_ssao_quality_level == RS::ENV_SSAO_QUALITY_LOW) {
114+
flags |= PostShaderGLES3::USE_SSAO_LOW;
115+
} else if (p_ssao_quality_level == RS::ENV_SSAO_QUALITY_HIGH) {
116+
flags |= PostShaderGLES3::USE_SSAO_HIGH;
117+
} else if (p_ssao_quality_level == RS::ENV_SSAO_QUALITY_ULTRA) {
118+
flags |= PostShaderGLES3::USE_SSAO_MEGA;
119+
} else {
120+
flags |= PostShaderGLES3::USE_SSAO_MED;
121+
}
122+
}
106123
if (p_luminance_multiplier != 1.0) {
107124
flags |= PostShaderGLES3::USE_LUMINANCE_MULTIPLIER;
108125
}
@@ -118,6 +135,20 @@ void PostEffects::post_copy(GLuint p_dest_framebuffer, Size2i p_dest_size, GLuin
118135
glTexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
119136
glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
120137

138+
if (p_ssao_enabled) {
139+
glActiveTexture(GL_TEXTURE3);
140+
glBindTexture(texture_target, p_source_depth);
141+
glTexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // Thanks to mrjustaguy!
142+
glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
143+
144+
post.shader.version_set_uniform(PostShaderGLES3::SSAO_INTENSITY, p_ssao_strength, post.shader_version, mode, flags);
145+
post.shader.version_set_uniform(PostShaderGLES3::SSAO_RADIUS_FRAC, p_ssao_radius, post.shader_version, mode, flags);
146+
post.shader.version_set_uniform(PostShaderGLES3::SSAO_PRN_UV, // This converts the UV coordinate into a pseudo-random number.
147+
p_source_size.x * 1.087f * ((1.0f + sqrt(5.0f)) / 2.0f),
148+
p_source_size.y * 1.087f * ((9.0f + sqrt(221.0f)) / 10.0f),
149+
post.shader_version, mode, flags);
150+
}
151+
121152
if (p_glow_buffers != nullptr) {
122153
glActiveTexture(GL_TEXTURE1);
123154
glBindTexture(GL_TEXTURE_2D, p_glow_buffers[0].color);
@@ -137,6 +168,10 @@ void PostEffects::post_copy(GLuint p_dest_framebuffer, Size2i p_dest_size, GLuin
137168
glActiveTexture(GL_TEXTURE1);
138169
glBindTexture(GL_TEXTURE_2D, 0);
139170
}
171+
if (p_ssao_enabled) {
172+
glActiveTexture(GL_TEXTURE3);
173+
glBindTexture(texture_target, 0);
174+
}
140175

141176
// Return back to nearest
142177
glActiveTexture(GL_TEXTURE0);

drivers/gles3/effects/post_effects.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ class PostEffects {
5858
PostEffects();
5959
~PostEffects();
6060

61-
void post_copy(GLuint p_dest_framebuffer, Size2i p_dest_size, GLuint p_source_color, Size2i p_source_size, float p_luminance_multiplier, const Glow::GLOWLEVEL *p_glow_buffers, float p_glow_intensity, float p_srgb_white, uint32_t p_view = 0, bool p_use_multiview = false, uint64_t p_spec_constants = 0);
61+
void post_copy(GLuint p_dest_framebuffer, Size2i p_dest_size, GLuint p_source_color,
62+
GLuint p_source_depth, bool p_ssao_enabled, int p_ssao_quality_level, float p_ssao_strength, float p_ssao_radius,
63+
Size2i p_source_size, float p_luminance_multiplier, const Glow::GLOWLEVEL *p_glow_buffers, float p_glow_intensity,
64+
float p_srgb_white, uint32_t p_view = 0, bool p_use_multiview = false, uint64_t p_spec_constants = 0);
6265
};
6366

6467
} //namespace GLES3

drivers/gles3/rasterizer_scene_gles3.cpp

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,7 @@ void RasterizerSceneGLES3::environment_set_ssr_roughness_quality(RS::Environment
11141114
}
11151115

11161116
void RasterizerSceneGLES3::environment_set_ssao_quality(RS::EnvironmentSSAOQuality p_quality, bool p_half_size, float p_adaptive_target, int p_blur_passes, float p_fadeout_from, float p_fadeout_to) {
1117+
ssao_quality = p_quality;
11171118
}
11181119

11191120
void RasterizerSceneGLES3::environment_set_ssil_quality(RS::EnvironmentSSILQuality p_quality, bool p_half_size, float p_adaptive_target, int p_blur_passes, float p_fadeout_from, float p_fadeout_to) {
@@ -2275,6 +2276,15 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_
22752276
}
22762277
}
22772278

2279+
bool ssao_enabled = false;
2280+
if (p_environment.is_valid()) {
2281+
ssao_enabled = environment_get_ssao_enabled(p_environment);
2282+
if (ssao_enabled) {
2283+
// If SSAO is enabled, we apply tonemapping etc. in post, so disable it during rendering
2284+
apply_color_adjustments_in_post = true;
2285+
}
2286+
}
2287+
22782288
// Assign render data
22792289
// Use the format from rendererRD
22802290
RenderDataGLES3 render_data;
@@ -2552,6 +2562,11 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_
25522562
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
25532563
glViewport(0, 0, rb->internal_size.x, rb->internal_size.y);
25542564

2565+
// If SSAO is enabled, we definitely need the depth buffer.
2566+
if (ssao_enabled) {
2567+
scene_state.used_depth_texture = true;
2568+
}
2569+
25552570
// Do depth prepass if it's explicitly enabled
25562571
bool use_depth_prepass = config->use_depth_prepass;
25572572

@@ -2835,6 +2850,18 @@ void RasterizerSceneGLES3::_render_post_processing(const RenderDataGLES3 *p_rend
28352850
rb->check_glow_buffers();
28362851
}
28372852

2853+
// Check if we want and can have SSAO.
2854+
bool ssao_enabled = false;
2855+
float ssao_strength = 4.0;
2856+
float ssao_radius = 0.5;
2857+
if (p_render_data->environment.is_valid()) {
2858+
ssao_enabled = environment_get_ssao_enabled(p_render_data->environment);
2859+
// This SSAO is not implemented the same way, but uses the intensity and radius
2860+
// in a similar way. The parameters are scaled so the SSAO defaults look ok.
2861+
ssao_strength = environment_get_ssao_intensity(p_render_data->environment) * 2.0;
2862+
ssao_radius = environment_get_ssao_radius(p_render_data->environment) * 0.5;
2863+
}
2864+
28382865
uint64_t bcs_spec_constants = 0;
28392866
if (p_render_data->environment.is_valid()) {
28402867
bool use_bcs = environment_get_adjustments_enabled(p_render_data->environment);
@@ -2882,6 +2909,10 @@ void RasterizerSceneGLES3::_render_post_processing(const RenderDataGLES3 *p_rend
28822909
if (fbo_int != 0) {
28832910
// Apply glow/bloom if requested? then populate our glow buffers
28842911
GLuint color = fbo_int != 0 ? rb->get_internal_color() : texture_storage->render_target_get_color(render_target);
2912+
2913+
// We need to pass this in for SSAO.
2914+
GLuint depth_buffer = fbo_int != 0 ? rb->get_internal_depth() : texture_storage->render_target_get_depth(render_target);
2915+
28852916
const GLES3::Glow::GLOWLEVEL *glow_buffers = nullptr;
28862917
if (glow_enabled) {
28872918
glow_buffers = rb->get_glow_buffers();
@@ -2898,7 +2929,10 @@ void RasterizerSceneGLES3::_render_post_processing(const RenderDataGLES3 *p_rend
28982929
}
28992930

29002931
// Copy color buffer
2901-
post_effects->post_copy(fbo_rt, target_size, color, internal_size, p_render_data->luminance_multiplier, glow_buffers, glow_intensity, srgb_white, 0, false, bcs_spec_constants);
2932+
post_effects->post_copy(fbo_rt, target_size, color,
2933+
depth_buffer, ssao_enabled, ssao_quality, ssao_strength, ssao_radius,
2934+
internal_size, p_render_data->luminance_multiplier, glow_buffers, glow_intensity,
2935+
srgb_white, 0, false, bcs_spec_constants);
29022936

29032937
// Copy depth buffer
29042938
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo_int);
@@ -2945,6 +2979,9 @@ void RasterizerSceneGLES3::_render_post_processing(const RenderDataGLES3 *p_rend
29452979
const GLES3::Glow::GLOWLEVEL *glow_buffers = nullptr;
29462980
GLuint source_color = fbo_int != 0 ? rb->get_internal_color() : texture_storage->render_target_get_color(render_target);
29472981

2982+
// Moved this up so SSAO could use it too.
2983+
GLuint read_depth = rb->get_internal_depth();
2984+
29482985
if (glow_enabled) {
29492986
glow_buffers = rb->get_glow_buffers();
29502987

@@ -2966,11 +3003,13 @@ void RasterizerSceneGLES3::_render_post_processing(const RenderDataGLES3 *p_rend
29663003

29673004
glBindFramebuffer(GL_FRAMEBUFFER, fbos[2]);
29683005
glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, write_color, 0, v);
2969-
post_effects->post_copy(fbos[2], target_size, source_color, internal_size, p_render_data->luminance_multiplier, glow_buffers, glow_intensity, srgb_white, v, true, bcs_spec_constants);
3006+
post_effects->post_copy(fbos[2], target_size, source_color,
3007+
read_depth, ssao_enabled, ssao_quality, ssao_strength, ssao_radius,
3008+
internal_size, p_render_data->luminance_multiplier, glow_buffers, glow_intensity,
3009+
srgb_white, v, true, bcs_spec_constants);
29703010
}
29713011

29723012
// Copy depth
2973-
GLuint read_depth = rb->get_internal_depth();
29743013
GLuint write_depth = texture_storage->render_target_get_depth(render_target);
29753014

29763015
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbos[0]);

drivers/gles3/shaders/effects/post.glsl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ USE_LUMINANCE_MULTIPLIER = false
1010
USE_BCS = false
1111
USE_COLOR_CORRECTION = false
1212
USE_1D_LUT = false
13+
USE_SSAO_ABYSS = false
14+
USE_SSAO_LOW = false
15+
USE_SSAO_MED = false
16+
USE_SSAO_HIGH = false
17+
USE_SSAO_MEGA = false
1318

1419
#[vertex]
1520
layout(location = 0) in vec2 vertex_attrib;
@@ -86,6 +91,29 @@ vec3 apply_color_correction(vec3 color) {
8691
#endif // USE_1D_LUT
8792
#endif // USE_COLOR_CORRECTION
8893

94+
#if defined(USE_SSAO_ABYSS) || defined(USE_SSAO_LOW) || defined(USE_SSAO_MED) || defined(USE_SSAO_HIGH) || defined(USE_SSAO_MEGA)
95+
#define USE_SOME_SSAO
96+
uniform float ssao_intensity;
97+
uniform float ssao_radius_frac;
98+
uniform vec2 ssao_prn_UV;
99+
#ifdef USE_MULTIVIEW
100+
// VR will have 2 depth buffers.
101+
uniform sampler2DArray depth_buffer_array; // texunit:3
102+
#else
103+
uniform sampler2D depth_buffer; // texunit:3
104+
#endif
105+
#if defined(USE_SSAO_ABYSS)
106+
// Use the tiny 2-sample version.
107+
#include "../s4ao_micro_inc.glsl"
108+
#elif defined(USE_SSAO_HIGH) || defined(USE_SSAO_MEGA)
109+
// Use the rings version for the higher qualities.
110+
#include "../s4ao_mega_inc.glsl"
111+
#else
112+
// Use the more generic NxN grid version.
113+
#include "../s4ao_inc.glsl"
114+
#endif
115+
#endif
116+
89117
in vec2 uv_interp;
90118

91119
layout(location = 0) out vec4 frag_color;
@@ -131,6 +159,11 @@ void main() {
131159

132160
color.rgb = srgb_to_linear(color.rgb);
133161

162+
#if defined(USE_SOME_SSAO)
163+
// Putting SSAO after the conversion to linear color, though it might be better before the glow.
164+
color.rgb *= s4ao(uv_interp); // The USE_SSAO_X controls the number of samples.
165+
#endif
166+
134167
color.rgb = apply_tonemapping(color.rgb, white);
135168

136169
#ifdef USE_BCS
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// S4AO (Stupid Simple Screen Space Ambient Occlusion) - Jonathan Dummer (O1S)
2+
3+
// The sample_width should be even, else the midpoint is at UV.
4+
// Takes sample_width^2 samples in a grid, with the corners notched.
5+
#if defined(USE_SSAO_LOW)
6+
const int sample_width = 2;
7+
#elif defined(USE_SSAO_HIGH)
8+
const int sample_width = 6;
9+
#else
10+
const int sample_width = 4;
11+
#endif
12+
const int notch_01 = int(sample_width > 3); // Set to 1 to skip the corner samples, 0 to include them.
13+
const float sample_mid = (float(sample_width) - 1.0) * 0.50001; // Can't be exactly 0.5 in case sample_width is odd.
14+
#if defined(USE_SSAO_LOW)
15+
const float inv_half_width = 1.0 / sample_mid; // The 2x2 sampling looks wider as all samples are at radius.
16+
#else
17+
const float inv_half_width = 1.7 / sample_mid; // Bake in the 1.7 scale for the random rotation.
18+
#endif
19+
const float average_samples = 1.0 / float(sample_width * sample_width - 4 * notch_01); // 1 / number_of_samples
20+
const float ssao_falloff_frac = 0.25;
21+
// Perform the SSAO.
22+
float s4ao(vec2 UV) {
23+
#ifdef USE_MULTIVIEW
24+
float depth = texture(depth_buffer_array, vec3(UV, view)).r;
25+
#else
26+
float depth = texture(depth_buffer, UV).r;
27+
#endif
28+
float radius = max(1e-4f, depth * ssao_radius_frac);
29+
float inv_falloff = 1.0f / max(1e-4f, depth * ssao_falloff_frac);
30+
// Random 2D rotation per pixel (+/-45 deg, with 0 having a lower probability).
31+
// The random cosine vector is vec2( 0.5, -0.5 to +0.5 ) and *1.7 makes the average length ~ 1.
32+
vec2 rcos = (inv_half_width * radius) * vec2(0.5f, fract(dot(UV, ssao_prn_UV)) - 0.5f);
33+
vec2 rsin = rcos.yx * vec2(-1, 1); // Perpendicular to the random cosine vector.
34+
// Grab the samples and determine the occlusion.
35+
float occlusion = 0.0f;
36+
vec2 base_duv = -sample_mid * rsin;
37+
for (int j = sample_width; --j >= 0;) {
38+
#if defined(USE_SSAO_LOW)
39+
// Low quality uses 2x2 samples, no notching.
40+
vec2 duv = -sample_mid * rcos + base_duv;
41+
for (int i = sample_width; --i >= 0;) {
42+
#else
43+
// Will uses 4x4 or 6x6 samples, with the corners notched out.
44+
int o = /*notch_01 &*/ int((j <= 0) || (j >= (sample_width - 1))); // Notch corners of the grid.
45+
vec2 duv = (float(o) - sample_mid) * rcos + base_duv;
46+
for (int i = sample_width - o - o; --i >= 0;) {
47+
#endif
48+
#ifdef USE_MULTIVIEW
49+
float dz = texture(depth_buffer_array, vec3(UV + duv, view)).r - depth;
50+
#else
51+
float dz = texture(depth_buffer, UV + duv).r - depth;
52+
#endif
53+
float validity = smoothstep(1.0f, 0.0f, dz * inv_falloff);
54+
occlusion += normalize(vec3(duv, dz)).z * validity; // How 'directly overhead' is it?
55+
duv += rcos; // March along the rcos direction with i.
56+
}
57+
base_duv += rsin; // March along the rsin direction with j.
58+
}
59+
// Adjust the occlusion for intensity, and # samples.
60+
occlusion *= ssao_intensity * average_samples;
61+
occlusion = clamp(1.0f - occlusion, 0.0f, 1.0f);
62+
return occlusion * occlusion;
63+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// S4AO (Stupid Simple Screen Space Ambient Occlusion) - Jonathan Dummer (O1S)
2+
// The mega version uses N concentric rings of samples.
3+
4+
#if defined(USE_SSAO_MEGA)
5+
const int rings = 4; // Start with the outer ring.
6+
const int samps[] = int[](24, 18, 12, 6); // ( 9, 6, 3 ) is a minimum, but I want better.
7+
#else
8+
const int rings = 3; // Start with the outer ring.
9+
const int samps[] = int[](15, 10, 5, 1); // ( 9, 6, 3 ) is a minimum, but I want better.
10+
#endif
11+
const float average_samples = 1.0 / float(samps[0] + samps[1] * int(rings > 1) + samps[2] * int(rings > 2) + samps[3] * int(rings > 3));
12+
const float ssao_falloff_frac = 0.25;
13+
// Perform the SSAO.
14+
float s4ao(vec2 UV) {
15+
#ifdef USE_MULTIVIEW
16+
float depth = texture(depth_buffer_array, vec3(UV, view)).r;
17+
#else
18+
float depth = texture(depth_buffer, UV).r;
19+
#endif
20+
float inv_falloff = 1.0f / max(1e-4f, depth * ssao_falloff_frac);
21+
// Random 2D rotation per pixel (0..1 -> parabola approximating a 180 deg arc)
22+
float r01 = fract(dot(UV, ssao_prn_UV));
23+
vec2 rcos = vec2(r01 - 0.5f, 2.0f * (r01 - r01 * r01)) * (2.0f * depth * ssao_radius_frac); // 180 degrees.
24+
vec2 rsin = rcos.yx * vec2(-1, 1); // Perpendicular to the random cosine vector.
25+
// Grab the samples and determine the occlusion.
26+
float occlusion = 0.0f;
27+
float ring_shrink = 0.75f; // Shrink every ring.
28+
for (int r = 0; r < rings; ++r) {
29+
float dt = (6.283185307f) / float(samps[r]);
30+
float t = float(r & 1) * 0.5f * dt;
31+
for (int s = 0; s < samps[r]; ++s) {
32+
vec2 duv = cos(t) * rcos + sin(t) * rsin;
33+
#ifdef USE_MULTIVIEW
34+
float dz = texture(depth_buffer_array, vec3(UV + duv, view)).r - depth;
35+
#else
36+
float dz = texture(depth_buffer, UV + duv).r - depth;
37+
#endif
38+
// How 'directly overhead' is it? Factor in the falloff depth.
39+
occlusion += normalize(vec3(duv, dz)).z * smoothstep(1.0f, 0.0f, dz * inv_falloff);
40+
t += dt;
41+
}
42+
// The next ring will be smaller.
43+
rcos *= ring_shrink;
44+
rsin *= ring_shrink;
45+
}
46+
// Adjust the occlusion for intensity, and # samples.
47+
occlusion *= ssao_intensity * average_samples;
48+
occlusion = 1.0f - clamp(occlusion, 0.0f, 1.0f);
49+
return occlusion * occlusion;
50+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// S4AO (Stupid Simple Screen Space Ambient Occlusion) - Jonathan Dummer (O1S)
2+
// This micro version uses only 3 depth samples, the midpoint and a randomly-rotated, balanced pair.
3+
4+
const mediump float ssao_falloff_frac = 0.25;
5+
// Perform the SSAO.
6+
float s4ao(vec2 UV) {
7+
#ifdef USE_MULTIVIEW
8+
mediump float depth = texture(depth_buffer_array, vec3(UV, view)).r;
9+
#else
10+
mediump float depth = texture(depth_buffer, UV).r;
11+
#endif
12+
mediump float inv_falloff = 1.0f / max(1e-4f, depth * ssao_falloff_frac);
13+
// Random 2D rotation per pixel (0..1 -> parabola approximating a 180 deg arc)
14+
mediump float r01 = fract(dot(UV, ssao_prn_UV));
15+
mediump vec2 duv = vec2(r01 - 0.5f, 2.0f * (r01 - r01 * r01)) * (2.0f * depth * ssao_radius_frac); // 180 degrees.
16+
// Grab the samples and determine the occlusion.
17+
mediump float occlusion = 0.0f;
18+
for (int s = 0; s < 2; ++s) {
19+
#ifdef USE_MULTIVIEW
20+
mediump float dz = texture(depth_buffer_array, vec3(UV + duv, view)).r - depth;
21+
#else
22+
mediump float dz = texture(depth_buffer, UV + duv).r - depth;
23+
#endif
24+
// How 'directly overhead' is it? Factor in the falloff depth.
25+
occlusion += normalize(vec3(duv, dz)).z * mix(1.0f, 0.0f, dz * inv_falloff);
26+
// Mirror the next sample.
27+
duv = -duv;
28+
}
29+
// Adjust the occlusion for intensity, and # samples.
30+
occlusion = 1.0f - clamp(occlusion * 0.5f * ssao_intensity, 0.0f, 1.0f);
31+
return occlusion * occlusion;
32+
}

scene/resources/environment.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,15 @@ void Environment::_validate_property(PropertyInfo &p_property) const {
11351135
}
11361136
}
11371137

1138+
if (OS::get_singleton()->get_current_rendering_method() != "forward_plus") {
1139+
// Hide SSAO properties that only work in Forward+.
1140+
if (p_property.name.begins_with("ssao_")) {
1141+
if ((p_property.name != "ssao_enabled") && (p_property.name != "ssao_radius") && (p_property.name != "ssao_intensity")) {
1142+
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
1143+
}
1144+
}
1145+
}
1146+
11381147
if (p_property.name == "background_color") {
11391148
if (bg_mode != BG_COLOR && ambient_source != AMBIENT_SOURCE_COLOR) {
11401149
p_property.usage = PROPERTY_USAGE_NO_EDITOR;

0 commit comments

Comments
 (0)