Sunday, October 21, 2007

Probabilistic reflection/refraction

In the response to the previous post, Thomas said he would choose probabilistically. If you are sending many rays per pixel I definitely agree this is the way to go. I believe that approach was first suggested in Kajiya's 86 path tracing paper.

color trace(ray r, depth d)
color c
if (r hits scene at point p)
c = direct_light(p)
if (depth < maxdepth)
if (random < ks)
c+= trace(reflected_ray)
c+= trace(refracted_ray)
c = background(r)
return c

Note that the weighting is implicit; if you trace reflected_ray a fraction ks of the time, that is just like tracing it every time and weighting it by ks. And as Thomas said, the best images come when you use Fresnel equations.


jared said...

I recently implemented this in my renderer, and happened to have this comparison image.

The glass on the left was sampled by choosing uniformly at random between transmission and reflection.

The glass on the right was sampled by evaluating the Fresnel terms for reflection & refraction and importance sampling between them.

Overall, the importance sampling method generates a much smoother glass ball, except for the reflection of the light. If we took into account the position of the light at scattering time, we could account for this, but this is often not convenient.

I wonder if there's a way to do even better using only local scattering knowledge?

Thomas said...

the difference in variance is quite remarkable :)

about the reflection of the light source, i think if you used sufficiently many samples for noise on the diffuse walls and glossy floor to disappear, the reflection would also be smooth. in other words, perhaps it was over-sampled before?

sexy said...








Entertainment said...

home city trung kính

home city

chung cư trung kính

trung kính complex

5S Online - mùa 3 - Tập 66: Tình cậu duyên anh - Phần 1

5S Online - mùa 3 - Tập 65: Con nuôi sếp tổng - Phần 2

5S Online - mùa 3 - Tập 64: Con nuôi sếp tổng - Phần 1

5S Online - mùa 3 - Tập 63: Cắt đuôi sao cho xuôi - Phần 3

5S Online - mùa 3 - Tập 62: Cắt đuôi sao cho xuôi - Phần 2

5S Online - mùa 3 - Tập 61: Cắt đuôi sao cho xuôi - Phần 1

5S Online - Tập 54: Làm giàu quá khó cần có vận may - Phần 3

5S Online - Tập 53: Làm giàu quá khó cần có vận may - Phần 2

5S Online - Tập 52: Làm giàu quá khó cần có vận may - Phần 1

chung cư t&t riverside

chung cư 440 vĩnh hưng

chung cư t&t riverside 440 vĩnh hưng

bat dong san

bat dong san cho thue

bat dong san ban