From e4e90e53f02f6a431422c7790a7df34d396a3c6a Mon Sep 17 00:00:00 2001 From: iurii Date: Sat, 7 Sep 2024 15:27:01 +0300 Subject: specular mapping --- res/shaders/colors.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'res/shaders') diff --git a/res/shaders/colors.fs b/res/shaders/colors.fs index a486a92..6a42cbd 100644 --- a/res/shaders/colors.fs +++ b/res/shaders/colors.fs @@ -4,7 +4,7 @@ out vec4 FragColor; struct Material { sampler2D diffuse; - vec3 specular; + sampler2D specular; float shininess; }; @@ -39,7 +39,7 @@ void main() { vec3 view_dir = normalize(view_position - FragPos); vec3 reflect_dir = reflect(-light_dir, norm); float spec = pow(max(dot(view_dir, reflect_dir), 0.0), material.shininess); - vec3 specular = light.specular * (spec * material.specular); + vec3 specular = light.specular * spec * texture(material.specular, TexCoords).rgb; vec3 result = ambient + diffuse + specular; FragColor = vec4(result, 1.0); -- cgit 1.4.1-2-gfad0