rendering / 04 · 74% · 12-day streak
CH 2 · THE ESTIMATOR
HDchapter 2 of 6 · the estimator
- vec3 estimate(Ray r, int N) {
- vec3 sum = vec3(0.0);
- for (int i = 0; i < N; i++) {
- vec3 dir = sampleHemisphere(rng());
- sum += trace(r, dir) * cosθ / pdf;
- }
- return sum / float(N); // unbiased
- }
- // noise ∝ 1/√N ← the price
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
- $ ask tutor "why does variance drop?"
- tutor Each sample is an unbiased guess. Averaging
- N of them shrinks the spread by √N — so the
- noise, not the answer, is what you buy down.
- reading variance.md · 2 refs
- ready