I will be filling in more info in these notes, but I wanted to post this now to get you started with the material as soon as possible.
Crossing one Bezier cubic curve with another to create a bicubic patch As we discussed in class, we can evaluate a Bezier bicubic surface patch over (u,v), which has a cross section for any fixed u and for any fixed v, by doing the following math:Catmull Rom splinesNote that our key points matrix contains 16 key values for each of the x, y and z coordinates. A Catmull Rom spline is purely interpolating: The spline goes through all of the key points.Adding noise to lighting In class we modified the fragment shader by adding the line shown in blue to create more interesting specular reflection lighting by using the noise function.// DO PHONG SHADING vec3 color = ambient; for (int i = 0 ; i < nl ; i++) { vec3 R = 2. * dot(uLDir[i], N) * N - uLDir[i]; float d = max(0., dot(uLDir[i], N)); float s = pow(max(0., dot(E, R)), p); color += uLCol[i] * (diffuse * d + specular * s); } color += specular * .02 * (.1 + noise(2. * N) * N.z); if (ta != 0.) color *= 1. + ta * noise(vec3(tf * vUV, 0.)); gl_FragColor = vec4(sqrt(color), 1.0); |