techkaczynski.dev / code

summaryrefslogtreecommitdiff
path: root/res/sdr
diff options
context:
space:
mode:
Diffstat (limited to 'res/sdr')
-rw-r--r--res/sdr/mdl_foliage.vs11
1 files changed, 11 insertions, 0 deletions
diff --git a/res/sdr/mdl_foliage.vs b/res/sdr/mdl_foliage.vs
index db9d7b6..1198009 100644
--- a/res/sdr/mdl_foliage.vs
+++ b/res/sdr/mdl_foliage.vs
@@ -28,9 +28,20 @@ out vec3 frag_lighting;
void main() {
vec3 world_normal = normalize((matNormal * vec4(vertexNormal, 0.0)).xyz);
+
+ // float sun_diffuse = abs(dot(world_normal, sun_direction));
+ // float moon_diffuse = abs(dot(world_normal, moon_direction));
+
+ // for stronger shading, use 0.3 + 0.7 * abs(...)
+ // float sun_diffuse = 0.5 + 0.5 * abs(dot(world_normal, sun_direction));
+ // float moon_diffuse = 0.5 + 0.5 * abs(dot(world_normal, moon_direction));
float sun_diffuse = abs(dot(world_normal, sun_direction));
float moon_diffuse = abs(dot(world_normal, moon_direction));
+ // hack to fix lighting at midday
+ float midday = smoothstep(0.7, 1.0, sun_direction.y);
+ sun_diffuse = mix(sun_diffuse, 0.65, midday);
+
vec3 ambient_light = ambient_colour * ambient_intensity;
vec3 sun_light = sun_colour * sun_intensity * sun_diffuse;
vec3 moon_light = moon_colour * moon_intensity * moon_diffuse;