# In this question you need to implement a function for computing the achromatic Phong illumination at a surface point. The function declaration is: void phongIlluminationAchromatic(double* reflectedLightPtr, double ambientIntensity, double diffuseIntensity, double specularIntensity, double ambientReflecCoef, double diffuseReflecCoef, double specularReflecCoef, double shininess, double kc, double kl, double kq, Vec3d pointOnSurface, Vec3d surfaceNormal, Vec3d lightPosition, Vec3d viewPoint) The value of the variable reflectedLight should be the Phong illumination calculated with the achromatic Phong Illumination model presented in the lecture. ambientIntensity, diffuseIntensity, and specularIntensity are the intensities of the incoming light hitting the surface. ambientReflecCoef, diffuseReflecCoef, and specularReflecCoef are the reflection coefficients of the surface. shininess is the exponent alpha in the specular reflection component of the Phong Illumination formula. kc, kl and kq are constants used for computing how the distance between light source and surface point effects the reflected light intensity. pointOnSurface is the point on the surface for which you should compute the reflected light intensity. surfaceNormal is the surface normal at that point. lightPosition and viewPoint are the locations of the light and of the viewer (camera) in the scene. Note that all of these vectors are not normalised.

The task at hand is to create a function that calculates the achromatic Phong illumination at a given surface point. The function will take in various inputs such as the intensity of the incoming light, the reflection coefficients of the surface, the shininess exponent, and constants for distance attenuation.

The function declaration for this implementation is as follows:

“`cpp

void phongIlluminationAchromatic(double* reflectedLightPtr, double ambientIntensity, double diffuseIntensity, double specularIntensity, double ambientReflecCoef, double diffuseReflecCoef, double specularReflecCoef, double shininess, double kc, double kl, double kq, Vec3d pointOnSurface, Vec3d surfaceNormal, Vec3d lightPosition, Vec3d viewPoint)

“`

In the function declaration, `reflectedLightPtr` is a pointer to the variable that will store the calculated achromatic Phong illumination. The remaining parameters are the inputs required for the calculation.

Let’s breakdown the meaning of each parameter:

– `ambientIntensity`, `diffuseIntensity`, and `specularIntensity` represent the intensities of the incoming light hitting the surface. These values determine the overall brightness of the surface.

– `ambientReflecCoef`, `diffuseReflecCoef`, and `specularReflecCoef` are the reflection coefficients of the surface. These coefficients control how each component of the Phong illumination equation contributes to the final result.

– `shininess` is the exponent alpha in the specular reflection component of the Phong Illumination formula. It determines the size and concentration of the specular highlights on the surface.

– `kc`, `kl`, and `kq` are constants used for computing how the distance between the light source and surface point affects the reflected light intensity. These constants influence the attenuation of the light based on its distance.

– `pointOnSurface` is the specific point on the surface for which we want to compute the reflected light intensity.

– `surfaceNormal` is the surface normal at that point. It represents the direction perpendicular to the surface.

– `lightPosition` and `viewPoint` are the locations of the light source and the viewer (camera) in the scene, respectively. These positions are needed to determine the direction of the incoming light and the viewing direction for the specular reflection calculation.

It is important to note that all of the vectors mentioned above, such as `pointOnSurface`, `surfaceNormal`, `lightPosition`, and `viewPoint`, are not normalized. Therefore, appropriate normalization steps should be taken during the calculation process.

The goal of the function is to compute the achromatic Phong illumination at the given surface point using the inputs provided. The result will then be stored in the `reflectedLightPtr` variable. The exact implementation of the function will involve several mathematical calculations using the Phong illumination formula and appropriate vector operations.

Now that we have an understanding of the function parameters and their meanings, we can proceed with the implementation of the function.

### Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.

Click Here to Make an Order Click Here to Hire a Writer