September 2018
Intermediate to advanced
472 pages
15h 36m
English
To create a shader pair that implements the Phong reflection model, take the following steps:
layout (location = 0) in vec3 VertexPosition;
layout (location = 1) in vec3 VertexNormal;
out vec3 LightIntensity;
uniform struct LightInfo { vec4 Position; // Light position in eye coords. vec3 La; // Ambient light intensity vec3 Ld; // Diffuse light intensity vec3 Ls; // Specular light intensity} Light;uniform struct MaterialInfo { vec3 Ka; // Ambient reflectivity vec3 Kd; // Diffuse reflectivity vec3 Ks; // Specular reflectivity float Shininess; // Specular shininess factor} Material; uniform mat4 ModelViewMatrix; ...Read now
Unlock full access