Skip to content

Commit 34ec486

Browse files
committed
Merge pull request godotengine#91096 from BastiaanOlij/fix_gles3_shadow_to_opacity
Fix issue in shadow to opacity
2 parents 2338d9b + d2d2274 commit 34ec486

File tree

3 files changed

+6
-29
lines changed

3 files changed

+6
-29
lines changed

drivers/gles3/shaders/scene.glsl

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,23 +1859,16 @@ void main() {
18591859
#endif // !MODE_RENDER_DEPTH
18601860

18611861
#if defined(USE_SHADOW_TO_OPACITY)
1862+
#ifndef MODE_RENDER_DEPTH
18621863
alpha = min(alpha, clamp(length(ambient_light), 0.0, 1.0));
18631864

18641865
#if defined(ALPHA_SCISSOR_USED)
18651866
if (alpha < alpha_scissor) {
18661867
discard;
18671868
}
1868-
#else
1869-
#ifdef MODE_RENDER_DEPTH
1870-
#ifdef USE_OPAQUE_PREPASS
1871-
1872-
if (alpha < opaque_prepass_threshold) {
1873-
discard;
1874-
}
1875-
#endif // USE_OPAQUE_PREPASS
1876-
#endif // MODE_RENDER_DEPTH
18771869
#endif // !ALPHA_SCISSOR_USED
18781870

1871+
#endif // !MODE_RENDER_DEPTH
18791872
#endif // USE_SHADOW_TO_OPACITY
18801873

18811874
#ifdef MODE_RENDER_DEPTH

servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2235,24 +2235,16 @@ void fragment_shader(in SceneData scene_data) {
22352235
}
22362236

22372237
#ifdef USE_SHADOW_TO_OPACITY
2238+
#ifndef MODE_RENDER_DEPTH
22382239
alpha = min(alpha, clamp(length(ambient_light), 0.0, 1.0));
22392240

22402241
#if defined(ALPHA_SCISSOR_USED)
22412242
if (alpha < alpha_scissor) {
22422243
discard;
22432244
}
2244-
#else
2245-
#ifdef MODE_RENDER_DEPTH
2246-
#ifdef USE_OPAQUE_PREPASS
2247-
2248-
if (alpha < scene_data.opaque_prepass_threshold) {
2249-
discard;
2250-
}
2251-
2252-
#endif // USE_OPAQUE_PREPASS
2253-
#endif // MODE_RENDER_DEPTH
22542245
#endif // ALPHA_SCISSOR_USED
22552246

2247+
#endif // !MODE_RENDER_DEPTH
22562248
#endif // USE_SHADOW_TO_OPACITY
22572249

22582250
#endif //!defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED)

servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,24 +1756,16 @@ void main() {
17561756
} //spot lights
17571757

17581758
#ifdef USE_SHADOW_TO_OPACITY
1759+
#ifndef MODE_RENDER_DEPTH
17591760
alpha = min(alpha, clamp(length(ambient_light), 0.0, 1.0));
17601761

17611762
#if defined(ALPHA_SCISSOR_USED)
17621763
if (alpha < alpha_scissor) {
17631764
discard;
17641765
}
1765-
#else
1766-
#ifdef MODE_RENDER_DEPTH
1767-
#ifdef USE_OPAQUE_PREPASS
1768-
1769-
if (alpha < scene_data.opaque_prepass_threshold) {
1770-
discard;
1771-
}
1772-
1773-
#endif // USE_OPAQUE_PREPASS
1774-
#endif // MODE_RENDER_DEPTH
17751766
#endif // !ALPHA_SCISSOR_USED
17761767

1768+
#endif // !MODE_RENDER_DEPTH
17771769
#endif // USE_SHADOW_TO_OPACITY
17781770

17791771
#endif //!defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED)

0 commit comments

Comments
 (0)