# Shadow mapping using Silhouette map

Hi, guys!

There is a good technique, that can dramatically improve result of classical ‘Shadow mapping’.

Result:

The algorithm contains two pass excluding usage results on the pass of rendering scene:

• render classic shadow map (actually depth map).
• build silhouette map for refinement shadow edges.

But I have little problem with second pass:
I can’t determine algorithm of building silhouette map.

I have found three variants of it, and each of them is different from other two:

That does it mean: ‘Extrude degenerate quads to completely cover silhouette
edges in shadow map space.’ ?

It seems as a to expensive one: using of all pairs of vertices and related faces.
So, it is rejected. Am I right?

But in this variant silmap have resolution [(width - 1) x (height - 1)], where [width x height] is a origin shadow map resolution.
Thus, every pixel of silmap is present age for four pixels of origin shadow map:

Thus, approximation will be performed for all texels on the border of the shadow.
This is important thing! (will return to this point later)

Description:
In screen-space, we look for shadow discontinuity by
offsetting the projected coordinate in light space by one
shadow map sample in four directions (left, top, right,
bottom). The discontinuity is distinguished into two main
types. Exiting discontinuity, where the current fragment
sample is inside the umbra (area completely occluded
from direct light-source) and next neighboring sample is
outside the umbra. Entering discontinuity, where the
current fragment sample is outside the umbra and next
neighboring sample is inside the umbra.

In that place the problem is the resolution of the silmap is the same as the resolution of origin shadow map.
Thus, approximation will be performed !around! all texels on the border of the shadow.
See:

In that way the shadow become more huge than it should be because of additional layer of texels around origin shadow map. (but in the 2d variant, when approximation performs for border itself, not for additional layer of texels).
Hope you understand what I mean using my beginning english.

So, It seems the topic is ready to I ask the basic question:
It is definitely I want to use border approximation (silmap with [(width - 1) x (height - 1)] resolution).
But I have no detailed description how to do it.
If I build silmap determining the discontinuity as a point with angle between ‘light direction’ and a ‘tangent to the surface’ that small enough, it gives me acceptable result?

I did investigation for ways of implementation silhouette rendering.
As a result I have two possible techniques:

• a drawing lines for all pairs of vertices with one visible plane and second invisible one. (2d variant from the topic).
• determine discontinues in screen space using rendering real scene geometry. (3d variant from from the topic)

Both them look too expensive in performance terms.

BTW I didn’t understand 1st variant with the sentence ‘Extrude degenerate quads to completely cover silhouette
edges in shadow map space.’ Could somebody explain that?

I think the fact of me use it for direct light (orthographic projection) lets me determine the discontinuous as a enough difference of depth between neighbour texels.

I couldn’t find any other techniques to render silhouette.
May be, you guys, can suggest me other techniques to render silhouette?

Thanks for any reply!
Have a good day!