Random numbers are often generated uniformly in the range between 0 and 1. We can combine multiple such random numbers to sample cartesian domains uniformly, but different distributions are needed, e.g., to get uniform distribution in a non-cartesian domain (for recursive rendering, we need to sample the hemisphere for instance), or for importance sampling techniques. This task can be fully solved in \texttt{warp.cpp}.
...
...
@@ -126,7 +125,7 @@ Implement next event estimation (NEE) for your diffuse path tracer, according to
That is, on every bounce, you create one light surface sample and try to connect to compute direct lighting with surface sampling.
Another ray is then sent out to retrieve indirect light in the next bounce. Make sure that you use the BSDF to generate the indirect sample to benefit from cosine-weighted hemisphere sampling of indirect light on materials that use it.
If you implement NEE, be careful not to erroneously count the emittance twice (i.e., first when doing the light surface sampling and then when hitting a light source randomly).
To get a correct image, the emittant surface points that your ray hits should only be considered on the first intersection.
To get a correct image, the emittant surface points that your ray hits should only be considered on the first intersection or if the last material did not support hemisphere sampling (e.g., mirrors!).
For all other light, the illumination is computed via direct lighting, i.e., one bounce in the future (hence, "next event").
For further details, please see the lecture slides. Just as a heads-up: implementing NEE will dramatically improve the quality of your renderings! In combination with spatial acceleration structures, you should now be able to render impressive scenes fast! To test this, compare the output of the test scenes that end in \texttt{uniform} or \texttt{cosine} with the ones that end in \texttt{nee}. The latter use next event estimation and should give significantly cleaner results.