## Volume Transmittance in Heterogeneous Media

Practical and theoretical implementation discussion.
shocker_0x15
Posts: 75
Joined: Sun Aug 19, 2012 3:24 pm
Contact:

### Volume Transmittance in Heterogeneous Media

We can generate a freepath sample according to the distribution of heterogeneous media by using woodcock tracking.
However, How should / can we evaluate volume transmittance in a medium.

In heterogeneous media, transmittance is the following expression.
$T ( x, x' ) = \exp \Bigl( -\int_{0}^{\left\| x' - x \right\|} \sigma_e (x + s \vec{\omega}_{xx'}) ds \Bigr)$
and pdf is
${pdf}_{x'} ( x, x' ) = \sigma_e (x') \exp \Bigl( -\int_{0}^{\left\| x' - x \right\|} \sigma_e (x + s \vec{\omega}_{xx'}) ds \Bigr)$

Therefore, the Monte Carlo throughput becomes
$\frac{T ( x, x' )}{{pdf}_{x'} ( x, x' )} = \frac{1}{\sigma_e{(x')}}$

So, don't I have to explicitly know those quantities ?
Last edited by shocker_0x15 on Mon Jan 21, 2013 8:28 am, edited 2 times in total.

ingenious
Posts: 282
Joined: Mon Nov 28, 2011 11:11 pm
Location: London, UK
Contact:

### Re: Volume Transmittance in Inhomogeneous Media

That's the trick with sampling proportionally to transmittance - that you don't need to explicitly compute it's value, as it cancels out in the final estimator. You only need the extinction at the second vertex, as your last equation shows. Unfortunately, there are situations where you still need to explicitly compute the transmittance. These are connections to light sources, general vertex connections in bidirectional path tracing (BPT), and MIS weights in BPT. You can use Woodcock tracking for this too, as described in Raab et al.'s paper "Unbiased Global Illumination with Participating Media".

shocker_0x15
Posts: 75
Joined: Sun Aug 19, 2012 3:24 pm
Contact:

### Re: Volume Transmittance in Heterogeneous Media

Thanks ingenious
I will try to read the paper.

But I have questions.
I can roughly understand why the transmittance along heterogeneous media is according to the above expression.
However, I found the following questions.
1. Is NOT the pdf actually proportional to the transmittance because $$\sigma_e (x')$$ is not a constant within the domain ?
2. How can we derive the pdf expression ?

ingenious
Posts: 282
Joined: Mon Nov 28, 2011 11:11 pm
Location: London, UK
Contact:

### Re: Volume Transmittance in Heterogeneous Media

shocker_0x15 wrote:Is NOT the pdf actually proportional to the transmittance because $$\sigma_e (x')$$ is not a constant within the domain ?
That's actually true -- the term $$\sigma_e (x')$$ makes the pdf not strictly proportional to the transmittance, in the sense that when you divide the two, the resulting function will generally not be constant.
shocker_0x15 wrote:How can we derive the pdf expression ?
In the homogeneous case, the pdf expression is derived by simply taking the transmittance term and normalizing it, i.e. by dividing it by its integral from zero to infinity. In the inhomogeneous case, it's easier to derive when you realize that the transmittance itself is the CDF of the desired distribution. So to get the pdf, you just take the transmittance, differentiate it, and you obtain the expression in your second equation.

shocker_0x15
Posts: 75
Joined: Sun Aug 19, 2012 3:24 pm
Contact:

### Re: Volume Transmittance in Heterogeneous Media

Thank you.
How simple deriving the heteregeneous pdf is

I see that the pdf is not proportional to the transmittance.
It is unlike that sampling BSDF with an optimal pdf generally produce a constant, isn't it ?
Well, just sampling proportional to the transmittance will produce a point, where it is in a vacuum. (there is no in-scattered radiance)

By the way, I've read the paper.
And I'm sorry to get a new question

In the paper "Unbiased Global Illumination with Participating Media", Section 3.1 Line Integral along a Ray, an algorithm is written there.
First, I was confused by the 3rd item.
3.Estimate the surface contribution $$c_{\partial \nu} = L (x_{\partial \nu}, \omega)$$ and set $$C = p_{\partial \nu} \cdot c_{\partial \nu}$$
Where has the transmittance term gone ?

And I also couldn't understand the 5th item.
Add contributions
$C = C + \left\{ \begin{array}{ll} \frac{1}{n} \cdot p_\nu \cdot \frac{c (x - t_k \omega, \omega)}{\sigma_t (x - t_k \omega)}, & \textrm{if}\hspace{2mm} t_k < t_{\partial \nu} \\ \frac{1}{n} \cdot p_\nu \cdot c_{\partial \nu}, & \textrm{else} \end{array} \right.$
for $$k = 1, \ldots, n$$
Why is there the term $$p_\nu$$ ?
Is it due to the range of the equidistant sample points $$\Delta \subset [0, p_\nu)$$ ?

ingenious
Posts: 282
Joined: Mon Nov 28, 2011 11:11 pm
Location: London, UK
Contact:

### Re: Volume Transmittance in Heterogeneous Media

Indeed, I've been wondering how this algorithm has been derived. I've looked at it before, and tried to decipher it, but gave up quickly. I've been frustrated with how difficult it can be to follow some of Alex Keller's papers. They're often written like cookbooks, without much motivation and insight. Therefore, I'd also appreciate it if someone can shed some light here.

necro
Posts: 6
Joined: Thu Dec 22, 2011 9:44 am

### Re: Volume Transmittance in Heterogeneous Media

Secret sources tell me that the first author is in league with dark forces and that the algorithm might be verbal inspiration by Satan himself But that's surely no excuse for a badly written paper. Let's try an exorcism.

The idea behind the algorithm is to only create starting points for the Coleman sampling process that lie within the volume. Each such first point is sampled using an exponential distribution (based on the maximum extinction). If we would use n equidistantly spaced values in the whole unit interval [0,1) some of them would already result in a distance that hits the surface. So one determines the probability of that and limits the values to the interval that doesn't hit the surface.

One way to think about this is that a random variable is replaced by its expected value. Another way to think about it is that this is an interpretation of the media as homogeneous with maximum extinction (where the transmittance to the surface can be computed analytically) and compensation for that - some kind of separation of the main part.
Of course one could also call the thing overcomplicated and useless: typically the algorithm sucks because it splits and splitting is often quite pointless + it is written down too general and looks too complicated. But the main application is to compute transmittance and here the algorithm is quite simple. If you ignore the fact that you potentially over/undersample the inhomogeneous part (and another thing not mentioned in the paper: for homogeneous you always waste one sample for transmittance computation) one easily implement and choose n based on how inhomogeneous it the volume is.

So, enough shedding light. We should shed more darkness, darkness converges faster.
ia, ia, cthlulhu fhtagn!