<p>You need to perform integration of $P$ over the hemisphere to <a href="https://www.wolframalpha.com/input/?i=Integrate%5BExp%5B-alpha%2FCos%5Btheta%5D%5D*sin%5Btheta%5D,%20%7Btheta,%200,%20pi%2F2%7D,%20%7Bphi,%200,%202pi%7D%5D" rel="nofollow noreferrer">calculate the solution</a>. There doesn't seem to be closed-form solution as the solution requires <a href="https://en.wikipedia.org/wiki/Incomplete_gamma_function" rel="nofollow noreferrer">incomplete gamma function</a>:
$$2\pi(e^{-\alpha d}-\alpha d\Gamma(0,\alpha d))$$</p>

CC BY-SA 3.0
2017-12-21T04:15:02.363Z
2017-12-21T04:15:02.363Z
JarkkoL
<p>I want to extend the following to work on a solid angle:</p>

<p>Suppose we have a volume filled with small surfaces.  If we cast a ray from a given point, the probability that the ray will not hit a surface (i.e. is visible to the sky) is given as </p>

<p>$P(ray\ does\ not\ hit) = {e}^{-\alpha d/\cos\theta}$</p>

<p>where $\alpha$ is some decay factor, $d/cos\theta$ is the path length of the ray within the volume.</p>

<p><strong>My question:</strong><br>
 How can we compute the expected visibility of a ray if we consider the directions $(\theta, \phi)$, where $0&lt;\theta&lt;\pi/2$ and $0&lt;\phi&lt;2\pi$?</p>

CC BY-SA 3.0
2017-12-18T12:11:37.010Z
What do you mean by "consider the directions"? Are you trying to integrate over some solid angle instead of a single ray? Are you trying to extend the volume to be heterogeneous or anisotropic?
Dan Hulme
CC BY-SA 3.0
2017-12-18T19:59:35.697Z
I am integrating over some solid angle.
Stackmm
<ambient-occlusion><ray>
Expected visibility
Stackmm
# Expected visibility

(Asked by: username_0 on 2017-12-18)

I want to extend the following to work on a solid angle:

Suppose we have a volume filled with small surfaces. If we cast a ray from a given point, the probability that the ray will not hit a surface (i.e. is visible to the sky) is given as

$P(ray\ does\ not\ hit) = {e}^{-\alpha d/\cos\theta}$

where $\alpha$ is some decay factor, $d/cos\theta$ is the path length of the ray within the volume.

**My question:**  
How can we compute the expected visibility of a ray if we consider the directions $(\theta, \phi)$, where $0<\theta<\pi/2$ and $0<\phi<2\pi$?

**Tags:** ambient-occlusion, ray

> **Comments:**
> **username_1**: What do you mean by "consider the directions"? Are you trying to integrate over some solid angle instead of a single ray? Are you trying to extend the volume to be heterogeneous or anisotropic?  
> **username_0**: I am integrating over some solid angle.  

---

## 1 answers

### Answer by username_2 on 2017-12-21. Score: 1

You need to perform integration of $P$ over the hemisphere to [calculate the solution](https://www.wolframalpha.com/input/?i=Integrate%5BExp%5B-alpha%2FCos%5Btheta%5D%5D*sin%5Btheta%5D,%20%7Btheta,%200,%20pi%2F2%7D,%20%7Bphi,%200,%202pi%7D%5D). There doesn't seem to be closed-form solution as the solution requires [incomplete gamma function](https://en.wikipedia.org/wiki/Incomplete_gamma_function):
$$2\pi(e^{-\alpha d}-\alpha d\Gamma(0,\alpha d))$$


---

