vec4 light_ambient= vec4(0.2, 0.2, 0.2, 1.);
vec4 light_diffuse= vec4(1., 1., 1., 1.);
vec4 light_specular= vec4 (1., 1., 1., 1.);
vec4 material_ambient = vec4(.3, .6, .3, 1.);
vec4 material_diffuse = vec4(0.3, .6, 0.3, 1.);
vec4 material_specular = vec4(1., 1., 1., 1.);
float Shininess = 100.0;
vec4 AmbientProduct = light_ambient * material_ambient;
vec4 DiffuseProduct = light_diffuse * material_diffuse;
vec4 SpecularProduct = light_specular * material_specular;
vec3 N = normalize (fN);
vec3 E = normalize (fE);
vec3 L = normalize (fL);
vec3 H = normalize(L + E);
// Compute terms in the illumination equation
/*
vec4 ambient = AmbientProduct;
float Kd = max(dot(L, N), 0.0);
vec4 diffuse = Kd*DiffuseProduct;
float Ks = pow(max(dot(N, H), 0.0), Shininess);
vec4 specular = Ks * SpecularProduct;
if(dot(L, N) < 0.0)
specular = vec4(0.0, 0.0, 0.0, 1.0);
*/
vec4 ambient = AmbientProduct;
vec4 diffuse = DiffuseProduct;
vec4 specular = SpecularProduct;
gl_FragColor = ambient + diffuse + specular;
gl_FragColor.a = 1.0;
I know both shading method have to determine the normal at each vertex. But, the linear interpolation and illumination orders are different. As you can see, this is the phong shading. I did not get the part after calculating normal. How does it do the linear interpolation and illunimation? I stuck on this for a long time. If I want to change it to Gouraud shading, what should I change?