<p>Given that I didn't miss anything, you can probably cut this down to a problem in the 2D space. Viewing onto the plane defined by the center points of the spheres and your camera origin, the scene looks like this:</p>

<p><a href="https://i.sstatic.net/IhbVx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/IhbVx.png" alt="scene with visible intersection"></a></p>

<p>The spheres become circles with the center points $C_1$ and $C_2$, and the intersection circle is now only 2 points with only the closer one $P$ being interesting. The camera/eye is arbitrarily set to the point $E$.</p>

<p>Calculating if one point on the spheres is visible or not is easy: Simply check whether or not the angles at point $P$ between $E$ and $C_1$ respectively $E$ and $C_2$ are both greater (or equal to) 90 degree<sup>1</sup>.</p>

<p>If $P$ is visible, some part (e.g. at least that point) of the intersection circle is visible. Otherwise the whole intersection circle must be occluded by one of your spheres, namely the one which creates an angle of less than 90 degree.</p>

<p>Here is how it looks if $P$ is not visible from $E$:</p>

<p><a href="https://i.sstatic.net/tAnbC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tAnbC.png" alt="enter image description here"></a></p>

<p>You can clearly see how that point is occluded by the circle around $C_2$ and that the angle between $E$ and $C_2$ in $P$ is less than 90 degree.</p>

<hr>

<p><sub><sup>1</sup> Having an angle of exactly 90 degree means that the line between $E$ and $P$ just touches the respective circle/sphere in point $P$ as a tangent.</sub></p>

CC BY-SA 3.0
2015-12-12T11:23:46.880Z
2015-12-12T11:29:06.757Z
2015-12-12T11:29:06.757Z
Nero
<p>Thinking about hybrid raytracing, hence the following question:</p>

<p>Suppose I have two solid spheres $s_1$ and $s_2$. We know their centres and radii, and we know that they have some overlapping volume in space.</p>

<p>We have a typical 3D graphics setup: assume eye is at the origin, and we are projecting the spheres onto a view plane at $z = f$ for some positive $f$. The spheres are beyond the view plane and don't intersect it.</p>

<p>Let $c$ be the circle in space that is points on the surface of both spheres, i.e. the visible (from some angles) 'join' of their overlapping volumes.</p>

<p>I want to calculate if any of $c$ is visible when projected onto our view plane. It might not be, if $s_1$ or $s_2$ get completely in the way.</p>

<p>Any ideas for approaching this?</p>

CC BY-SA 3.0
2015-12-14T02:24:53.623Z
if c is a union of the projected pixels, when s1 or s2 completely obstructs the other sphere, it does not mean c gets empty. please clarify.
v.oddou
<raytracing><3d><occlusion>
Sphere intersection occlusion (for hybrid raytracing)
occulus
# Sphere intersection occlusion (for hybrid raytracing)

(Asked by: username_0 on 2015-12-11)

Thinking about hybrid raytracing, hence the following question:

Suppose I have two solid spheres $s\_1$ and $s\_2$. We know their centres and radii, and we know that they have some overlapping volume in space.

We have a typical 3D graphics setup: assume eye is at the origin, and we are projecting the spheres onto a view plane at $z = f$ for some positive $f$. The spheres are beyond the view plane and don't intersect it.

Let $c$ be the circle in space that is points on the surface of both spheres, i.e. the visible (from some angles) 'join' of their overlapping volumes.

I want to calculate if any of $c$ is visible when projected onto our view plane. It might not be, if $s\_1$ or $s\_2$ get completely in the way.

Any ideas for approaching this?

**Tags:** raytracing, 3d, occlusion

> **Comments:**
> **username_1**: if c is a union of the projected pixels, when s1 or s2 completely obstructs the other sphere, it does not mean c gets empty. please clarify.  

---

## 1 answers

### Answer by username_2 on 2015-12-12. Score: 7 | Accepted answer

Given that I didn't miss anything, you can probably cut this down to a problem in the 2D space. Viewing onto the plane defined by the center points of the spheres and your camera origin, the scene looks like this:

[![scene with visible intersection](https://i.sstatic.net/IhbVx.png)](https://i.sstatic.net/IhbVx.png)

The spheres become circles with the center points $C\_1$ and $C\_2$, and the intersection circle is now only 2 points with only the closer one $P$ being interesting. The camera/eye is arbitrarily set to the point $E$.

Calculating if one point on the spheres is visible or not is easy: Simply check whether or not the angles at point $P$ between $E$ and $C\_1$ respectively $E$ and $C\_2$ are both greater (or equal to) 90 degree1.

If $P$ is visible, some part (e.g. at least that point) of the intersection circle is visible. Otherwise the whole intersection circle must be occluded by one of your spheres, namely the one which creates an angle of less than 90 degree.

Here is how it looks if $P$ is not visible from $E$:

[![enter image description here](https://i.sstatic.net/tAnbC.png)](https://i.sstatic.net/tAnbC.png)

You can clearly see how that point is occluded by the circle around $C\_2$ and that the angle between $E$ and $C\_2$ in $P$ is less than 90 degree.

---

1 Having an angle of exactly 90 degree means that the line between $E$ and $P$ just touches the respective circle/sphere in point $P$ as a tangent.


---

