Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vec3 lightDir = LightPosition - vWorldPos;
- float att = max(LightAttenuation - LightInvRadius*length(lightDir), 0.0);
- light += att * LightAmbient * (MaterialAmbient + SceneAmbient);
- lightDir = normalize(lightDir);
- float lambert = max(dot(normal, lightDir), 0.0);
- light += att * lambert * LightDiffuse * MaterialDiffuse;
- if (MaterialShininess > 0.0)
- {
- vec3 reflection = reflect(-lightDir, normal);
- vec3 eyeVec = normalize(CameraPosition - vWorldPos);
- float specular = pow(max(dot(reflection, eyeVec), 0.0), MaterialShininess);
- light += att * specular * LightSpecular * MaterialSpecular;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement