diff options
| author | tech kaczynski <tk@techkaczynski.dev> | 2026-11-02 16:20:50 +1000 |
|---|---|---|
| committer | tech kaczynski <tk@techkaczynski.dev> | 2026-11-02 16:20:50 +1000 |
| commit | e5560f69e11051a85c1d54780a59a4fbd83d8ed9 (patch) | |
| tree | d37903d38226066c993662229b9809d7a46df5a7 /res/sdr | |
| parent | c7185ab0bace46d63fde4a2af6dbc2f7a4c2dd87 (diff) | |
fixed foliage shader lighting bugmain
Diffstat (limited to 'res/sdr')
| -rw-r--r-- | res/sdr/mdl_foliage.vs | 11 |
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; |
