Modify Program 7.2 so that it incorporates TWO positional lights, placed in different locations. The fragment shader

Question:

Modify Program 7.2 so that it incorporates TWO positional lights, placed in different locations. The fragment shader will need to blend the diffuse and specular contributions of each of the lights. Try using a weighted sum, similar to the one shown in Section 7.6. You can also try simply adding them and clamping the result so it doesn’t exceed the maximum light value.

Program 7.2Vertex Shader #version 430 layout (location=0) in vec3 vertPos; layout (location=1) in vec3 vertNormal; outFragment Shader #version 430 in vec3 varying Normal; in vec3 varyingLightDir; in vec3 varyingVertPos; outvoid main(void) { // normalize the light, normal, and view vectors: vec3 L = normalize(varying LightDir);

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Computer Graphics Programming In OpenGL With JAVA

ISBN: 9781683922193

2nd Edition

Authors: V. Scott Gordon PhD, John L. Clevenger PhD

Question Posted: