diff --git a/Abgabe_4/lightTODOs/index.html b/Abgabe_4/lightTODOs/index.html index 83db0bb..d140ea1 100644 --- a/Abgabe_4/lightTODOs/index.html +++ b/Abgabe_4/lightTODOs/index.html @@ -54,13 +54,27 @@ // TODO: Berechne und normalisiere die Vektoren L, N, R und V // Tipp aus den References: For a given incident vector I and surface normal N reflect returns the reflection direction calculated as I - 2.0 * dot(N, I) * N. // I ist in diesem Fall der normalisierte Einheitsvektor -L (Siehe Diskussion 7) + // Folie 52 + // Vektor L ist Vektor von Vertex zu Lichtquelle + // Vektor N ist Normale vom Vertex (haben wir die nicht schon durch vNormal?) + // https://docs.gl/sl4/reflect + // Vektor R ist reflect(-L, N)? + // Vektor V ist von Vertex zu camera position? Folie 54 + //vec3 L = - // TODO: Berechne die Distanz d, sowie f_{att} + // TODO: Berechne die Distanz d, sowie f_{att} // Folie 49 + // Distanz zwischen Lichtposition und Vertex ? + // Problem: vPosition is vec4 not vec3 + // Umrechnung von vec4 zu vec3 + vec3 vPositionVec3 = vec3(vPosition); + float d = distance(lightPosition, vPositionVec3); + float f_att = min(1.0 / (c_1 + c_2*d + c_3*pow(d, 2.0)), 1.0); // TODO: Berechne die Farbe vfColor anhand der Phong-Beleuchtungsgleichung //vfColor = TODO; - vfColor = Ia * ka; + //float temp_diffuseLight = + vfColor = Ia * ka + f_att * 1.0; gl_Position = projectionMatrix * position; }