diff options
Diffstat (limited to 'engine/res/default_shader.slang')
| -rw-r--r-- | engine/res/default_shader.slang | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/engine/res/default_shader.slang b/engine/res/default_shader.slang index e42b83a..1f79dbe 100644 --- a/engine/res/default_shader.slang +++ b/engine/res/default_shader.slang @@ -164,6 +164,13 @@ struct BlinnPhongLighting in float2 texture_coords ) { + // The result of the below pow is undefined if both arguments is 0. This stops + // that problem. This prevents buggy specular light when shininess is 0. + if (this.material.shininess == 0.0) { + return light_phong.specular * + (specular_map.Sample(texture_coords).xyz * this.material.specular); + } + float3 view_direction = normalize(this.view_pos - frag_pos); float3 halfway_direction = normalize(light_dir + view_direction); |
