diff options
| author | Connor Thomson <blumatrikz@gmail.com> | 2026-09-11 08:24:01 -0700 |
|---|---|---|
| committer | Connor Thomson <blumatrikz@gmail.com> | 2026-09-11 08:24:01 -0700 |
| commit | c746e078703503bbbef9d1bd170d5d6617126453 (patch) | |
| tree | ffcb65a28c53d02c88f5116f568cd05402b83b8e /shaders | |
| parent | 465b2e435f3acd74596c605a127900303f05e865 (diff) | |
Switch to Blinn-Phong shading
Diffstat (limited to 'shaders')
| -rw-r--r-- | shaders/obj.frag.slang | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/shaders/obj.frag.slang b/shaders/obj.frag.slang index 8feab73..33596e3 100644 --- a/shaders/obj.frag.slang +++ b/shaders/obj.frag.slang @@ -35,10 +35,10 @@ FSOutput main(FSInput input) { float3 light_direction = normalize(float3(-0.45, 0.75, 0.55)); float3 normal = normalize(input.normal); float3 view_direction = normalize(input.camera_position - input.world_position); - float3 reflect_direction = reflect(-light_direction, normal); + float3 halfway_direction = normalize(light_direction + view_direction); float diffuse = max(dot(normal, light_direction), 0.0); - float specular = diffuse > 0.0 ? pow(max(dot(view_direction, reflect_direction), 0.0), shininess) : 0.0; + float specular = diffuse > 0.0 ? pow(max(dot(normal, halfway_direction), 0.0), shininess) : 0.0; float shade = saturate(ambient_strength + diffuse * diffuse_strength + specular * specular_strength); FSOutput output; |