<p>You shouldn't solve for $\cos^{-1}(\theta)$.</p>

<p>The ambient component is as follows (we are assuming the ambient light is white):
$$ambient\ color = (ambient\ light\ color)(ambient\ intensity)(diffuse\ color) = (1,1,1)(0.1)(0.6,0.7,0.8) = (0.06,0.07,0.08)$$</p>

<p>The diffuse component is as follows:
$$diffuse\ color = (light\ color)(light\ intensity)(diffuse\ color)(\cos(\theta)) = (1,1,1)(1)(0.6,0.7,0.8)(0.8) = (0.48,0.56,0.64)$$</p>

<p>Now we just need to add them up:
$$final\ intensity = (diffuse\ color) + (ambient\ color) = (0.06,0.07,0.08) + (0.48,0.56,0.64) = (0.54,0.63,0.72)$$</p>

<p>For more information, here's a pretty decent <a href="https://learnopengl.com/#!Lighting/Basic-Lighting" rel="nofollow noreferrer">summary</a> of various lighting calculations.</p>

CC BY-SA 3.0
2017-03-16T09:33:51.503Z
My lecturer told me this method is not answering the question, because the question asks for flat shading.
S.A
CC BY-SA 3.0
2017-03-20T01:59:01.477Z
This does answer the question. The only difference between flat shading and smooth shading in this question is the normal you use in the lighting calculation. That's why I edited your earlier question.
aces
CC BY-SA 3.0
2017-03-20T02:03:36.663Z
Also, I treat the diffuse reflectance coefficients as the diffuse color (maybe there's some miscommunication here?) because it doesn't make sense for them to be three-component vector of arbitrary values. It's used in energy conservation. The same thing is applicable to the diffuse light attenuation you put in you question; it should only be a single value (although the calculation is the same for this question).
aces
CC BY-SA 3.0
2017-03-14T15:21:24.343Z
2017-03-14T15:21:24.343Z
aces
<p>Flat Shading:</p>

<p>I = Ia x Ka + Fatt x Il x (Kd x (N x L))</p>

<p>Final intensity = ambient reflection x ambient reflection coefficient + (attenuation x incident light intensity x (diffusive reflection coefficient x (surface normal x Light intensity))</p>

<p>He told me that because ambient reflection coefficient and attenuation are not given, I can forget about it. Also specular light contribution need not be considered.</p>

<p>The surface normal is:
A = (0, 2, 1) B = (3, 0, 1) O = (0, 0, 0)</p>

<p>U = A - O = (0, 2, 1) 
V = B - O = (3, 0, 1)</p>

<p>Surface normal = U x V (cross-product) = (2, 3, -6)</p>

<p>I = 0.1 + (1, 1, 1) x ((0.6, 0.7, 0.8) x ((2, 3, -6) x (0, 3, 4)))</p>

<p>I = 0.1 + (1, 1, 1) x ((0.6, 0.7, 0.8) x (0, 9, -2.4))</p>

<p>I = 0.1 + (1, 1, 1) x (0, 6.3, -1.92)</p>

<p>I = (0.1, 6.4, -1.82) = RGB intensity values</p>

CC BY-SA 3.0
2017-03-16T09:45:52.650Z
To my understanding, this is how to calculate the RGB intensity values using flat shading. I would really appreciate seeing what others have to say about this.
S.A
CC BY-SA 3.0
2017-03-20T01:50:33.427Z
There are multiple problems with the normal. The first is that it needs to be normalized. The second issue is that it points in the opposite direction as the vertex normals. Maybe that's somehow correct, but since you weren't given a winding order, I would pick the direction that's similar to the direction of the vertex normals:
http://computergraphics.stackexchange.com/questions/4839/how-do-you-calculate-costheta-for-diffuse-in-flat-shading
aces
CC BY-SA 3.0
2017-03-16T09:44:48.307Z
2017-03-16T09:44:48.307Z
S.A
<p>Consider a triangular face of three vertices A(0,2,1), B(3,0,1) and the origin, and the normal vectors at the vertices are nA=(0,0,1), nB=(1,1,0) and nO=(-1,-1,1), respectively. The incident light is white and directional in the direction of L=(0,3,4) and the intensity is 1, the background ambient light intensity is 0.1, and the diffuse reflection coefficients for (red, green, blue) are (0.6,0.7,0.8). No specular light contribution need be considered. </p>

<p>How do I find the (red, green, blue) intensity values at the centre of the face using flat shading?</p>

<p>Flat Shading:</p>

<p>I = Ia x Ka + Fatt x Il x (Kd x (N x L))</p>

<p>Final intensity = ambient reflection x ambient reflection coefficient + (attenuation x incident light intensity x (diffusive reflection coefficient x (surface normal x Light intensity))</p>

<p>My lecturer told me that because ambient reflection coefficient and attenuation are not given, I can forget about it. Also specular light contribution need not be considered.</p>

<p>The surface normal is: </p>

<p>A = (0, 2, 1) B = (3, 0, 1) O = (0, 0, 0)</p>

<p>U = A - O = (0, 2, 1) V = B - O = (3, 0, 1)</p>

<p>Surface normal = U x V (cross-product) = (2, 3, -6)</p>

<p>I = 0.1 + (1, 1, 1) x ((0.6, 0.7, 0.8) x ((2, 3, -6) x (0, 3, 4)))</p>

<p>I = 0.1 + (1, 1, 1) x ((0.6, 0.7, 0.8) x (0, 9, -2.4))</p>

<p>I = 0.1 + (1, 1, 1) x (0, 6.3, -1.92)</p>

<p>I = (0.1, 6.4, -1.82) = RGB intensity values</p>

<p>Is this correct?</p>

CC BY-SA 3.0
2017-03-14T13:52:29.050Z
Do you have to use vertex normals as opposed to face normals? This makes the problem considerably more difficult. That said, the center of the triangle is always going to be the average of the values at the 3 vertices of the triangle, regardless of the size or direction of the triangle. If you know how to calculate the values at each vertex, you can simply interpolate t=0.5 between all three values.
Dan
CC BY-SA 3.0
2017-03-14T15:25:54.490Z
@Dan No, it's flat shading, so it should be by face normal.
aces
CC BY-SA 3.0
2017-03-14T17:44:33.870Z
@aces So you're agreeing with me? Lol. Your comment contradicts itself.The OP specified 3 normals, one for each vertex, in his question.
Dan
CC BY-SA 3.0
2017-03-14T19:31:07.473Z
@Dan Sorry, I interpreted your comment incorrectly.
aces
CC BY-SA 3.0
2017-03-15T16:16:15.100Z
@aces No big deal. Hopefully your answer helps the OP!
Dan
CC BY-SA 3.0
2017-03-16T09:33:21.493Z
My lecturer told me this was wrong. The question asks to use flat shading, which is a different equation.
S.A
CC BY-SA 3.0
2017-03-20T01:53:16.443Z
It isn't a "different equation." The only difference is how you treat the normals (and possibly the interpolation of vertex information such as color, but that's not necessary in this question since the vertices don't have individual colors).
aces
<rendering>
How to calculate the RGB intensity values at center of face using flat shading?
S.A
# How to calculate the RGB intensity values at center of face using flat shading?

(Asked by: username_0 on 2017-03-12)

Consider a triangular face of three vertices A(0,2,1), B(3,0,1) and the origin, and the normal vectors at the vertices are nA=(0,0,1), nB=(1,1,0) and nO=(-1,-1,1), respectively. The incident light is white and directional in the direction of L=(0,3,4) and the intensity is 1, the background ambient light intensity is 0.1, and the diffuse reflection coefficients for (red, green, blue) are (0.6,0.7,0.8). No specular light contribution need be considered.

How do I find the (red, green, blue) intensity values at the centre of the face using flat shading?

Flat Shading:

I = Ia x Ka + Fatt x Il x (Kd x (N x L))

Final intensity = ambient reflection x ambient reflection coefficient + (attenuation x incident light intensity x (diffusive reflection coefficient x (surface normal x Light intensity))

My lecturer told me that because ambient reflection coefficient and attenuation are not given, I can forget about it. Also specular light contribution need not be considered.

The surface normal is:

A = (0, 2, 1) B = (3, 0, 1) O = (0, 0, 0)

U = A - O = (0, 2, 1) V = B - O = (3, 0, 1)

Surface normal = U x V (cross-product) = (2, 3, -6)

I = 0.1 + (1, 1, 1) x ((0.6, 0.7, 0.8) x ((2, 3, -6) x (0, 3, 4)))

I = 0.1 + (1, 1, 1) x ((0.6, 0.7, 0.8) x (0, 9, -2.4))

I = 0.1 + (1, 1, 1) x (0, 6.3, -1.92)

I = (0.1, 6.4, -1.82) = RGB intensity values

Is this correct?

**Tags:** rendering

> **Comments:**
> **username_1**: Do you have to use vertex normals as opposed to face normals? This makes the problem considerably more difficult. That said, the center of the triangle is always going to be the average of the values at the 3 vertices of the triangle, regardless of the size or direction of the triangle. If you know how to calculate the values at each vertex, you can simply interpolate t=0.5 between all three values.  
> **username_2**: @username_1 No, it's flat shading, so it should be by face normal.  
> **username_1**: @username_2 So you're agreeing with me? Lol. Your comment contradicts itself.The OP specified 3 normals, one for each vertex, in his question.  
> **username_2**: @username_1 Sorry, I interpreted your comment incorrectly.  
> **username_1**: @username_2 No big deal. Hopefully your answer helps the OP!  
> **username_0**: My lecturer told me this was wrong. The question asks to use flat shading, which is a different equation.  
> **username_2**: It isn't a "different equation." The only difference is how you treat the normals (and possibly the interpolation of vertex information such as color, but that's not necessary in this question since the vertices don't have individual colors).  

---

## 2 answers

### Answer by username_2 on 2017-03-14. Score: 1

You shouldn't solve for $\cos^{-1}(\theta)$.

The ambient component is as follows (we are assuming the ambient light is white):
$$ambient\ color = (ambient\ light\ color)(ambient\ intensity)(diffuse\ color) = (1,1,1)(0.1)(0.6,0.7,0.8) = (0.06,0.07,0.08)$$

The diffuse component is as follows:
$$diffuse\ color = (light\ color)(light\ intensity)(diffuse\ color)(\cos(\theta)) = (1,1,1)(1)(0.6,0.7,0.8)(0.8) = (0.48,0.56,0.64)$$

Now we just need to add them up:
$$final\ intensity = (diffuse\ color) + (ambient\ color) = (0.06,0.07,0.08) + (0.48,0.56,0.64) = (0.54,0.63,0.72)$$

For more information, here's a pretty decent [summary](https://learnopengl.com/#!Lighting/Basic-Lighting) of various lighting calculations.

> **Comments:**
> **username_0**: My lecturer told me this method is not answering the question, because the question asks for flat shading.  
> **username_2**: This does answer the question. The only difference between flat shading and smooth shading in this question is the normal you use in the lighting calculation. That's why I edited your earlier question.  
> **username_2**: Also, I treat the diffuse reflectance coefficients as the diffuse color (maybe there's some miscommunication here?) because it doesn't make sense for them to be three-component vector of arbitrary values. It's used in energy conservation. The same thing is applicable to the diffuse light attenuation you put in you question; it should only be a single value (although the calculation is the same for this question).  

---

### Answer by username_0 on 2017-03-16. Score: 0

Flat Shading:

I = Ia x Ka + Fatt x Il x (Kd x (N x L))

Final intensity = ambient reflection x ambient reflection coefficient + (attenuation x incident light intensity x (diffusive reflection coefficient x (surface normal x Light intensity))

He told me that because ambient reflection coefficient and attenuation are not given, I can forget about it. Also specular light contribution need not be considered.

The surface normal is:
A = (0, 2, 1) B = (3, 0, 1) O = (0, 0, 0)

U = A - O = (0, 2, 1)
V = B - O = (3, 0, 1)

Surface normal = U x V (cross-product) = (2, 3, -6)

I = 0.1 + (1, 1, 1) x ((0.6, 0.7, 0.8) x ((2, 3, -6) x (0, 3, 4)))

I = 0.1 + (1, 1, 1) x ((0.6, 0.7, 0.8) x (0, 9, -2.4))

I = 0.1 + (1, 1, 1) x (0, 6.3, -1.92)

I = (0.1, 6.4, -1.82) = RGB intensity values

> **Comments:**
> **username_0**: To my understanding, this is how to calculate the RGB intensity values using flat shading. I would really appreciate seeing what others have to say about this.  
> **username_2**: There are multiple problems with the normal. The first is that it needs to be normalized. The second issue is that it points in the opposite direction as the vertex normals. Maybe that's somehow correct, but since you weren't given a winding order, I would pick the direction that's similar to the direction of the vertex normals: http://computergraphics.stackexchange.com/questions/4839/how-do-you-calculate-costheta-for-diffuse-in-flat-shading  

---

