summaryrefslogtreecommitdiff
path: root/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'shaders')
-rw-r--r--shaders/obj.frag.slang4
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;