~/rendering/04$ lesson --open "why-random-rays"
4 due● 1 live
Nova
rendering / 04 · 74% · 12-day streak
CH 2 · THE ESTIMATOR
HDchapter 2 of 6 · the estimator
04:12
12:40
  1. vec3 estimate(Ray r, int N) {
  2. vec3 sum = vec3(0.0);
  3. for (int i = 0; i < N; i++) {
  4. vec3 dir = sampleHemisphere(rng());
  5. sum += trace(r, dir) * cosθ / pdf;
  6. }
  7. return sum / float(N); // unbiased
  8. }
  9. // noise ∝ 1/√N ← the price
estimator.glsl● MODIFIED

Why random rays?

lesson 04 · 12 min · renderingThe rendering equation is an integral nobody can solve in closed form, so the estimator guesses: fire a ray in a random direction, weight what comes back, and average. Every guess is wrong; the average is not. What you buy with more samples is not a better answer but a quieter one.
CHECKPOINT · +30 XP
Halving the noise costs…
SETTINGS
  1. $ ask tutor "why does variance drop?"
  2. tutor Each sample is an unbiased guess. Averaging
  3. N of them shrinks the spread by √N — so the
  4. noise, not the answer, is what you buy down.
  5. reading variance.md · 2 refs
  6. ready
tutor reads the chapter you are on