summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2021-06-08 17:39:41 +0300
committerYuri Roubinsky <chaosus89@gmail.com>2021-06-09 08:38:03 +0300
commit5d5400a3b1ff7d5dbf06c959aedf5e99d985ba7d (patch)
treee4db298dba2543cd24f8094fc87f8110fb289d38 /servers
parentc994f754eee067cb7626a64fd87e44bb83562150 (diff)
Fix shader compilation with render_mode: `specular_phong`
Diffstat (limited to 'servers')
-rw-r--r--servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl4
1 files changed, 4 insertions, 0 deletions
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl
index 14bad7dc06..709ea45b88 100644
--- a/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl
+++ b/servers/rendering/renderer_rd/shaders/scene_forward_lights_inc.glsl
@@ -238,7 +238,11 @@ void light_compute(vec3 N, vec3 L, vec3 V, vec3 light_color, float attenuation,
#elif defined(SPECULAR_PHONG)
vec3 R = normalize(-reflect(L, N));
+#ifdef USE_SOFT_SHADOWS
float cRdotV = clamp(A + dot(R, V), 0.0, 1.0);
+#else
+ float cRdotV = clamp(dot(R, V), 0.0, 1.0);
+#endif
float shininess = exp2(15.0 * (1.0 - roughness) + 1.0) * 0.25;
float phong = pow(cRdotV, shininess);
phong *= (shininess + 8.0) * (1.0 / (8.0 * M_PI));