Shader chunk to add to the head of a fragment shader to be able to use Phong shading.
var color: vec3f = vec3(1.0);let specularColor: vec3f = vec3(1.0);let specularStrength: f32 = 1.0;let shininess: f32 = 32.0;color = getPhong(normal, worldPosition, color, viewDirection, specularColor, specularStrength, shininess); Copy
var color: vec3f = vec3(1.0);let specularColor: vec3f = vec3(1.0);let specularStrength: f32 = 1.0;let shininess: f32 = 32.0;color = getPhong(normal, worldPosition, color, viewDirection, specularColor, specularStrength, shininess);
parameters used to append the right chunks and calculate the Phong shading.
Shader chunk to add to the head of a fragment shader to be able to use Phong shading.
Example