I would like to compute volumetric obscurance with line integrals like described in this paper.

For a 2D sample, it is possible to know the "depth in sphere". But I don't understand how they compute the occluded (in red on the following image) part and the unnoccluded (in yellow) part of the line in the sphere.

I think that they say that given the depth read through the sample and the "depth in sphere", we should be able to deduce each part of the lines.

line sampling


1 Answer 1


This is based on the formula for a sphere that expresses its surface $z$ as a function of $x, y$: $$z(x, y) = \pm\sqrt{r^2 - x^2 - y^2}$$

So, if $x, y$ is the vector from the sphere's center to your sample point, the total length of the line segment (both occluded and unoccluded parts) is the distance between the top and bottom surfaces, which is $L = 2\sqrt{r^2 - x^2 - y^2}$. (This formula appears on slide 51 of that paper, BTW, although they've apparently scaled so that the radius is 1.)

Then, if you know the depth of the sample point relative to the sphere's center (call it $\Delta z$), you can calculate the fraction of the line that's occluded as $$\frac{\tfrac{1}{2}L - \Delta z}{L}$$ or equivalently $$\frac{1}{2} - \frac{\Delta z}{L}$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.