<p>Because negative shading values are undefined and don't play well with tonemapping. It is preferable to use values in <span class="math-container">$[0,1]$</span> for low-dynamic-range or <span class="math-container">$[0,+\infty)$</span> for high-dynamic-range images.</p>

CC BY-SA 4.0
2019-01-07T06:30:08.520Z
2019-01-07T06:30:08.520Z
Hubble
<p><span class="math-container">$N \cdot L &lt; 0$</span> implies that the light is directed in the direction opposite the normal to the visible surface of the polygon. This means that the light is coming from behind and striking the back face of the polygon. In the analogous situation in real life, light striking one face of an opaque surface does not affect the illumination of a second face. Shining light on the back of a book (or other opaque object) does make the front of the book darker (that is it does not apply negative lighting): it simply has no effect on the front face of the book. This is the reason for the max() function.</p>

<p>Applying negative illumination to a surface where <span class="math-container">$N \cdot L &lt; 0$</span> doesn't make sense physically. In geometric optics with incoherent light sources there is no such thing as negative illumination.</p>

CC BY-SA 4.0
2019-01-07T16:59:58.463Z
2019-01-07T16:59:58.463Z
WaterMolecule
<p>If lighting with multiple lights, they add together to make the final lighting value. A negative light would darken other lights, which is incorrect.  This is also true if you add in specular reflections, emissive lighting, or other sources of lighting. The negative lighting from one source of lighting would darken some other source of non negative lighting.</p>

CC BY-SA 4.0
2019-01-07T07:54:29.123Z
If only one direction light is taken into account, no further processing such as half-lambert, is there any need to use the max func?
AlexWei
CC BY-SA 4.0
2019-01-07T10:00:25.917Z
If your application does indeed not rely on this value not being negative (only a single light source, just rendering straight to a color target in a way that will lead to the output being clamped to black anyways, etc.) then, by all means, go ahead and skip the `max()` if it makes you feel better. But do so, knowing that this will merely produce a result indistinguishable from the correct result in the most narrow circumstances and incorrect results in any other case. Meanwhile, any useful explanation of how shading works will continue to present the formula that is correct in general… 
Michael Kenzel
CC BY-SA 4.0
2019-01-07T11:46:46.490Z
@MichaelKenzel Actually, it will makes me feel better  :) knowing it could be safely skipped. Because I am afraid there is sth beyond my knowledge happens under the hood. Thanks.
AlexWei
CC BY-SA 4.0
2019-01-07T07:13:41.747Z
2019-01-07T07:13:41.747Z
Alan Wolfe
<p>In Cg tuts, <a href="http://developer.download.nvidia.com/CgTutorial/cg_tutorial_chapter05.html" rel="nofollow noreferrer">Diffuse Section</a></p>

<blockquote>
  <p>Surfaces that face away from the light will produce negative dot-product values, so the max(N · L, 0) in the equation ensures that these surfaces show no diffuse lighting.</p>
</blockquote>

<p>My question is why not just leave it be negative? IMO, both the negative and zero will make the color be black. </p>

<lighting>
Why Diffuse Light use max(N · H, 0) instead of just letting it be negative?
AlexWei
# Why Diffuse Light use max(N · H, 0) instead of just letting it be negative?

(Asked by: username_0 on 2019-01-07)

In Cg tuts, [Diffuse Section](http://developer.download.nvidia.com/CgTutorial/cg_tutorial_chapter05.html)

> Surfaces that face away from the light will produce negative dot-product values, so the max(N · L, 0) in the equation ensures that these surfaces show no diffuse lighting.

My question is why not just leave it be negative? IMO, both the negative and zero will make the color be black.

**Tags:** lighting


---

## 3 answers

### Answer by username_3 on 2019-01-07. Score: 10 | Accepted answer

If lighting with multiple lights, they add together to make the final lighting value. A negative light would darken other lights, which is incorrect. This is also true if you add in specular reflections, emissive lighting, or other sources of lighting. The negative lighting from one source of lighting would darken some other source of non negative lighting.

> **Comments:**
> **username_0**: If only one direction light is taken into account, no further processing such as half-lambert, is there any need to use the max func?  
> **username_4**: If your application does indeed not rely on this value not being negative (only a single light source, just rendering straight to a color target in a way that will lead to the output being clamped to black anyways, etc.) then, by all means, go ahead and skip the `max()` if it makes you feel better. But do so, knowing that this will merely produce a result indistinguishable from the correct result in the most narrow circumstances and incorrect results in any other case. Meanwhile, any useful explanation of how shading works will continue to present the formula that is correct in general…   
> **username_0**: @username_4 Actually, it will makes me feel better  :) knowing it could be safely skipped. Because I am afraid there is sth beyond my knowledge happens under the hood. Thanks.  

---

### Answer by username_1 on 2019-01-07. Score: 2

Because negative shading values are undefined and don't play well with tonemapping. It is preferable to use values in $[0,1]$ for low-dynamic-range or $[0,+\infty)$ for high-dynamic-range images.


---

### Answer by username_2 on 2019-01-07. Score: 2

$N \cdot L < 0$ implies that the light is directed in the direction opposite the normal to the visible surface of the polygon. This means that the light is coming from behind and striking the back face of the polygon. In the analogous situation in real life, light striking one face of an opaque surface does not affect the illumination of a second face. Shining light on the back of a book (or other opaque object) does make the front of the book darker (that is it does not apply negative lighting): it simply has no effect on the front face of the book. This is the reason for the max() function.

Applying negative illumination to a surface where $N \cdot L < 0$ doesn't make sense physically. In geometric optics with incoherent light sources there is no such thing as negative illumination.


---

