Http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=52FCE20899526C5E8C5A3EA5D70E4681? Doi = 10.1.1.146.177 & rep = rep1 & type = PDF
Http://research.edm.uhasselt.be /~ Tmertens/slides/csm.ppt
This guy is one of the authors. He liked this guy very much. There are many good articles on the homepage.
Http://developer.download.nvidia.com/presentations/2008/GDC/GDC08_SoftShadowMapping.pdf
A paper of Bungie: siggraph09_lightingresearch.pptx
ESM is described from different aspects.
Overview:
Convolution SM, exponential SM, and variance shadow map belong to a type of shadow map, collectively referred to as prefilter shadow map.
Similar to PCF, the solution is soft shadow, but it is more efficient.
The process is not simply depth when shadow map construction pass is output, but some mathematical processing, such as exponential SM,
- Output the depth exp (with some other parameters) operation in the shadow map depth pass,
- Then perform the Blur operation,
- In the render shadow operation, the result of this blur operation is used to obtain the shadow weight (0-1) through some exp and product operations, that is, the shadow has the difference between full shadow and semi-Shadow.
Comparison of PCF:
- Shadow Map depth pass output depth Value
- When the render shadow is set to a camera space point A, the offset (may be, 16 points) is calculated according to the PCF filter selection, and the offset is calculated to the lighting space, based on XY, obtain the light space depth in the shadow map, and then compare it with the lighting space Z value of A to determine whether the shadow contains the following values (, 16.
Similarities and Differences:
- The Shadow information is obtained from multiple vertices, and the soft shadow is obtained by weighted addition, which is equivalent to the actual effect.
- Only the convolution series perform blur on the buffer output in the middle to get more information. Texture reads much less than ALU computing.
Detail: mathematical derivation
Some column mathematical derivation is used to explain why the same quality of PCF will be obtained at a much lower cost.
The basic idea is to first create a mathematical model of soft shadow, and then combine the decomposition and formula.
Mathematical Modeling of shadow map:
--- Formula 1
For the X point in camera space, d (x) is the Z value in the light view, and Z (P) is the depth of X mapped to the XY after the light view from the shadowmap sample, the two information can be used to obtain the shadow value. For example, the simplest one is:
- If (d (x)> Z (p) S (x) = 0;
- Else S (x) = 1;
Such a step function.
This result is either unavailable or hard shadow. We want soft shadow to do some blur work.
In digital processing, blur has a convolution operation)
Gaussian Blur is a lot of convolution used in graphics programming.
The convolution formula is as follows:
--- Formula 2
Familiar Gaussian blurv:
- N is the neighborhood for Convolution, and gaossian blur is the range of in each of the left and right centers
- W is a kernel, which is the weight of each surrounding point. If it is far away, it may be relatively small. If it is near, it will be relatively large.
- G is the convolution function, and blur is the Texel of blur.
Of course, gaussianblur is only an instance of convolution.
In this case, PCF is actually similar to Convolution, but regular convolution should be at point offset. in Formula 1, both d (x) and Z (p) are offset, PCF is only Z (p) offset, and d (x) is not offset.
Formula 1 is substituted into Formula 2: --- Formula 3
Write the formula in another form to facilitate subsequent derivation: ---- formula 4
The next step is a bunch of sin and cos functions of the original CSM Fourier expansion. Because there is no use value, Jump directly to exponential shadow map:
The shadow function is modeled using a power function:
---- Formula 5
This is not exactly the same as the fully accurate step function. It is an approximation, so ESM has bleeding, but this satisfies our desire for the prefilter feature.
Assume that d (x) is a constant value in convolution kernel. You can:
---- Formula 6
Here we have completed the most critical work of separating d (x) and Z (P) and convolution.
W * exp (CZ) is The Blur operation on the shadow map.
Problem:
In the figure, we can see that the standard shadow mathematical modeling ladder function is red, and the black is the ESM mathematical model, which is an approximate relationship, but in d (x), Z (P) when the gap is small, there will be a large deviation, which will lead to light bleeding.
In this case, halo's solution is to perform a darken processing in a very close area, which is a good solution.
Another normal case is that the softshadow Processing Method of ESM is orthogonal to the cascaded shadow map, which does not affect each other, but there is still a problem at the junction. Bungie provides an understanding method, let's just look at the code.