I have a question to the PDF from the Distance-Sampling-Function in particpating media.

In the SmallUPBP-Example is a function, that sample the ray-distance:

Code: Select all

`virtual float SampleRay(`

const Ray &/*aRay*/,

const float aDistToBoundary,

const float aRandom,

float *oPdf,

const uint aRaySamplingFlags = 0,

float *oRevPdf = NULL) const

{

float s = -std::log(aRandom) / mMinPositiveAttenuationCoefComp();

if (s < aDistToBoundary) // sample is before the boundary intersection

{

float att = EvalAttenuationInOneDim(mMinPositiveAttenuationCoefComp(), s);

if (oPdf) *oPdf = mMinPositiveAttenuationCoefComp() * att;

...

}

else // sample is behind the boundary intersection

{

float att = EvalAttenuationInOneDim(mMinPositiveAttenuationCoefComp(), aDistToBoundary);

if (oPdf) *oPdf = att;

...

}

}

float EvalAttenuationInOneDim(

const float aAttenuationCoefComp,

const float aDistanceAlongRay) const

{

return std::exp(-aAttenuationCoefComp* aDistanceAlongRay);

}

My question is: If the ray is shorter than the distance to the medium-boundary (Sample inside the medium) than he returns a PDF. If the ray is longer than the max-distance, then he returns a Probabilty.

A PDF is not the same as a Probabilty. So why can he mix this two things?

If I use his explanations

http://www.smallupbp.com/thesis.pdf Page 33

If the sampled distance

d is lesser than or equal to dmax, the method returns d along with the desired pdf p¯(d) = σt,mT0

r,m(d). If it is longer, dmax is returned with a probability Pr{d>dmax} = 1 − P(dmax) = T0r,m(dmax).

Or a other text to this topic:

http://www.cs.cornell.edu/courses/cs6630/2012sp/notes/09volpath.pdf Page 3

The probability

that s > smax is 1 – P(smax), which is exp(–σt smax): exactly the attenuation that needs to be applied

to the radiance from behind the medium

He also use this formula but I don't understand why he can mix PDF and Probability.

In the 'normal' pathtracer I get the Path-Pdf by multiplying all the Sampling-Pdfs (Direction-Sampling / Survace-Area-Sampling). This Path-Pdf is needet for the MC-Estimator. But what happens, if one of this Sampling-Pdfs is not a PDF but a Probability?

Can someone explain me why he can mix this two things, if he want to MonteCarlo-Integrate?