1

I'm having hard time understanding how the moments fall into place into Chebyshev's inequality.
I'm reading about the technique in the following article.

In the article the following is written:

Using the variance, we can apply Chebyshev's inequality to compute an upper bound on the probability that the currently shaded surface (at depth t) is occluded:

enter image description here

So according to this quote, in Chebysehv's inequality equation above t is the current fragment depth we're sampling and x is the value in shadow map for the fragment which is the first moment M1=E(x) for a given blur kernel area, and we're getting an upper-bound on the probability that x>=t which translates to what is the probability that the current fragment depth is less than the mean value depth in the blur kernel area.

Now, the difficulty in my understanding is how what I just wrote:

the probability that the current fragment depth is less than the mean value in the blur kernel area

is effectively the same as:

the probability that the currently shaded surface (at depth t) is occluded

Also what is the denominator σ^2 + (t - μ)^2 here?
In Chebyshev's inequality as far as I understood the denominator should be equal to c^2 which here equals to t^2.

There're some things I obviously don't understand and would glad if someone could clarify this for me.

Jorayen
  • 1,737
  • 2
  • 21
  • 52
  • They are using the [Cantelli's inequality](https://en.wikipedia.org/wiki/Cantelli%27s_inequality), which is a generalization of Chebyshev's. Does it help? – Yakov Galka Apr 17 '20 at 21:45
  • @ybungalobill A bit since both inequality as far as I understand define the probability of `P(X-E[X] >= c)`. So how they're defining it as `P(x >= c)` where x is only defined as `E[X]` and the denominator is `σ^2 + (t - μ)^2` according to Cantelli's inequality it suppose to be `σ^2 + t^2`. Also I can't figure the relationship of the general statement of what is the probability the the a certain sample distance from the expected value is greater than a constant to what is the probability the currently samples fragment is occluded or no. Could use an elaboration on that. – Jorayen Apr 17 '20 at 23:15

1 Answers1

3

They are using the Cantelli's inequality, which is a generalization of Chebyshev's inequality.

It says that:

P(x - Ex ≥ λ) ≤ σ²/(σ² + λ²)

We substitute λ = t - Ex to get:

P(x - Ex ≥ t - Ex) ≤ σ²/(σ² + (t - Ex)²)

The Ex cancels out:

P(x ≥ t) ≤ σ²/(σ² + (t - Ex)²)

Also Ex = μ, so

P(x ≥ t) ≤ σ²/(σ² + (t - μ)²)

x is the value in shadow map for the fragment which is the first moment M1=E(x) for a given blur kernel area

This is not what x is. x is a random variable that represents the unknown depth of the nearest intersection of the ray coming out of the light source in the direction of the fragment. The value in the shadow map is the expected value (mean, first moment) of that random variable. This is an important distinction to make.

Saying that the "currently shaded surface (at depth t) is occluded ... by a point at depth x" translates into "x ≥ t". Accordingly we are interested in the probability of x ≥ t.

Yakov Galka
  • 70,775
  • 16
  • 139
  • 220
  • Thanks you made things so much clearer to me now. 2 more questions I have: 1.`x ≥ t` means what the probability that the depth of `t` is less than the depth of `x` but that's translate to the complete opposite because of `t` is less than `x` than t is closer to the light so it suppose to be what is the probability of t being lit isn't it? And if I'm really correct so the answer is the probability that `t` is lit is at most `σ²/(σ² + (t - μ)²)` so to know how much is it's occluded I need to do `1 - σ²/(σ² + (t - μ)²)`? – Jorayen Apr 18 '20 at 11:54
  • 2. In the article they're calculating `p_max` but also `p` in the following way: `float p = (t <= Moments.x);` and then they return the upper bound as `return max(p, p_max)`. Could you explain what's the meaning of this and why do we compare `t` to `E[X]` in such way and taking the max between `p` and `p_max`? – Jorayen Apr 18 '20 at 11:55
  • ok for the first question I think I understand I don't need to take `1 - p_max` to be the shadow factor and multiply it by the fragment color, since `p_max` is the upper bound of a random fragment in the distribution that it's depth going to be larger than the inspected fragment. So if for example `p_max = 0.3` that means the upper bound of the probability that a fragment in the distribution is further than the inspected fragment is at most 0.3 (30%). So multiplying it by the fragment color is essentially saying make this fragment 70% more darker which make sense. – Jorayen Apr 18 '20 at 19:39
  • As for the second question, I understand that Chebyshev's inequality doesn't apply when `λ < E[X]` but I'm not sure I understand the reason, and clarification on that would be great! – Jorayen Apr 18 '20 at 19:40
  • Another question popped in to my mind while thinking about all this topic. Isn't using Gaussian filter box to filter the result, won't result in `E[x]` and `E[x^2]` since it's a weighted average and not a normal average? – Jorayen Apr 18 '20 at 20:20