Implement a shading effect on the cube object based on the cosine of the angle between the normal vector N of each object fragment and the direction vector L from the fragment to the light source, which is located at coordinates (0.0, 1.0, 3.0)
.
To calculate the fragment normal N, use the dFdx
and dFdy
functions that you learned in the previous task, along with the new cross
function.
Note: The fragment position is stored in the vPos
variable.