0
$\begingroup$

When implementing explicit light sampling, I am separating the monte-carlo approximation to two parts

$$\frac{1}{N+M}(\sum^N \text{direct} + \sum^M \text{indirect})$$

$$\text{direct} = \frac{\text{bsdf} \times C \times cos(\theta)}{p}$$

I am confused as how to obtain $p$ for direct lightning. My light source is an arbitrary triangularized mesh and I am sampling random points from it's surface.

A solution was presented here: Path weight for direct light sampling

$$\frac{A}{r^2} (N_\text{light} \cdot -L)$$

Where does this come from? I'm asking for a reference or a derivation. Thanks!

$\endgroup$
6
  • $\begingroup$ Read "[Shirley, 1996] Monte Carlo Techniques for Direct Lighting Calculations". $\endgroup$ Jun 29, 2020 at 16:50
  • $\begingroup$ pbr-book.org/3ed-2018/Color_and_Radiometry/… $\endgroup$
    – Peter
    Jul 1, 2020 at 10:50
  • $\begingroup$ Also, I think you need to account for the probability of picking that triangle. I believe that the first equation you list is incorrect. You can't just add the direct and indirect samples together because they are from two different sampling schemes. You should look at multiple importance sampling which is a technique for combining sampling methods together. If you want help with implementing that don't hesitate to ask. $\endgroup$
    – Peter
    Jul 1, 2020 at 10:50
  • $\begingroup$ @Peter i thought the probability is taken into account with $A$, as long as points are sampled uniformly from the surface. However i already got decent results adding together the samples. The link I mentioned explains that the samples can be added together when using the formula $\endgroup$
    – vuoriov4
    Jul 1, 2020 at 13:05
  • $\begingroup$ I think it would work as long as A is the surface area of the whole mesh (not the triangle you are sampling) and the probablity of selecting a triangle is proportional to its surface area. If you want to do more advanced triangle selection which takes into account occlusion or distance from the shading point then you would have to change this. $\endgroup$
    – Peter
    Jul 1, 2020 at 17:45

1 Answer 1

3
$\begingroup$

It comes from the relation between the area formulation and the solid angle formulation of the rendering equation: $d\omega = \frac{\cos\theta_L}{r^2}dA$:

https://arxiv.org/abs/1205.4447

$\endgroup$

Your Answer

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

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