Untitled
unknown
plain_text
3 years ago
1.1 kB
7
Indexable
vec3 color = vec3(0.0,0.0,0.0); float alpha = 1.0; float scale_var = 0.2; //Ambient color += sunlight * tex * scale_var; //Diffuse -> (Vorl. 03 Folie 22) Wenn if nicht gilt, wäre skalarprodukt < 0.0, was heißen würde, dass der winkel stumpf ist und das licht sogesehen von unterhalb der ebene kommen würde, was keinen sinn ergeben würde if(dot(v2f_normal, v2f_light) > 0.0) color += sunlight * tex * dot(v2f_normal, v2f_light); //Eigentlich: Lichtintensität * material.diffuser-Anteil * der Winkel zw. normale des punktes auf den licht trifft und dem lichtstrahl selbst //Specular -> Bedingung von Diffus muss > 0.0 sein UND das von specular auch -> selbe argumentation if(dot(v2f_normal, v2f_light) > 0.0 && dot(mirror((v2f_normal, v2f_light), v2f_view) > 0.0) color += sunlight * tex * pow(dot(mirror((v2f_normal, v2f_light), v2f_view), shininess); // convert RGB color to YUV color and use only the luminance if (greyscale) color = vec3(0.299*color.r+0.587*color.g+0.114*color.b); // add required alpha value f_color = vec4(color, alpha);
Editor is loading...