Shocasing step by step how I build a full Monte Carlo path tracer
To start with, we simply sample the whole hemisphere to get the input light
As you may imagine, the method is prolonged, and results as many noise, also, it is not good when you have a tiny light source (as your random sample may fail to hit the light source)
Cos-weight sampling visualization
After 1 iteration
Converged result
Next, we try to decouple direct light out. In other words, for every "p", we only care about if there exists a path from light source to "p"
Cornel Box with direct area light sampling
Cornel Box with direct spot light sampling
Now, let's combine diffuse sampling with direct light sampling, which is what we called MIS
MIS result on different light source & surface with different roughness
Cornel box with MIS
Finally, we add environment map and global illumination into our world
Cornel box with GI only
Cornel mirror box with GI & Area light
Glassy balls | Dielectric materialsÂ
Eyeball | Specular & Glassy materials
Earth & Moon | Microfacet materials