From c746e078703503bbbef9d1bd170d5d6617126453 Mon Sep 17 00:00:00 2001 From: Connor Thomson Date: Fri, 11 Sep 2026 08:24:01 -0700 Subject: Switch to Blinn-Phong shading --- shaders/obj.frag.slang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'shaders') 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; -- cgit v1.2.3