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:
-
- (source)
- (source)
That does it mean: ‘Extrude degenerate quads to completely cover silhouette
edges in shadow map space.’ ?
-
- (source)
- (source)
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)
-
- (source)
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?