<p>The shadow terminator problem (as it's also known) is still something of an open problem in ray-tracing. As you say, disabling self-shadowing is not a very good workaround, because non-convex meshes often <em>need</em> to self-shadow. There's a possible refinement to this method. Instead of throwing away all shadow ray intersections with the same object, you can only throw away the intersection if it's with the same object and it's through the reverse face of the triangle (i.e. discard the intersection if $d\dot\ N &gt; 0$, where $N$ is the geometric normal of the intersected polygon and $d$ is the shadow ray direction).</p>

<p>One alternative that I've used successfully is to offset the origin of the shadow ray a short distance along the surface normal. This way, the shadow ray originates not at the geometric surface of the mesh (which is only an approximation) but at the hypothetical surface of the real object.</p>

<p>In theory, you should choose the distance along the normal according to the point's distance from that polygon's vertices, so that the origin is on the approximated surface, but in practice, a small fixed offset works for almost all situations.</p>

<p>You should also be sure to use the normal rather than the geometric surface to decide whether the light is "behind" the surface. That is, if $N\dot\ L &lt; 0$, the shading point is in shadow (without needing to cast a ray), where $N$ is the interpolated and shaded normal.</p>

CC BY-SA 3.0
2017-04-12T17:32:23.597Z
The orientation trick from your first paragraph works perfectly as long as the object is closed and all faces have coherent orientation. It is my favorite solution.
Olivier
CC BY-SA 3.0
2017-04-11T16:07:27.453Z
2017-04-11T16:07:27.453Z
Dan Hulme
<p>By using smooth shading (i.e. interpolation of normals), an object can have a smooth look despite low polygon count. A nasty artifact that can happen when casting shadow rays is the <a href="http://wiki.povray.org/content/Knowledgebase:The_Shadow_Line_Artifact" rel="noreferrer">Shadow Line Artifact</a>. Since shadow rays originate from a certain position and don't usually take the normal into account, a complete face on a smooth object will either be shadowed or not, revealing the hard edges again:</p>

<p><a href="https://i.sstatic.net/VH8eM.png" rel="noreferrer"><img src="https://i.sstatic.net/VH8eM.png" alt="Flat and smooth shading, right one with artifacts."></a></p>

<p>The shadow is, so to speak, 'correct' and the weird appearance results from the normal map interpolation 'cheat'. Nevertheless, it is visually distracting. The linked article above, written in 2009, suggests removing shadows or self-shadows on objects that show this kind of artifact, which (especially for non-convex objects) is not a satisfying solution.</p>

<p>This is a very common problem inherent to ray tracing algorithms. I wonder if there is any better solution to it than subdividing the mesh into flat-shaded high-poly or getting rid of the shadows altogether.</p>

<raytracing><shadow><artifacts>
Ray Tracing Shadows: The Shadow Line Artifact
David Kuri
# Ray Tracing Shadows: The Shadow Line Artifact

(Asked by: username_0 on 2017-04-11)

By using smooth shading (i.e. interpolation of normals), an object can have a smooth look despite low polygon count. A nasty artifact that can happen when casting shadow rays is the [Shadow Line Artifact](http://wiki.povray.org/content/Knowledgebase:The_Shadow_Line_Artifact). Since shadow rays originate from a certain position and don't usually take the normal into account, a complete face on a smooth object will either be shadowed or not, revealing the hard edges again:

[![Flat and smooth shading, right one with artifacts.](https://i.sstatic.net/VH8eM.png)](https://i.sstatic.net/VH8eM.png)

The shadow is, so to speak, 'correct' and the weird appearance results from the normal map interpolation 'cheat'. Nevertheless, it is visually distracting. The linked article above, written in 2009, suggests removing shadows or self-shadows on objects that show this kind of artifact, which (especially for non-convex objects) is not a satisfying solution.

This is a very common problem inherent to ray tracing algorithms. I wonder if there is any better solution to it than subdividing the mesh into flat-shaded high-poly or getting rid of the shadows altogether.

**Tags:** raytracing, shadow, artifacts


---

## 1 answers

### Answer by username_1 on 2017-04-11. Score: 8 | Accepted answer

The shadow terminator problem (as it's also known) is still something of an open problem in ray-tracing. As you say, disabling self-shadowing is not a very good workaround, because non-convex meshes often *need* to self-shadow. There's a possible refinement to this method. Instead of throwing away all shadow ray intersections with the same object, you can only throw away the intersection if it's with the same object and it's through the reverse face of the triangle (i.e. discard the intersection if $d\dot\ N > 0$, where $N$ is the geometric normal of the intersected polygon and $d$ is the shadow ray direction).

One alternative that I've used successfully is to offset the origin of the shadow ray a short distance along the surface normal. This way, the shadow ray originates not at the geometric surface of the mesh (which is only an approximation) but at the hypothetical surface of the real object.

In theory, you should choose the distance along the normal according to the point's distance from that polygon's vertices, so that the origin is on the approximated surface, but in practice, a small fixed offset works for almost all situations.

You should also be sure to use the normal rather than the geometric surface to decide whether the light is "behind" the surface. That is, if $N\dot\ L < 0$, the shading point is in shadow (without needing to cast a ray), where $N$ is the interpolated and shaded normal.

> **Comments:**
> **username_2**: The orientation trick from your first paragraph works perfectly as long as the object is closed and all faces have coherent orientation. It is my favorite solution.  

---

